Benutzer mit den meisten Antworten
[C#] Fehler | Könnt ihr mir helfen

Frage
-
Hallo,
Mein C# Code:
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 Microsoft.Phone.Controls; using Microsoft.Phone.Tasks; using System.IO; using System.IO.IsolatedStorage; namespace eslesbrueckenapp { public partial class emailsendformular : PhoneApplicationPage { public emailsendformular() { InitializeComponent(); //Thema IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream filestream = file.OpenFile("listbox.txt", FileMode.Open); StreamReader sr = new StreamReader(filestream); textBox3.Text = sr.ReadLine(); filestream.Close(); //Support oder Verbesserungen /** IsolatedStorageFile fileemail = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream filestreamemail = file.OpenFile("listboxemail.txt", FileMode.Open); StreamReader sremail = new StreamReader(filestream); textBox5.Text = sremail.ReadLine(); filestream.Close();**/ } private void button1_Click(object sender, RoutedEventArgs e) { string thema; string wort; string beschreibung; string autor; thema = textBox3.Text; wort = textBox2.Text; beschreibung = textBox1.Text; autor = textBox4.Text; if (textBox5.Text == "Support") { EmailComposeTask emailComposeTask = new EmailComposeTask(); emailComposeTask.Subject = "Support"; emailComposeTask.Body = beschreibung + " - " + autor; emailComposeTask.To = "adl-solutions@live.de"; emailComposeTask.Show(); } if (textBox5.Text == "Verbesserung") { EmailComposeTask emailComposeTask = new EmailComposeTask(); emailComposeTask.Subject = thema + " - " + wort; emailComposeTask.Body = beschreibung + " - " + autor; emailComposeTask.To = "adl-solutions@live.de"; emailComposeTask.Show(); } } /**private void radioButton1_Checked(object sender, RoutedEventArgs e) { if (radioButton1.IsChecked == true) { textBlock1.Text = ""; textBlock2.Text = ""; textBlock3.Text = ""; textBlock4.Text = "Ihre Nachricht"; this.textBox2.Visibility = Visibility.Collapsed; this.textBox3.Visibility = Visibility.Collapsed; } } private void radioButton2_Checked(object sender, RoutedEventArgs e) { if (radioButton2.IsChecked == true) { textBlock1.Text = "Thema:"; textBlock2.Text = "(Latein, Englisch usw.)"; textBlock3.Text = "Wort:"; textBlock4.Text = "Verbesserungs Wünsche:"; this.textBox2.Visibility = Visibility.Visible; this.textBox3.Visibility = Visibility.Visible; } }**/ private void textBox3_TextChanged(object sender, TextChangedEventArgs e) { } private void button2_Click(object sender, RoutedEventArgs e) { NavigationService.Navigate(new Uri("/listbox.xaml", UriKind.Relative)); } private void button3_Click(object sender, RoutedEventArgs e) { NavigationService.Navigate(new Uri("/listboxemail.xaml", UriKind.Relative)); } } }
Mein XAML Code:
<phone:PhoneApplicationPage x:Class="eslesbrueckenapp.emailsendformular" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480" shell:SystemTray.IsVisible="True" HorizontalAlignment="Stretch"> <!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden--> <Grid x:Name="LayoutRoot" Background="#0000FF00"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!--TitlePanel enthält den Namen der Anwendung und den Seitentitel--> <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> <TextBlock x:Name="ApplicationTitle" Text="E-mail" Style="{StaticResource PhoneTextNormalStyle}"/> <TextBlock x:Name="PageTitle" Text="E-mail Formular" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontSize="64" /> </StackPanel> <!--ContentPanel - zusätzliche Inhalte hier platzieren--> <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="446*" /> <ColumnDefinition Width="10*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="502*" /> <RowDefinition Height="43*" /> <RowDefinition Height="72*" /> </Grid.RowDefinitions> <Button Content="Fertig" Height="72" HorizontalAlignment="Left" Margin="299,0,0,0" Name="button1" VerticalAlignment="Top" Width="160" Grid.Row="2" Click="button1_Click" Grid.ColumnSpan="2" /> <TextBlock Height="46" HorizontalAlignment="Left" Margin="12,1,0,0" Name="textBlock1" Text="Thema:" VerticalAlignment="Top" Foreground="#FF00BE38" FontSize="26" Width="94" /> <TextBlock Height="30" HorizontalAlignment="Left" Margin="120,7,0,0" Name="textBlock2" Text="(Latein, Englisch usw.)" VerticalAlignment="Top" /> <TextBlock FontSize="26" Foreground="#FF00BE38" Height="46" HorizontalAlignment="Left" Margin="12,86,0,0" Name="textBlock3" Text="Wort:" VerticalAlignment="Top" Width="65" /> <TextBox Height="72" HorizontalAlignment="Left" Name="textBox2" Text="" VerticalAlignment="Top" Width="456" SelectionForeground="Black" Foreground="Black" BorderBrush="#00FFEB00" Background="LightGreen" Grid.ColumnSpan="2" DataContext="{Binding}" Visibility="Visible" Margin="0,114,0,0" SelectionBackground="Black" /> <TextBox Background="LightGreen" BorderBrush="#00FFEB00" Foreground="Black" Height="72" HorizontalAlignment="Right" Margin="0,29,-3,0" Name="textBox3" SelectionForeground="Black" Text="" VerticalAlignment="Top" Width="459" Grid.ColumnSpan="2" TextChanged="textBox3_TextChanged" SelectionBackground="Black" /> <TextBlock FontSize="26" Foreground="#FF00BE38" Height="46" HorizontalAlignment="Left" Margin="15,174,0,0" Name="textBlock4" Text="Verbesserungs Wünsche:" VerticalAlignment="Top" Width="295" /> <TextBox Background="LightGreen" BorderBrush="#00FFEB00" Foreground="Black" Height="205" HorizontalAlignment="Left" Margin="0,197,0,0" Name="textBox1" SelectionForeground="#0009AD2F" Text="" VerticalAlignment="Top" Width="459" TextWrapping="Wrap" AcceptsReturn="False" SelectionBackground="#001BA1E2" Grid.ColumnSpan="2" /> <TextBlock FontSize="26" Foreground="#FF00BE38" Height="46" HorizontalAlignment="Left" Margin="12,389,0,0" Name="textBlock5" Text="Autor:" VerticalAlignment="Top" Width="79" /> <TextBlock Height="54" HorizontalAlignment="Left" Margin="97,395,0,0" Name="textBlock6" Text="(Deinen Namen wird als Auto genommen)" VerticalAlignment="Top" TextWrapping="Wrap" Width="189" /> <TextBox Background="LightGreen" BorderBrush="#00FFEB00" Foreground="Black" Grid.ColumnSpan="2" Height="72" HorizontalAlignment="Right" Margin="0,440,-3,0" Name="textBox4" SelectionForeground="#FF09AD2F" Text="" VerticalAlignment="Top" Width="459" Grid.RowSpan="2" /> <Button Height="51" HorizontalAlignment="Left" Margin="12,39,0,0" Name="button2" VerticalAlignment="Top" Width="434" Foreground="Transparent" BorderBrush="Transparent" Click="button2_Click" /> <TextBlock FontSize="26" Foreground="#FF00BE38" Height="46" HorizontalAlignment="Left" Margin="12,499,0,0" Name="textBlock7" Text="Sende Art:" VerticalAlignment="Top" Width="122" Grid.RowSpan="2" /> <TextBlock Height="54" HorizontalAlignment="Left" Margin="140,3,0,0" Name="textBlock8" Text="(Support oder Verbesserungen)" TextWrapping="Wrap" VerticalAlignment="Top" Width="283" Grid.Row="1" Grid.RowSpan="2" /> <TextBox Grid.Row="2" Height="72" HorizontalAlignment="Left" Margin="6,0,0,0" Name="textBox5" Text="" VerticalAlignment="Top" Width="304" SelectionBackground="#001BA1E2" Background="LightGreen" SelectionForeground="Transparent" /> <Button Grid.Row="2" Height="74" HorizontalAlignment="Left" Name="button3" VerticalAlignment="Top" Width="312" BorderBrush="Transparent" Click="button3_Click" /> </Grid> </Grid> <!--Beispielcode zur Verwendung von ApplicationBar--> <!--<phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True"> <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Schaltfläche 1"/> <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Schaltfläche 2"/> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem Text="Menüelement 1"/> <shell:ApplicationBarMenuItem Text="Menüelement 2"/> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> </phone:PhoneApplicationPage.ApplicationBar>--> </phone:PhoneApplicationPage>
Das Problem liegt in der ersten paar Zeilen.
Ich habe eine 2 Page gemacht wo eine ListBox is. Von dieser Seite wird eine ListBoxItem ausgewählt und auf der vorherigen Seite in eine TextBox rein geschrieben.
Das Problem (glaube ich) liegt darin das wenn die Seite geöffnet wird und abstürzt. Sucht das Programm nach den Werten die ich von der 2'ten Seite erst später übergeben würde. Also wird das App geschlossen.
Falls ihr eine Idee habt wie ich dieses Problem umgehen, antwortet bitte.
Mein erstes eigenes App. http://www.windowsphone.com/de-de/store/app/grad-umrechner/59165d3f-6219-4bda-84c5-e55a166f5f3d
Antworten
-
Hi,
wenn man nach der Fehlermeldung googlet, kommt man in den meisten Fällen darauf, dass anscheinend versucht wird, die Datei zweimal zu öffnen oder die Datei gar nicht erst existiert.
Falls das nicht hilft, schau dich bitte noch hier
https://www.google.de/#q=Operation+not+permitted+on+IsolatedStorageFileStream
um, ggfs. bringt dir das die Lösung. Ansonsten meld dich nochmal hier.
Gruß, Stefan
Microsoft MVP - Visual Developer ASP/ASP.NET
http://www.asp-solutions.de/ - Consulting, Development
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community- Als Antwort markiert ADL Solutions Donnerstag, 23. Mai 2013 13:02
Alle Antworten
-
Hi,
poste doch bitte mal die genaue Fehlerbeschreibung inkl. der exakten und vollständigen Fehlermeldung.
Zudem solltest Du deinen Code debuggen (Schritt für Schritt durchgehen) und uns dann sagen, an welcher Zeile genau der Fehlerf auftritt.
Gruß, Stefan
Microsoft MVP - Visual Developer ASP/ASP.NET
http://www.asp-solutions.de/ - Consulting, Development
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community -
Hallo nochmal,
IsolatedStorageFileStream filestream = file.OpenFile("listbox.txt", FileMode.Open);
In dieser Code Zeile bliebt das App hängen.
Fehler:
Operation not permitted on IsolatedStorageFileStream.
Und Wenn ich Online Suche mache wird mir dies gegeben.
System.IO.IsolatedStorage.IsolatedStorageException
Ich hoffe das Reicht alles.
Mein erstes eigenes App. http://www.windowsphone.com/de-de/store/app/grad-umrechner/59165d3f-6219-4bda-84c5-e55a166f5f3d
-
Hi,
wenn man nach der Fehlermeldung googlet, kommt man in den meisten Fällen darauf, dass anscheinend versucht wird, die Datei zweimal zu öffnen oder die Datei gar nicht erst existiert.
Falls das nicht hilft, schau dich bitte noch hier
https://www.google.de/#q=Operation+not+permitted+on+IsolatedStorageFileStream
um, ggfs. bringt dir das die Lösung. Ansonsten meld dich nochmal hier.
Gruß, Stefan
Microsoft MVP - Visual Developer ASP/ASP.NET
http://www.asp-solutions.de/ - Consulting, Development
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community- Als Antwort markiert ADL Solutions Donnerstag, 23. Mai 2013 13:02