WP8数据存储--独立存储设置
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions> <!--TitlePanel 包含应用程序的名称和页标题-->
<StackPanel Grid.Row="" Margin="12,17,0,28">
<TextBlock Text="我的应用程序" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="页面名称" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel> <!--ContentPanel - 在此处放置其他内容-->
<Grid x:Name="ContentPanel" Grid.Row="" Margin="24,10,0,-10">
<TextBlock Margin="19,46,345,522" Style="{StaticResource PhoneTextTitle1Style}" FontSize="" Text="Key"/>
<TextBlock Margin="19,112,345,456" Style="{StaticResource PhoneTextTitle1Style}" FontSize="" Text="Value"/>
<TextBox x:Name="text_Key" HorizontalAlignment="Left" Height="" Margin="116,38,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="" FontSize=""/>
<TextBox x:Name="text_Value" HorizontalAlignment="Left" Height="" Margin="116,101,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="" FontSize=""/>
<Button x:Name="btn_Save" Content="保存" HorizontalAlignment="Left" Height="" Margin="19,200,0,0" VerticalAlignment="Top" Width=""/>
<Button x:Name="btn_Delete" Content="删除" HorizontalAlignment="Left" Height="" Margin="146,200,0,0" VerticalAlignment="Top" Width=""/>
<Button x:Name="deleteall" Content="清空所有" HorizontalAlignment="Left" Height="" Margin="289,200,0,0" VerticalAlignment="Top" Width=""/>
<ListBox x:Name="lstKeys" Margin="31,267,35,69"/>
</Grid>
</Grid>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.IO.IsolatedStorage; namespace PhoneApp1
{
public partial class Panorama : PhoneApplicationPage
{
public IsolatedStorageSettings _Settings;
public Panorama()
{ InitializeComponent();
_Settings = IsolatedStorageSettings.ApplicationSettings;
BindkeyList();
btn_Save.Click += btn_Save_Click;
btn_Delete.Click += btn_Delete_Click;
deleteall.Click += deleteall_Click;
lstKeys.SelectionChanged += lstKeys_SelectionChanged;
} void lstKeys_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.AddedItems.Count > )
{
string key = e.AddedItems[].ToString();
if (_Settings.Contains(key))
{
text_Key.Text = key;
text_Value.Text = _Settings[key].ToString();
}
}
} void deleteall_Click(object sender, RoutedEventArgs e)
{
_Settings.Clear();
_Settings.Save();
BindkeyList();
} void btn_Delete_Click(object sender, RoutedEventArgs e)
{
if(lstKeys.SelectedIndex>-)
_Settings.Remove(lstKeys.SelectedItem.ToString());
_Settings.Save();
BindkeyList(); } private void BindkeyList()
{
lstKeys.Items.Clear();
if (_Settings!=null)
{
foreach (string key in _Settings.Keys)
{
lstKeys.Items.Add(key);
}
text_Key.Text = "";
text_Value.Text = "";
}
} void btn_Save_Click(object sender, RoutedEventArgs e)
{
if (text_Key.Text != "")
{
if (_Settings.Contains(text_Key.Text))
{
_Settings[text_Key.Text] = text_Value.Text;
}
else
{
_Settings.Add(text_Key.Text, text_Value.Text);
}
_Settings.Save();
BindkeyList();
}
else
{ MessageBox.Show("请添加key值"); }
} }
}
WP8数据存储--独立存储设置的更多相关文章
- 与众不同 windows phone (6) - Isolated Storage(独立存储)
原文:与众不同 windows phone (6) - Isolated Storage(独立存储) [索引页][源码下载] 与众不同 windows phone (6) - Isolated Sto ...
- WP8 独立存储 总结3(应用设置)
•可在独立存储中使用ApplicationSettings对象•在独立存储中存储键/值对的Dictionary方式存储 •存储的对象将永久保存 在应用设置中保存数据 void saveString(s ...
- WP8数据存储--独立存储文件
主要的三个步骤 1.调用手机的独立存储 例如:IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication( ...
- wp8数据存储--独立存储文件 【转】
出自 : http://www.cnblogs.com/MyBeN/p/3339019.html 文章篇幅有点大,建议去源网看看 1.调用手机的独立存储 例如:IsolatedStorageFile ...
- iOS开发UI篇—ios应用数据存储方式(偏好设置)
iOS开发UI篇—ios应用数据存储方式(偏好设置) 一.简单介绍 很多iOS应用都支持偏好设置,比如保存用户名.密码.字体大小等设置,iOS提供了一套标准的解决方案来为应用加入偏好设置功能 每个应用 ...
- kafka传数据到Flink存储到mysql之Flink使用SQL语句聚合数据流(设置时间窗口,EventTime)
网上没什么资料,就分享下:) 简单模式:kafka传数据到Flink存储到mysql 可以参考网站: 利用Flink stream从kafka中写数据到mysql maven依赖情况: <pro ...
- 【WP8】自定义配置存储类
之前在WP7升级到WP8的时候遇到配置不兼容的问题 情景:之前只有一个WP7版本,现在需要发布WP8版本,让用户可以从原来的WP7版本升级到WP8版本 一般情况下从WP7升级到WP8没什么问题 但是在 ...
- Silverlight-管理独立存储(Isolated Storage)
Silverlight中的独立存储是其内部的可信任的可访问文件空间,在这里你可以使用Silverlight 随意的创建.读取.写入.删除目录和文件,它有一些类似于Cookie,但是它可以在客户端保存大 ...
- 《浏览器工作原理与实践》 <12>栈空间和堆空间:数据是如何存储的?
对于前端开发者来说,JavaScript 的内存机制是一个不被经常提及的概念 ,因此很容易被忽视.特别是一些非计算机专业的同学,对内存机制可能没有非常清晰的认识,甚至有些同学根本就不知道 JavaSc ...
随机推荐
- Asp.Net MVC在过滤器中使用模型绑定
废话不多话,直接上代码 1.创建MVC项目,新建一个过滤器类以及使用到的实体类: public class DemoFiltersAttribute : AuthorizeAttribute { pu ...
- React Native - 1 Windows下的环境配置(Windows+Android)
参考:https://facebook.github.io/react-native/docs/getting-started.html(要FQ) 网站上建议使用Chocolatey去配环境, ...
- 简单的curl抓取数据
工欲善其事,必先利其器,数据抓取同样也是如此,PHP数据抓取常用CURL. CURL是一个使用libcurl库与各类服务器进行通讯,支持很多协议,如HTTP.FTP.TELNET等. curl_ini ...
- ubuntu fcitx google 输入法打不出中括号【】
编辑/usr/share/fcitx/data/punc.mb.zh_CN, 将 [ · ] 「 」 这部分改成自己习惯的: [ [ ] ] 保存后,重启一下fcitx就OK了.
- HDU 3342 拓扑排序模板
Legal or Not Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 线段树+扫描线【p1884】[Usaco12FEB]过度种植(银)Overplanting …
Description 在一个笛卡尔平面坐标系里(则X轴向右是正方向,Y轴向上是正方向),有\(N(1<=N<=1000)\)个矩形,第i个矩形的左上角坐标是\((x1, y1)\),右下 ...
- java中的控制语句
控制语句 1.1 顺序结构 (最常见的) 特点:代码从上往下依次执行 1.2 选择结构 : if 判断语句 : switch 判断语句: Switch语句使用的注意事项: 1.每一个语句结束后需要有一 ...
- 【矩阵乘法+快速乘】BZOJ2875-[NOI2012]随机数生成器
[题目大意] 已知Xn+1=(aXn+c) mod m,求Xn mod g. [思路] get到了longlong乘法的正确方法,快速乘.什么是快速乘呢? 简单来讲,快速幂就是模拟了二进制的竖式乘法. ...
- mysql-启动、关闭与重启
启动 service mysqld start mysql.server start 停止 service mysqld stop mysql.server stop 重启 mysql.server ...
- 一个页面如何放多个百度编辑器 Ueditor 1.4.3?PHP如何获取Ueditor 的值?
问题1:一个页面如何放置多个Ueditor? 参考代码如下: <form method="post" action="save.php"> < ...