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 ...
随机推荐
- Codeforces 731 C.Socks-并查集+STL(vector+map)
C. Socks time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
- Codeforces 811 C. Vladik and Memorable Trip
C. Vladik and Memorable Trip time limit per test 2 seconds memory limit per test 256 megabytes inp ...
- React中super(props)和super()以及不写super()的区别
一.constructor()和super()的基本含义 constructor() -- 构造方法 这是ES6对类的默认方法,通过new命令生成对象实例自动调用的方法.并且,该方法是类中必须要有的, ...
- 树链剖分【p2568】[SDOI2011]染色
Description 给定一颗有\(n\)个节点的无根树和\(m\)个操作,操作有\(2\)类: 1.将节点\(a\)到节点\(b\)路径上所有点染成颜色\(c\) 2.询问节点\(a\)到节点\( ...
- RPD Volume 168 Issue 4 March 2016 评论1
GEANT4 calculations of neutron dose in radiation protection using a homogeneous phantom and a Chines ...
- [xsy2164]theory
又积累了一个网络流模型:最大权闭合子图,相关证明去看论文,感觉自己不是很懂证明,但现在还是先把建模记下来再说吧 枚举一个点,硬点它一定要被选中,那么以它为根,如果选了$x$就必须要选$fa_x$,这就 ...
- [CF98E]Help Shrek and Donkey
题意:A和B两个卡牌大师玩游戏,A有$n$张牌,B有$m$张牌,桌上有$1$张牌,这$n+m+1$张牌互不相同且A和B都知道这些牌里有什么牌(但他们互相不知道对方有什么牌,两个人也都不知道桌上的那张牌 ...
- Problem B: 调用函数,输出100到200之间的所有素数
#include <stdio.h> int isPrime(unsigned int n)//定义素数函数 { int i; || n == ) ; ; i * i <= n; i ...
- RequireJS 2.0初探
就在前天晚上RequireJS发布了一个大版本,直接从version1.0.8升级到了2.0.随后的几小时James Burke又迅速的将版本调整为2.0.1,当然其配套的打包压缩工具r.js也同时升 ...
- 网络流量工具iftop,ifstat
此文非原创,转自 http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858923.html 介绍 ifstat工具是个网络接口监测工具,比较简单 ...