/ Published in: C#
Code taken from the video in the URL.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.IO.IsolatedStorage; //'.NET Framework Developer's Guide //'Introduction to Isolated Storage //'http://msdn.microsoft.com/en-us/library/3ak841sy.aspx //'Isolation by User and Assembly. //'Isolation by User, Domain, and Assembly. //'http://msdn.microsoft.com/en-us/library/eh5d60e1.aspx //'Where depends on Operating System //'VISTA //'Roaming-enabled stores = <SYSTEMDRIVE>\Users\<user>\AppData\Roaming //'Nonroaming stores = <SYSTEMDRIVE>\Users\<user>\AppData\Local //'Pasted from <http://msdn.microsoft.com/en-us/library/3ak841sy.aspx> namespace HDI_WinForms_IsolatedStorage { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void ButtonCreateFile_Click(object sender, EventArgs e) { IsolatedStorageFile isolatedStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null); IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("TestStore.txt", FileMode.Append, FileAccess.Write, isolatedStore); { writer.WriteLine("The Data " + DateTime.Now.ToShortTimeString()); } } private void ButtonReadIsoFile_Click(object sender, EventArgs e) { IsolatedStorageFile isolatedStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null); IsolatedStorageFileStream isolatedStream = new IsolatedStorageFileStream("TestStore.txt", FileMode.Open, isolatedStore); { this.RichTextBox1.Text = reader.ReadToEnd(); } } private void ButtonSpaceAvailable_Click(object sender, EventArgs e) { IsolatedStorageFile isolatedStorage = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain, null, null); ulong spaceAvailable = isolatedStorage.MaximumSize - isolatedStorage.CurrentSize; this.LabelSpaceAvailable.Text = spaceAvailable.ToString(); } private void ButtonDeleteIsoFile_Click(object sender, EventArgs e) { IsolatedStorageFile isolatedStorage; isolatedStorage = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null); isolatedStorage.DeleteFile("TestStore.txt"); } } }
URL: http://windowsclient.net/learn/video.aspx?v=90634