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 ...
随机推荐
- 51nod 1283 最小周长【注意开根号】
1283 最小周长 题目来源: Codility 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注 一个矩形的面积为S,已知该矩形的边长都是整数,求所有 ...
- win7 office2016 激活(2018.6.17测试可用)
坑比的一天,啥也没学,净用来折腾了office2016的安装了. 虽然有个wps可以用,但是真心的卡啊,用不惯就卸载了.虽然是卸载了,也埋了很多坑给我. 还是说office2016吧,网上到处找激活工 ...
- Exchange2010启用反垃圾邮件功能
今天邮箱服务器发现有大量发件人为空的邮件等待执行,也就是说空邮件堵塞了队列. 一般来说,空邮件就是别人发送垃圾邮件给你,你的服务上不存在这个收件人,那么系统会产生一封退信告诉你这封邮件已经被退.而ex ...
- 【转】vector用法
原博地址:http://www.cnblogs.com/wang7/archive/2012/04/27/2474138.html 在c++中,vector是一个十分有用的容器,下面对这个容器做一下总 ...
- sshkey改变后出错的解决
错误态 ssh 192.168.111.200 出现如下错误 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING ...
- 【扩展欧几里得】poj2115 C Looooops
题意大概是让你求(A+Cx) mod 2^k = B的最小非负整数解. 若(B-A) mod gcd(C,2^k) = 0,就有解,否则无解. 式子可以化成Cx + 2^k*y = B - A,可以用 ...
- 【线性筛】【筛法求素数】【素数判定】URAL - 2102 - Michael and Cryptography
暴力搞肯定不行,因此我们从小到大枚举素数,用n去试除,每次除尽,如果已经超过20,肯定是no.如果当前枚举到的素数的(20-已经找到的质因子个数)次方>剩下的n,肯定也是no.再加一个关键的优化 ...
- Xshell连接VM中Ubuntu
摘要:终端输入ifconfig获取本地虚拟机的IP地址;安装openssh-serversudoapt-getinstallopenssh-server 查看server是否启动: ps-ef|gre ...
- Exercise03_01
import javax.swing.JOptionPane; public class TheDirection { public static void main(String[] args){ ...
- Ubuntu 16.04使用rm -rf误删文件恢复方法收集
说明:不一定有效,需要不断尝试 一.lsof 文件刚刚被删除,想要恢复,先尝试lsof. lsof |grep data.file1 cp /proc/xxx/xxx/xx /dir/data.fil ...