[Windows Phone 7] Storage
现在Windwos Phone 7的数据存储得写入到独立存储空间中,有两种存储方式:1.独立文件存储;2.独立设置存储。
(1)独立文件存储
独立文件存储的使用方法与文件类似
写入:
//Obtain the virtual store for application IsolatedStorageFile myStore = IsolatedStorageFile.GetUserStoreForApplication(); //Create a new folder and call it "ImageFolder" myStore.CreateDirectory("ImageFolder"); //Create a new file and assign a StreamWriter to the store and this new file (myFile.txt) //Also take the text contents from the txtWrite control and write it to myFile.txt StreamWriter writeFile = new StreamWriter(new IsolatedStorageFileStream("ImageFolder\\myFile.txt", FileMode.OpenOrCreate, myStore)); writeFile.WriteLine(txtWrite.Text); writeFile.Close();
读取:
//Obtain a virtual store for applicationIsolatedStorageFile myStore = IsolatedStorageFile.GetUserStoreForApplication();//This code will open and read the contents of myFile.txt//Add exception in case the user attempts to click “Read button first.StreamReader readFile = null;try{readFile = new StreamReader(new IsolatedStorageFileStream("ImageFolder\\myFile.txt", FileMode.Open, myStore));string fileText = readFile.ReadLine();//The control txtRead will display the text entered in the filetxtRead.Text = fileText;readFile.Close();}catch{txtRead.Text = "Need to create directory and the file first.";}
(2)独立设置存储
//获取独立设置存储对象 IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;//写数据 setting["name"]="Bill"; setting["age"]=""20; setting.save(); //读数据 string Name=setting["name"];
更具体的例子可以看微软SettingsSample的例子,里面有很详细的说明怎么进行独立设置存储。
转载于:https://www.cnblogs.com/ssqjd/archive/2010/10/13/1850660.html
[Windows Phone 7] Storage相关推荐
- 利用Windows Azure Queue Storage给AutoCAD传递对象
前面峻祁连在文章使用Amazon Simple Queues Service (SQS)实现与AutoCAD远程交互中介绍了使用亚马逊的简单队列服务(SQS),这里在介绍一下使用微软的Windows ...
- Windows Azure Storage (6) Windows Azure Storage之Table
<Windows Azure Platform 系列文章目录> 最近想了想,还是有必要把Windows Azure Table Storage 给说清楚. 1.概念 Windows Azu ...
- Windows Azure Storage (3) Windows Azure Storage Service存储服务之Blob详解(中)
<Windows Azure Platform 系列文章目录> 如果读者使用的是国内由世纪互联运维的Azure China服务,请参考笔者的博文Azure China (4) 管理Azur ...
- Windows Azure虚拟机概览
Windows Azure自从2012预览版开始添加了新的虚拟机功能.作为这个新功能的一部分,Windows Azure发布了一个新版本的Windows Azure管理门户,这个门户在原有的基础上增加 ...
- Windows 10如何禁用Microsoft Edge标签页预览
Microsoft Edge 一直在不断追赶同业竞争者,并在 Windows 10 周年更新中对 Microsoft Edge 进行了全面更新.如果你一直在 Windows 10 中将 Microso ...
- C# 获取并判断操作系统版本,解决Win10、 Windows Server 2012 R2 读取失败的方案
Windows 8.1, Win10之后,通过GetVersion and GetVersionEx 方法获取WIndows操作系统版本号的功能需要添加manifest文件后才能查找到,不然的话会查找 ...
- Windows Server 2016与旧版本系统比较
一.性能和可扩性 特征描述 Windows Server 2012/2012 R2 标准版和数据中心 Windows Server 2016 标准版和数据中心 物理内存(主机)支持 每个物理服务器至多 ...
- ISV客户博客系列:iVoteSports通过Windows Azure扩展它的面向棒球的移动游戏应用程序...
编者按:今天的文章,由Bill Davidheiser,iVoteSports首席设计师和创始人所写.描述了公司如何使用Windows Azure来优化它的iVoteSports MLB-focuse ...
- 淘汰Hyper-V replication 拥抱Storage Replica
基于过去的经验,在小型环境中保护Hyper-V 虚拟机的最佳方式之一一直是复制.Windows Server 2012首次引入了复制,在第二台Hyper-V服务器上创建了一个同步的虚拟机副本.如果主虚 ...
最新文章
- C++11之右值引用(三):使用C++11编写string类以及“异常安全”的=运算符
- word操作快捷键记录
- hdu 5639(区间dp)
- NYOJ 662 汽水瓶
- esp8266 接收udp广播_ESP8266_21基于ESP8266的一键配网
- 使用SDL打造游戏世界之入门篇 - 5
- solr后台登录验证
- 相对路径 ‘’,‘/’,‘./‘,‘../‘
- python数据分析与excel_读Python数据分析基础之Excel读写与处理
- 黑客发现瑞士电子选举系统中的多个漏洞并获奖2.7万美元
- [转载] python怎么获取redis中的数据_python操作redis数据库
- 判断一个数是偶数还是素数 做相应处理并排序输出
- 2022-01-11每日刷题打卡
- Java实现复杂邮件发送(支持附件、支持多收件人、多抄送人、多密送人)
- 电子文档秒变手写文字:这个工具绝了!!
- JS基础知识大总结史上最全(已完结~)
- WebLogic的安装步骤及部署
- 平面束方程少一个面的原因
- 移动硬盘安装Linux后无引导,移动固态硬盘安装Ubuntu启动盘后按F12根本就没有该系统启动项...
- 休假管理系统的问题描述与词汇表
热门文章
- android sqlite使用之模糊查询数据库数据的三种方式
- 仿OUTLOOK2007 多样化摺叠菜单
- python 函数中的面试题
- qt界面嵌入web_使用Qt WebAssembly而不是JavaScript创建Web用户界面
- linux是什么样的_您的Linux设置是什么样的?
- 后台模板 开源_3个开源样板网页设计模板
- opensource项目_最佳Opensource.com:法律
- Docker和容器如何改善eZ的软件开发
- symfony框架_为什么我们放弃传统的Symfony框架
- LeetCode 396. 旋转函数(Rotate Function)