private const string foldername = "temp1";
private const string filename = foldername + "/address.txt";
private const string settingname = "sname";

1.创建文件夹

private void button1_Click(object sender, RoutedEventArgs e)
{
using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
{
file.CreateDirectory(foldername);
}
}

2.检查文件夹是否存在

private void button2_Click(object sender, RoutedEventArgs e)
{
using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
{
if (file.DirectoryExists(foldername))
{
MessageBox.Show("已存在");
}
else
{
MessageBox.Show("不存在");
}
}
}

3.删除目录

 private void button3_Click(object sender, RoutedEventArgs e)
{
using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
{
file.DeleteDirectory(foldername);
}
}

4.创建文件

private void button4_Click(object sender, RoutedEventArgs e)
{
using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
{
IsolatedStorageFileStream stream = file.CreateFile(filename);
stream.Close();
}
}

5.检查文件是否存在

private void button5_Click(object sender, RoutedEventArgs e)
{
using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
{
if (file.FileExists(filename))
{
MessageBox.Show("已存在" + filename);
}
else
{
MessageBox.Show("不存在");
}
}
}

6.删除文件

private void button6_Click(object sender, RoutedEventArgs e)
{
using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
{
file.DeleteFile(filename);
}
}

7.向文件中增加内容

private void button7_Click(object sender, RoutedEventArgs e)
{
using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream stream = file.OpenFile(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
StreamWriter writer = new StreamWriter(stream);
writer.WriteLine(textBox1.Text);
writer.Close();
textBox1.Text = "";
}
}
}

8.读取文件内容

private void button8_Click(object sender, RoutedEventArgs e)
{
using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream stream = file.OpenFile(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
using (StreamReader reader=new StreamReader (stream))
{
textBox1.Text = reader.ReadToEnd();
}
} }
}

9、程序配置信息保存

private void button9_Click(object sender, RoutedEventArgs e)
{
IsolatedStorageSettings.ApplicationSettings[settingname] = textBox2.Text;
IsolatedStorageSettings.ApplicationSettings.Save();
textBox2.Text = "";
}

10.程序配置信息读取

private void button10_Click(object sender, RoutedEventArgs e)
{
if (IsolatedStorageSettings.ApplicationSettings.Contains(settingname))
{
textBox2.Text = IsolatedStorageSettings.ApplicationSettings[settingname].ToString();
}
}

Windows Phone 有关独立存储(一)的更多相关文章

  1. Windows phone 之独立存储

    独立存储命名空间的说明:

  2. 与众不同 windows phone (6) - Isolated Storage(独立存储)

    原文:与众不同 windows phone (6) - Isolated Storage(独立存储) [索引页][源码下载] 与众不同 windows phone (6) - Isolated Sto ...

  3. Windows Phone 独立存储资源管理器工具

    如何使用独立存储资源管理器工具 http://msdn.microsoft.com/zh-CN/library/hh286408(v=vs.92)C:\Program Files (x86)\Micr ...

  4. Windows Phone 独立存储查看器

    1.为了查看我们存放在独立存储的数据,我们需要借助独立存储查看器. 2.简单介绍下,IsoStoreSpy 下载地址:http://download.csdn.net/download/lhb1097 ...

  5. win10的独立存储

    win10的独立存储和win8的大致相同 Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.Appl ...

  6. Silverlight-管理独立存储(Isolated Storage)

    Silverlight中的独立存储是其内部的可信任的可访问文件空间,在这里你可以使用Silverlight 随意的创建.读取.写入.删除目录和文件,它有一些类似于Cookie,但是它可以在客户端保存大 ...

  7. WP8 独立存储 总结3(应用设置)

    •可在独立存储中使用ApplicationSettings对象•在独立存储中存储键/值对的Dictionary方式存储 •存储的对象将永久保存 在应用设置中保存数据 void saveString(s ...

  8. WP_从独立存储区读取缓存的图片

      ///<summary> /// 独立存储缓存的图片源 /// 用法:item.img = new StorageCachedImage(newUri(http://www.baidu ...

  9. Silverlight 独立存储(IsolatedStorageFile)

    1.在Web中添加天气服务引用地址 http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl 2.在Web中添加Wcf服务接口I ...

随机推荐

  1. java-上传文件与现实上传文件

    项目结构: 项目展示: 数据库: /* SQLyog Ultimate v12.09 (64 bit) MySQL - 5.5.53 : Database - fileupload ********* ...

  2. 网络配置br0 brtcl

    1.brctl addbr br0        如果根据第3步,那这里不用写 2.brctl addif br0 eth0    如果第3步写了,这里也不用 这时候用ssh应该会断网... 3.设置 ...

  3. PHPstorm8 自动换行设置方法

    PHPstorm是一款非常不错的PHP开发工具,有很多需要自己设置.比如,IDE常见的代码自动换行功能需要我们自己去配置才能实现. File -> Settings ->  Editor ...

  4. smo算法matlab实现

    看完CSDN上结构之法,算法之道的支持向量机通俗导论(理解SVM的三层境界) http://blog.csdn.net/v_july_v/article/details/7624837     参考了 ...

  5. Javascript中最常用的61个经典技巧[转]

    1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键<table border oncontextmenu= ...

  6. Qt 反射

    简介 本文主要讲解Qt是如何实现反射,以及一点点反射使用的小心得. 文章概览 Qt反射内幕小窥 详细内容 反射前期准备 得到注册的类成员变量 得到注册的类成员函数 访问类成员属性(get,set) 调 ...

  7. zebra/quagga

    参考:http://blog.chinaunix.net/uid-25513153-id-212328.html 一.zebra安装 .编译安装 vim ./lib/zebra.h + 增加: #if ...

  8. linux下常用FTP命令 1. 连接ftp服务器

    1. 连接ftp服务器 格式:ftp [hostname| ip-address] a)在linux命令行下输入: ftp 192.168.1.1 b)服务器询问你用户名和密码,分别输入用户名和相应密 ...

  9. asp.net mvc webconfig配置文件操作

    读取web.config数据,可以不用编译.如发布后,非常有用web.config文件<configuration> <appSettings> <add key=&qu ...

  10. 如何使用matlab中的胞元数组

    胞元数组(cell Arry)的基本组分是胞元(cell),每个胞元本身在数组中是平等的,只能以下标区分.胞元可以存放任何类型.任何大小的数组,如任意维数值数组.字符串数组.符号对象等,而且同一个胞元 ...