- 浏览: 424925 次
- 性别:
- 来自: 唐山
文章分类
最新评论
-
hautbbs:
谢谢分享!
ASP.NET 导出Excel 和csv -
hautbbs:
感谢分享!
ASP.NET 导出Excel乱码的终极解决 -
wyf:
zcl920 写道只能说 看不懂。要发就发全 取一段出来 有什 ...
图片上绘制文字换行处理 -
zcl920:
只能说 看不懂。要发就发全 取一段出来 有什么用。
图片上绘制文字换行处理 -
380086154:
有用,谢谢。
js比较日期
Silverlight uses Isolated Storage as a virtual file system to store data in a hidden folder on your machine. It breaks up the data into two separate sections: Section #1 contains administrative information such as disk quota and section #2
Silverlight uses Isolated Storage as a virtual file system to store data in a hidden folder on your machine. It breaks up the data into two separate sections: Section #1 contains administrative information such as disk quota and section #2 contains the actual data. Each Silverlight application is allocated its own portion of the storage with the current quota set to be 1 MB per application.
Advantages:
- Isolated Storage is a great alterative to using cookies (as discussed in Tip of the Day #18) especially if you are working with large sets of data. Examples of use include undo functionality for your app, shopping cart items, window settings and any other setting your application can call up the next time it loads.
- Isolated storage stores by user allowing server applications to dedicate unique settings per individual user.
Possible Pitfalls:
- Administrators can set disk quota per user and assembly which means there is no guarantee on space available. For this reason, it is important to add exception handling to your code.
- Even though Isolated Storage is placed in a hidden folder it is possible, with a bit of effort, to find the folder. Therefore the data stored is not completely secure as users can change or remove files. It should be noted though that you can use the cryptography classes to the encrypt data stored in isolated storage preventing users from changing it.
- Machines can be locked down by administrative security policies preventing applications from writing to the IsolatedStorage. More specifically, code must have the IsolatedStorageFilePermission to work with isolated storage.
All that said, let’s take a look at how we save and load data. Note that you will need to add a using statement to reference the namespace System.IO.IsolatedStorage as well as System.IO.
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.IO.IsolatedStorage; using System.IO; namespace SilverlightApplication10 { public partial class Page : UserControl { public Page() { InitializeComponent(); SaveData("Hello There", "MyData.txt"); string test = LoadData("MyData.txt"); } private void SaveData(string data, string fileName) { using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(fileName, FileMode.Create, isf)) { using (StreamWriter sw = new StreamWriter(isfs)) { sw.Write(data); sw.Close(); } } } } private string LoadData(string fileName) { string data = String.Empty; using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(fileName, FileMode.Open, isf)) { using (StreamReader sr = new StreamReader(isfs)) { string lineOfData = String.Empty; while ((lineOfData = sr.ReadLine()) != null) data += lineOfData; } } } return data; } } }
发表评论
-
Silverlight同步(Synchronous)调用WCF服务
2015-04-10 15:51 753基于AutoResetEvent的同步实现 利用Aut ... -
iis8 默认不支持svc解决方法
2014-09-18 18:57 728以下内容对于使用WIN2012 部署V9的时候使用。 ... -
WCF-IErrorHandler
2011-10-11 16:30 1005使用 IErrorHandler 接口,我们可以更深入地 ... -
Silverlight自定义类库实现应用程序缓存
2011-09-25 14:06 900默认情况下,如果SL项目引用了一些其它程序集(即通俗意义上的d ... -
附加属性指定图片地址
2010-12-09 16:58 995public static void SetUrlSource ... -
Silverlight 中读取JSON数据
2010-12-02 09:16 1295假定按照 如何:对基于 ... -
画雷达图背景
2010-10-09 16:36 1312直接糊代码 public partial class Mai ... -
拖动类
2010-08-03 15:51 662public static class DragDrop { ... -
显示数据库图片
2010-05-07 10:57 1131可以创建一个类,该类允许通过从 IValueConverter ... -
Convert Hex String to .NET Color(十六进制字符串颜色转Color)
2010-05-04 17:49 2201string xCol = "#FF00DD&quo ... -
"Printing" in Silverlight 3 with WriteableBitmap
2010-04-27 13:00 1315One of the high-profile missing ... -
ASP.NET Membership and Roles in Silverlight 3
2010-04-27 11:02 1260Since Silverlight applications ... -
Silverlight客户端和WCF服务器端共享类库
2010-04-15 12:42 2253WCF为了给Silverlight客户端提供引用共享类型,我们 ... -
Silverlight实现多语言
2010-03-08 15:11 1806首先添加一个主资源文件Text.resx 设置生成代码 pub ... -
动态载入xap文件
2010-02-25 11:10 1139myButton.Click += new RoutedEve ... -
SilverLight中调用自定义用户控件
2010-02-25 11:07 20701.在aspx页面中切换调用同一个SilverLight项目中 ... -
Silverlight拖放封装
2009-12-09 10:51 1514public static class ExtendMe ... -
Silverlight图表控件 (超炫)
2009-12-03 14:43 7076开源的项目visifire,使用它可以在Silverlig ...
相关推荐
isolated-vm
Visual Studio 2013 Shell (Isolated)
Large-scale Isolated Gesture Recognition using Pyramidal 3D Convolutional Networks
Troubleshooting C C++ Isolated Applications and Side-by-side Assemblies. 发现并解决C C++独立应用程序和并行程序集的问题(无法运行VS2008开发的MFCC++程序的参考)
led驱动40.5 W, High Power Factor (-0.95), -5% IOUT Tolerance, Non-Isolated Buck LED Driver Using LinkSwitchTM-PH LNK419EG
1、四大缓存方式,在Caching Application Block中,主要提供以下四种保存缓存数据的途径,分别是:内存存储(默认)、独立存储(Isolated Storage)、数据库存储(DataBase Cache Storage)和自定义存储(Custom ...
信息,使用ISolatedStorage存入独立存储区,以后直接从 存储区读取用户信息,降低服务器负荷。 2.记住密码,使用ISolatedStorage独立存储区,加载登录窗体 时,先查找独立存储区有无信息,若有且记住密码标志为"1...
发现并解决C C++独立应用程序和并行程序集的问题 Troubleshooting C C++ Isolated Applications and Side-by-side Assemblies
1、sqlserver 2012 因为卸载vs2010后无法正常使用,需要重新安装该插件
induction generator in isolated grid
WP7 Isolated Storage Explorer
艾络格电子工业 RS232 & RS485/422 Isolated 转换器zip,艾络格电子工业 RS232 & RS485/422 隔离转换器
一种合适的传感器节点聚类算法可以提高传感器网络的能效。然而,集群需要额外的开销,比如集群头的选择和分配,以及集群的构建。摘要提出了一种基于孤立节点的无线传感器网络区域能量感知聚类方法,称为孤立节点区域...
tf-vrouter
Virginia Tech- ACTIVE-CLAMP FLYBACK AS AN ISOLATED PFC FRONT-END CONVERTER
可以实现简单孤立词的识别和训练,内有1到9的录音,可以自己训练。
window phone 8 Backup Isolated Storage To SkyDrive
Enterocin from Enterococcus faecium isolated from mangrove environment
Measurement of Mitochondrial Respiration in Isolated Protoplasts_ Cytochrome and Alternative Pathways
Alkaline protease production from newly isolated plant growth promoting rhizobacteria