[索引页]
[源码下载]


稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)


作者:webabcd


介绍
Silverlight 2.0 数据的独立存储(Isolated Storage):
    IsolatedStorageFile - 操作 独立存储 的类
        IsolatedStorageFile.GetUserStoreForSite() - 按站点获取用户的独立存储
        IsolatedStorageFile.GetUserStoreForApplication() - 按应用程序获取用户的独立存储
    IsolatedStorageSettings - 在独立存储中保存的 key-value 字典表
        IsolatedStorageSettings.SiteSettings - 按站点保存的 key-value 字典表
        IsolatedStorageSettings.ApplicationSettings - 按应用程序保存的 key-value 字典表


在线DEMO
http://www.cnblogs.com/webabcd/archive/2008/10/09/1307486.html


示例
IsolatedStorage.xaml
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)<UserControl x:Class="Silverlight20.Data.IsolatedStorage"
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)    xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)    xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml">
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)    
<StackPanel HorizontalAlignment="Left">
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)        
<TextBox x:Name="txtMsg" Margin="5" />
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)        
<TextBox x:Name="txtMsg2" Margin="5" />
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)        
<Button x:Name="increase" Content="增加配额" Click="increase_Click" Margin="5" />
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)    
</StackPanel>
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
</UserControl>
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)

IsolatedStorage.xaml.cs
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)using System;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.Collections.Generic;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.Linq;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.Net;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.Windows;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.Windows.Controls;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.Windows.Documents;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.Windows.Input;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.Windows.Media;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.Windows.Media.Animation;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.Windows.Shapes;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.IO.IsolatedStorage;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
using System.IO;
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
稳扎稳打Silverlight(16) - 2.0数据之独立存储(Isolated Storage)
namespace Silverlight20.Data

演示 IsolatedStorageFile 的运行结果:
根目录下的目录列表:
Directory01
Directory02
根目录下的文件列表:
RootFile01.txt
__LocalSettings
目录 Directory01 下的目录列表:
SubDirectory01
目录 Directory01/SubDirectory01 下的*.txt文件列表:
File01.txt
File02.txt
文件 File01.txt 的内容:
我是:webabcd
我专注于asp.net, Silverlight
无法删除,目录不为空或不存在。

演示 IsolatedStorageSettings 的运行结果:
value
value2
0


OK
[源码下载]

相关文章: