Silverlight独立存储配置相关操作步骤讲解

开发 开发工具
Silverlight独立存储配置主要是基于本地文件存储,它的使用不仅可以帮助我们存储一些简单类型的数据,而且还能存储一些自定义的数据类型。

Silverlight开发工具中有很多功能可以被我们灵活的利用创造出更多的新颖的功能服务于大众。对于这样的一款多媒体处理工具,其功能是非常强大的。Silverlight独立存储配置,在Beta 1时代是应用程序配置,现在不仅支持应用程序配置,同时还支持站点配置,我们可以用它来存储应用程序配置如每个页面显示的图片数量,页面布局自定义配置等等,使用IsolatedStorageSettings类来实现,该类在设计时使用了字典来存储名-值对,它的使用相当简单:#t#

  1. IsolatedStorageSettings appSettings =
    IsolatedStorageSettings.ApplicationSettings;  
  2. appSettings.Add("mykey","myValue");  
  3. appSettings.Save();  
  4. IsolatedStorageSettings siteSettings =  
  5. IsolatedStorageSettings.SiteSettings;  
  6. siteSettings.Add("mykey1","myValue1");  
  7. siteSettings.Save(); 

Silverlight独立存储配置的机制也是基于本地文件存储,系统默认的会创建一个名为__LocalSettings的文件进行存储。

 打开文件后可以看到,存储的内容(此处进行了整理)

  1. < ArrayOfKeyValueOfstringanyType   
  2. xmlns:i="http://www.w3.org/2001
    /XMLSchema-instance"
     
  3. xmlns="http://schemas.microsoft
    .com/2003/10/Serialization/Arrays"
    > 
  4. < KeyValueOfstringanyType> 
  5. < Key>mykey< /Key> 
  6. < Value xmlns:d3p1="http://
    www.w3.org/2001/XMLSchema"
       
  7. i:type="d3p1:string">myValue< /Value> 
  8. < /KeyValueOfstringanyType> 
  9. < /ArrayOfKeyValueOfstringanyType> 

值得一提的是使用Silverlight独立存储配置不仅仅可以存储简单类型的数据,也可以存储我们自定义类型的数据。

责任编辑:曹凯 来源: 博客园
相关推荐

2009-12-31 09:50:52

Silverlight

2010-01-04 14:49:30

Silverlight

2009-12-30 14:51:47

Silverlight

2009-12-30 14:22:12

Silverlight

2009-12-30 18:18:32

Silverlight

2009-12-30 10:44:38

Silverlight

2009-12-31 16:38:19

Silverlight

2009-12-30 16:43:47

Silverlight

2009-12-31 13:45:13

Silverlight

2009-12-30 10:32:31

Silverlight

2009-12-30 17:29:53

Silverlight

2009-12-31 11:35:20

Silverlight

2010-01-05 18:09:07

.NET Framew

2009-12-30 18:07:54

Silverlight

2009-12-30 10:54:18

Silverlight

2010-01-28 16:55:26

Android对话框

2010-04-22 16:01:48

Aix操作系统串口

2010-03-01 16:31:58

WCF实现SOA

2009-12-31 13:33:35

Silverlight

2010-01-04 15:34:18

点赞
收藏

51CTO技术栈公众号