Nextrek
Diff Revisions
38
vs
39
for /WindowsPhone/NotizieTL/NotizieTL/App.xaml.cs
|
@@ -12,6 +12,7 @@ |
12 |
12 |
|
using System.Windows.Shapes; |
13 |
13 |
|
using Microsoft.Phone.Controls; |
14 |
14 |
|
using Microsoft.Phone.Shell; |
|
15 |
+ |
using System.IO.IsolatedStorage; |
15 |
16 |
|
|
16 |
17 |
|
namespace NotizieTL |
17 |
18 |
|
{ |
|
@@ -80,12 +81,15 @@ |
80 |
81 |
|
// This code will not execute when the application is reactivated |
81 |
82 |
|
private void Application_Launching(object sender, LaunchingEventArgs e) |
82 |
83 |
|
{ |
|
84 |
+ |
//loadState(); |
83 |
85 |
|
} |
84 |
86 |
|
|
85 |
87 |
|
// Code to execute when the application is activated (brought to foreground) |
86 |
88 |
|
// This code will not execute when the application is first launched |
87 |
89 |
|
private void Application_Activated(object sender, ActivatedEventArgs e) |
88 |
90 |
|
{ |
|
91 |
+ |
//loadState(); |
|
92 |
+ |
|
89 |
93 |
|
// Ensure that application state is restored appropriately |
90 |
94 |
|
if (!App.ViewModel.IsDataLoaded) |
91 |
95 |
|
{ |
|
@@ -97,6 +101,7 @@ |
97 |
101 |
|
// This code will not execute when the application is closing |
98 |
102 |
|
private void Application_Deactivated(object sender, DeactivatedEventArgs e) |
99 |
103 |
|
{ |
|
104 |
+ |
saveState(); |
100 |
105 |
|
} |
101 |
106 |
|
|
102 |
107 |
|
// Code to execute when the application is closing (eg, user hit Back) |
|
@@ -104,6 +109,7 @@ |
104 |
109 |
|
private void Application_Closing(object sender, ClosingEventArgs e) |
105 |
110 |
|
{ |
106 |
111 |
|
// Ensure that required application state is persisted here. |
|
112 |
+ |
saveState(); |
107 |
113 |
|
} |
108 |
114 |
|
|
109 |
115 |
|
// Code to execute if a navigation fails |
|
@@ -161,5 +167,37 @@ |
161 |
167 |
|
} |
162 |
168 |
|
|
163 |
169 |
|
#endregion |
|
170 |
+ |
|
|
171 |
+ |
private void saveState() |
|
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; |
|
181 |
+ |
|
|
182 |
+ |
} |
|
183 |
+ |
|
|
184 |
+ |
private void loadState() |
|
185 |
+ |
{ |
|
186 |
+ |
//PhoneApplicationService phoneAppService = PhoneApplicationService.Current; |
|
187 |
+ |
//IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; |
|
188 |
+ |
|
|
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; |
|
196 |
+ |
|
|
197 |
+ |
//} |
|
198 |
+ |
|
|
199 |
+ |
|
|
200 |
+ |
} |
|
201 |
+ |
|
164 |
202 |
|
} |
165 |
203 |
|
} |