silverlight隔离存储

silverlight隔离存储,第1张

概述cs代码如下: using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.I @H_502_2@

cs代码如下:

using System;using System.Collections.Generic;using System.linq;using System.Net;using System.windows;using System.windows.Controls;using System.windows.documents;using System.windows.input;using System.windows.Media;using System.windows.Media.Animation;using System.windows.Shapes;using System.IO.IsolatedStorage;using System.IO;namespace gelicunchu{    public partial class MainPage : UserControl    {        public MainPage()        {            InitializeComponent();        }        private voID click1(object sender,RoutedEventArgs e)        {                        using(IsolatedStoragefile store=IsolatedStoragefile.GetUserStoreForApplication()){                Int64 newspace = 20971520;                 Int64 curspace=store.AvailableFreeSpace;                if(curspace<newspace){                    if(!store.IncreaseQuotaTo(newspace)){                        ChilDWindow child = new System.windows.Controls.ChilDWindow();                        child.Title = "用户不准许扩展空间";                        child.Content = "请求失败。。。。。。。";                        child.Show();                    }                }                using (StreamWriter sw = new StreamWriter(store.Openfile("a.txt",fileMode.OpenorCreate,fileAccess.Write)))                {                    sw.Writeline(textBox1.Text);                }            }        }        private voID click2(object sender,RoutedEventArgs e)        {            using (IsolatedStoragefile store = IsolatedStoragefile.GetUserStoreForApplication())            {                using (StreamReader sr = new StreamReader(store.Openfile("a.txt",fileAccess.Read)))                {                    textBlock1.Text = sr.Readline();                }            }        }    }}xaml文件:
xaml文件:

<GrID x:name="LayoutRoot" Background="White">        <button Content="写入" Height="23" Click="click1"  HorizontalAlignment="left" margin="10,10,0" name="button1" VerticalAlignment="top" WIDth="75" />        <button Content="读取" Height="23" Click="click2" HorizontalAlignment="left" margin="10,43,0" name="button2" VerticalAlignment="top" WIDth="75" />        <TextBox Height="23" HorizontalAlignment="left" margin="10,76,0" name="textBox1" VerticalAlignment="top" WIDth="120" />        <TextBlock Height="23" HorizontalAlignment="left" margin="20,105,0" name="textBlock1" Text="TextBlock" VerticalAlignment="top" />    </GrID>

@H_502_2@ 总结

以上是内存溢出为你收集整理的silverlight隔离存储全部内容,希望文章能够帮你解决silverlight隔离存储所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1022904.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-23
下一篇2022-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存