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. 03 Files

    本章提要-----------------------------------------------组成 oracle 的 8 种主要文件(包括 instance 和 database)instan ...

  2. msyql 笔记

    mysql复习 一:复习前的准备 1:确认你已安装wamp 2:确认你已安装ecshop,并且ecshop的数据库名为shop 二 基础知识: 1.数据库的连接 mysql -u -p -h -u 用 ...

  3. OSX下git diff/merge 可视化工具 P4Merge 环境配置步骤

    先下载 step1:首先,把要运行的命令放入外部包装脚本中,创建一个merge包装脚本,名字叫做extMerge,让它带参数调用P4Merge. $ cat >> /usr/local/b ...

  4. spring复习 -day1:Spring简介 、 Spring容器 、 Spring IOC

    Spring创建对象方法   创建对象过程: 第一步:添加SpringIOC环境 (1)在WebRoot/WEB-INT/lib文件夹下,引入SpringIOC配置环境的jar包 如图: (2)在sr ...

  5. linux -- gedit快捷键

    Shortcuts for tabs:Ctrl + Alt + PageDown     Switches to the next tab to the left.Ctrl + Alt + PageD ...

  6. linux -- 终端执行可执行文件

    有一个可执行文件:/media/home/1.sh 1.首先,得有权限 (1)如果已经是root用户(#),则不用做什么 (2)如果不是 $ sudo su pass your password:(这 ...

  7. erlang -- ios apns provider -- erlang 实现

    os apns-apple notification server 与第三方provider的通信原理网上已有很多介绍,这里不再介绍,有想了解的大家可以去IOS官网https://developer. ...

  8. windows 下安装perl Tk 模块

    首先,安装activeperl ,安装过程中勾选自动添加PATH环境变量,这样安装后就不需要自己手动修改PATH环境变量: 通过cmd 调出命令行窗口,输入ppm ,然后回车,就开启了perl 的包管 ...

  9. Spring-Condition设置

    为了满足不同条件下生成更为合适的bean,可以使用condition配置其条件.假如有一个bean,id为magicBean,只有当其具有magic属性时才生成,方法如下: javaConfig模式: ...

  10. Sprite和UI Image的区别

    Unity3D最初是一个3D游戏引擎,而从4.3开始,系统加入了Sprite组件,Unity也终于有了2D游戏开发的官方解决方案.4.6更是增加了新的UI系统uGUI,使得使用Unity开发2D游戏效 ...