-
March 18th, 2012, 04:41 PM
#1
IsolatedStorageException with StreamWriter in Windows Phone 7.1
private void button2_Click ( object sender, RoutedEventArgs e )
{
if(!IsolatedStorageFile.GetUserStoreForApplication().FileExists(fileName))
IsolatedStorageFile.GetUserStoreForApplication ().CreateFile ( fileName );
string lingua1 = this.textBox1.Text, lingua2 = this.textBox2.Text;
if (!new StreamReader(new IsolatedStorageFileStream(fileName, FileMode.Open, FileAccess.Read, IsolatedStorageFile.GetUserStoreForApplication())).ReadToEnd ().Contains ( lingua1 + " <-> " + lingua2 ) )
{
using ( StreamWriter streamo = new StreamWriter (IsolatedStorageFile.GetUserStoreForApplication().OpenFile(fileName, FileMode.Append)))
{
lingua1 = Char.ToUpper ( lingua1.ElementAt ( 0 ) ) + lingua1.Substring ( 1 );
lingua2 = Char.ToUpper ( lingua2.ElementAt ( 0 ) ) + lingua2.Substring ( 1 );
streamo.WriteLine ( lingua1 + " <-> " + lingua2 );
streamo.Close ();
}
MessageBox.Show ( "Sezione creata!" );
}
else MessageBox.Show ( "Sezione non creata perchè giÃ* esistente!" );
}
could you please correct this snippet? i guess IsolatedStorageException with StreamWriter in Windows Phone 7.1. i am using windows 7.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|