Download presentation
Presentation is loading. Please wait.
Published byJulian Elliott Modified over 9 years ago
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
private void Application_Launching(object sender, LaunchingEventArgs e) { } private void Application_Activated(object sender, ActivatedEventArgs e) { } private void Application_Deactivated(object sender, DeactivatedEventArgs e) { } private void Application_Closing(object sender, ClosingEventArgs e) { }
14
private void Application_Closing(object sender, ClosingEventArgs e) { MainPage jotPadPage = (MainPage)RootFrame.Content; jotPadPage.Save(); }
15
public void Save() { saveText("jot.txt", jotTextBox.Text); }
16
16
17
private void Application_Deactivated(object sender, DeactivatedEventArgs e) { MainPage jotPadPage = (MainPage)RootFrame.Content; jotPadPage.SaveState(); }
19
private void SaveStateText (string filename, string text) { IDictionary stateStore = PhoneApplicationService.Current.State; stateStore.Remove(filename); stateStore.Add(filename,text); }
20
private bool loadStateText(string filename, out string result) { IDictionary stateStore = PhoneApplicationService.Current.State; result = ""; if (!stateStore.ContainsKey(filename)) return false; result = (string)stateStore[filename]; return true; }
21
21
22
22
23
23
24
public void Load() { string text; if (loadStateText("jot.txt", out text)) { jotTextBox.Text = text; return; } if (loadText("jot.txt", out text)) { jotTextBox.Text = text; } else { jotTextBox.Text = "Type your jottings here...."; }
25
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { Load(); }
26
26
27
27
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.