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 ...
随机推荐
- [xampp] phpmyadmin 设置登录密码
$ cd /opt/lampp/bin $ ./mysqladmin -u root password 'new_password' $ vim ../phpmyadmin/config.inc.ph ...
- 洛谷——P1655 小朋友的球
P1655 小朋友的球 题目描述 @发源于 小朋友最近特别喜欢球.有一天他脑子抽了,从口袋里拿出了N个不同的球,想把它们放到M个相同的盒子里,并且要求每个盒子中至少要有一个球,他好奇有几种放法,于是尝 ...
- Coloring Dominoes
问题 E: Coloring Dominoes 时间限制: 1 Sec 内存限制: 128 MB提交: 279 解决: 95[提交] [状态] [讨论版] [命题人:] 题目描述 We have ...
- vc ini配置文件读写
ini文件(即Initialization file),这种类型的文件中通常存放的是一个程序的初始化信息.ini文件由若干个节(Section)组成,每个Section由若干键(Key)组成,每个Ke ...
- [USACO Special 2007 Chinese Competition]The Bovine Accordion and Banjo Orchestra
[原题描述以及提交地址]:http://acm.tongji.edu.cn/problem?pid=10011 [题目大意] 给定两个长度为N的序列,要给这两个序列的数连线.连线只能在两个序列之间进行 ...
- Ze_Min Tree 主席树
前言 主席树,也叫可持久化线段树,所以他的本质是颗线段树,而可持久化指的是这颗线段树可以访问过去某个时刻线段树上的信息. 应用 应用的比较多的是查询区间的第k大值(因为其他的数据结构不好做). 实现 ...
- [CF986E]Prince's Problem
题意:给一棵带点权$w_i$的树,多次询问$(u,v,x)$,求出$\prod\limits_{i\in\text{path}(u,v)}(w_i,x)$ 因为是乘法,所以可以把路径询问拆成到根询问, ...
- 【AC自动机】【状压dp】hdu2825 Wireless Password
f(i,j,S)表示当前字符串总长度为i,dp到AC自动机第j个结点,单词集合为S时的方案数. 要注意有点卡常数,注意代码里的注释. #include<cstdio> #include&l ...
- 【并查集】【set】AtCoder - 2159 - 連結 / Connectivity
Problem Statement There are N cities. There are also K roads and L railways, extending between the c ...
- Java高级架构师(一)第10节:Spring+Mybatis实现DAO
maven配置memcached.jar 由于目前java memcached client没有官方的maven repository可供使用,因此使用时需要手动将其安装到本地repository. ...