Subversion Repository Public Repository

Nextrek

Diff Revisions 798 vs 799 for /Android/SmartCharging/SmartCharging_WP/SmartCharging/SettingsPage.xaml.cs

Diff revisions: vs.
  @@ -1,4 +1,5 @@
1 - using SmartCharging.Common;
1 + using Facebook.Client;
2 + using SmartCharging.Common;
2 3 using SmartCharging.Net;
3 4 using System;
4 5 using System.Collections.Generic;
  @@ -76,6 +77,16 @@
76 77 /// session. The state will be null the first time a page is visited.</param>
77 78 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
78 79 {
80 +
81 + var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
82 + if (localSettings.Values["EnableBatteryCheck"] == null)
83 + {
84 + this.BatteryToastToggleSwitch.IsOn = true;
85 + }
86 + else
87 + {
88 + this.BatteryToastToggleSwitch.IsOn = (bool)localSettings.Values["EnableBatteryCheck"];
89 + }
79 90 }
80 91
81 92 /// <summary>
  @@ -121,6 +132,11 @@
121 132 {
122 133 this.showLoading();
123 134 bool result = await this.SMA.Logout();
135 + if (Session.ActiveSession != null && !String.IsNullOrEmpty(Session.ActiveSession.CurrentAccessTokenData.AccessToken) )
136 + {
137 + Session.ActiveSession.Logout();
138 +
139 + }
124 140 this.hideLoading();
125 141
126 142 if (result)
  @@ -168,6 +184,12 @@
168 184 CredentialStorage cs = new CredentialStorage();
169 185 cs.RemoveCredentials();
170 186
187 + if (Session.ActiveSession != null && !String.IsNullOrEmpty(Session.ActiveSession.CurrentAccessTokenData.AccessToken))
188 + {
189 + Session.ActiveSession.Logout();
190 +
191 + }
192 +
171 193 MessageDialog dialogbox2 = new MessageDialog(resourceLoader.GetString("UserAccountDeletedMessage"));
172 194 //OK Button
173 195 UICommand okBtn2 = new UICommand(resourceLoader.GetString("OK"));
  @@ -207,6 +229,21 @@
207 229 this.Loader.Visibility = Visibility.Collapsed;
208 230 }
209 231
232 + private void BatteryToastToggleSwitch_Tapped(object sender, TappedRoutedEventArgs e)
233 + {
234 +
235 + }
236 +
237 + private void BatteryToastToggleSwitch_Toggled(object sender, RoutedEventArgs e)
238 + {
239 + if (this.BatteryToastToggleSwitch != null && this.BatteryToastToggleSwitch.FocusState == FocusState.Pointer)
240 + {
241 + var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
242 + localSettings.Values["EnableBatteryCheck"] = this.BatteryToastToggleSwitch.IsOn;
243 + }
244 +
245 + }
246 +
210 247
211 248 }
212 249 }