Subversion Repository Public Repository

Nextrek

Diff Revisions 751 vs 752 for /Android/SmartCharging/SmartCharging_WP/SmartCharging/SettingsPage.xaml.cs

Diff revisions: vs.
  @@ -5,6 +5,7 @@
5 5 using System.IO;
6 6 using System.Linq;
7 7 using System.Runtime.InteropServices.WindowsRuntime;
8 + using System.Threading.Tasks;
8 9 using Windows.ApplicationModel.Resources;
9 10 using Windows.Foundation;
10 11 using Windows.Foundation.Collections;
  @@ -135,23 +136,49 @@
135 136
136 137 private async void CancelAccountButton_Tapped(object sender, TappedRoutedEventArgs e)
137 138 {
139 +
140 +
141 + MessageDialog dialogbox1 = new MessageDialog(resourceLoader.GetString("UserAccountDeletedMessageConfirm"));
142 +
143 + //OK Button
144 + UICommand okBtn = new UICommand(resourceLoader.GetString("Yes"));
145 + okBtn.Invoked = async (s) =>
146 + {
147 + await this.cancelAccount();
148 + };
149 + dialogbox1.Commands.Add(okBtn);
150 +
151 + UICommand cancelBtn = new UICommand(resourceLoader.GetString("No"));
152 + dialogbox1.Commands.Add(cancelBtn);
153 +
154 + //Show message
155 + await dialogbox1.ShowAsync();
156 +
157 +
158 +
159 + }
160 +
161 + private async Task cancelAccount(){
162 +
138 163 this.showLoading();
139 164 bool result = await this.SMA.DeleteUserAccount();
140 - this.hideLoading();
141 165
142 166 if (result)
143 167 {
144 - MessageDialog dialogbox = new MessageDialog(resourceLoader.GetString("UserAccountDeletedMessage"));
145 -
168 + CredentialStorage cs = new CredentialStorage();
169 + cs.RemoveCredentials();
146 170
171 + MessageDialog dialogbox2 = new MessageDialog(resourceLoader.GetString("UserAccountDeletedMessage"));
147 172 //OK Button
148 - UICommand okBtn = new UICommand(resourceLoader.GetString("OK"));
149 - dialogbox.Commands.Add(okBtn);
173 + UICommand okBtn2 = new UICommand(resourceLoader.GetString("OK"));
174 + dialogbox2.Commands.Add(okBtn2);
150 175
151 176 //Show message
152 - await dialogbox.ShowAsync();
177 + await dialogbox2.ShowAsync();
153 178 this.goToLoginPage();
154 179 }
180 +
181 + this.hideLoading();
155 182 }
156 183
157 184 private void goToLoginPage(){