Subversion Repository Public Repository

Nextrek

Diff Revisions 41 vs 42 for /WindowsPhone/NotizieTL/NotizieTL/App.xaml.cs

Diff revisions: vs.
  @@ -81,14 +81,14 @@
81 81 // This code will not execute when the application is reactivated
82 82 private void Application_Launching(object sender, LaunchingEventArgs e)
83 83 {
84 - //loadState();
84 + loadState();
85 85 }
86 86
87 87 // Code to execute when the application is activated (brought to foreground)
88 88 // This code will not execute when the application is first launched
89 89 private void Application_Activated(object sender, ActivatedEventArgs e)
90 90 {
91 - //loadState();
91 + loadState();
92 92
93 93 // Ensure that application state is restored appropriately
94 94 if (!App.ViewModel.IsDataLoaded)
  @@ -170,31 +170,28 @@
170 170
171 171 private void saveState()
172 172 {
173 - //PhoneApplicationService phoneAppService = PhoneApplicationService.Current;
174 - //IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
175 -
176 - ////Take whatever is in our temporary "state bag" and save it to
177 - ////the phone's permanent flash memory
178 - ////var x = phoneAppService.State["MyValue"];
179 - //settings["MyValue"] = phoneAppService.State["MyValue"];
180 - //bool b = false;
173 + PhoneApplicationService phoneAppService = PhoneApplicationService.Current;
174 + IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
181 175
176 + //Take whatever is in our temporary "state bag" and save it to
177 + //the phone's permanent flash memory
178 +
179 + settings["MyValue"] = phoneAppService.State["MyValue"];
180 +
182 181 }
183 182
184 183 private void loadState()
185 184 {
186 - //PhoneApplicationService phoneAppService = PhoneApplicationService.Current;
187 - //IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
185 + PhoneApplicationService phoneAppService = PhoneApplicationService.Current;
186 + IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
187 +
188 + object myValue;
189 + if (settings.TryGetValue<object>("MyValue", out myValue))
190 + {
188 191
189 - ////string myValue = "";
190 - //object myValue;
191 - //if (settings.TryGetValue<object>("MyValue", out myValue))
192 - //{
193 - // var z = myValue;
194 - // phoneAppService.State["MyValue"] = myValue;
195 - // bool a = true;
192 + phoneAppService.State["MyValue"] = myValue;
196 193
197 - //}
194 + }
198 195
199 196
200 197 }