Windows phone开发IsolatedStorageSettings 操作类
来源:互联网 发布:淘宝评价语 编辑:程序博客网 时间:2024/06/13 03:33
娜娜一直说我写博客没有文字描述,不过我觉得直接上代码才干脆
wp的兄弟们,IsolatedStorageSettings 操作类奉上。
using System;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Ink;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;using System.IO.IsolatedStorage;namespace MicroBlogForWP7.Classes.Util{ public class Isolated { static readonly IsolatedStorageSettings Setting = IsolatedStorageSettings.ApplicationSettings; #region 方法 /// <summary> /// 获取对应的属性值 /// </summary> /// <param name="flag"></param> /// <returns></returns> public static object Get(string flag) { try { if (Setting.Contains(flag)) { return Setting[flag]; } else { Setting.Add(flag, null); } return null; } catch { Setting.Add(flag, null); return null; } } /// <summary> /// 获取对应的属性值 /// </summary> /// <param name="flag"></param> /// <returns></returns> public static bool Get<T>(string flag,out T val) { try { if (Setting.Contains(flag)) { return Setting.TryGetValue<T>(flag, out val); } else { Setting.Add(flag, null); } val = default(T); return false; } catch { Setting.Add(flag, null); val = default(T); return false; } } /// <summary> /// 设置属性值 /// </summary> /// <param name="flag"></param> /// <param name="val"></param> public static void Set(string flag, object val) { try { if (Setting.Contains(flag)) { Setting[flag] = val; } else { Setting.Add(flag, val); } } catch { } } /// <summary> /// 移除属性值 /// </summary> /// <param name="flag"></param> public static bool Remove(string flag) { try { return Setting.Remove(flag); } catch { return false; } } #endregion }}
- Windows phone开发IsolatedStorageSettings 操作类
- Windows Phone 独立存储之IsolatedStorageSettings
- Windows Phone 7的本地存储——IsolatedStorageSettings
- Windows Phone的本地存储——IsolatedStorageSettings
- [windows phone开发]文件操作
- Windows Phone开发之Coding4Fun对话框操作类
- Windows Phone开发之发送邮件操作类
- wp8开发--IsolatedStorageSettings存储数据和IsolatedStorageFileHelper类
- Windows phone 7中,把页面数据存为长期存储(非IsolatedStorageFile),而是用IsolatedStorageSettings
- Windows Phone文件操作
- Windows Phone 图片操作
- [Windows Phone] Windows Phone开发环境搭建
- Windows Phone 开发
- Windows Phone 开发基本概念
- Windows Phone 开发环境
- Windows Phone 开发
- windows phone开发搭建
- Windows Phone开发概述
- 如果失败,则自动重复执行repo sync
- stagefright + omx小结
- logical_reads
- strcpy,strcat, strcmp, atoi, itoa函数原型实现
- 如何设置LINUX的共享内存
- Windows phone开发IsolatedStorageSettings 操作类
- Perform Input Validation in WCF
- DWR Reverse Ajax服务器推技术
- 在写blog时的感想
- 中文API介绍 ASI OPENGLES 以及 demo
- 论坛数据库的设计
- 《性能测试诊断分析与优化》目录
- Maven单元测试
- PB 程序中动态变更窗口菜单