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 ...
随机推荐
- socket 上传文件代码
server.py #!/usr/bin/env python# -*- coding:utf-8 -*- import socketimport os,hashlib ip_port = ('127 ...
- 训练指南 UVA - 11090(最短路BellmanFord+ 二分判负环)
layout: post title: 训练指南 UVA - 11090(最短路BellmanFord+ 二分判负环) author: "luowentaoaa" catalog: ...
- 二维偏序+树状数组【P3431】[POI2005]AUT-The Bus
Description Byte City 的街道形成了一个标准的棋盘网络 – 他们要么是北南走向要么就是西东走向. 北南走向的路口从 1 到 n编号, 西东走向的路从1 到 m编号. 每个路口用两个 ...
- ASP.NET Core 2.2 基础知识(六) 配置(内含MySql+EF)
先上一段代码,了解一下 .NET Core 配置数据的结构. 新建一个 控制台项目,添加一个文件 json.json ,文件内容如下: { "country": "cn& ...
- 带WHERE子句的DELETE语句
由于前面我们执行“DELETE FROM T_Person”语句将数据表T_Person中的数据全部 删除了,为了演示带WHERE 子句的DELETE 语句,我们需要重新插入一些数据到T_Person ...
- POJ 3608 Bridge Across Islands (旋转卡壳)
[题目链接] http://poj.org/problem?id=3608 [题目大意] 求出两个凸包之间的最短距离 [题解] 我们先找到一个凸包的上顶点和一个凸包的下定点,以这两个点为起点向下一个点 ...
- [POI2014]Hotel
题目大意: 给你一颗$n(n\le5000)$个点的树,选3个点使得它们两两距离相等,问共有几种选法. 思路: 首先我们不难发现一个性质:对于每3个符合条件的点,我们总能找到一个点使得这个点到那3个点 ...
- 输入输出流和String的混合使用-替换信息
---恢复内容开始--- package demo; import java.io.BufferedReader; import java.io.BufferedWriter; import java ...
- mac Nginx + FastCgi + Spawn-fcgi + c++
1.安装要用到的库 brew install lighttpd brew install nginx brew install Spawn-fcgi //----------------------- ...
- python之装饰器、生成器、内置函数、JSON
一.装饰器: 装饰器,器在这里的意思是函数,也就是装饰函数.作用是给其他函数添加新功能,它可以不改变原有的函数,原来的函数和原来一模一样,什么都不需要改变,只需要在函数外部加上调用哪个装饰器就可以了, ...