private void Button_Forget_Click(object sender, RoutedEventArgs e) { PassportDelete(); UserSelect.accountList.Remove(activeAccount); AccountsHelper.SaveAccountList(UserSelect.accountList); }
/// <summary> /// Uses the AccountsHelper to load the list of accounts from a saved local app file, /// then checks to see if it was empty or not. If it is empty then just go to the sign in form. /// </summary> private async void SetUpAccounts() { accountList = await AccountsHelper.LoadAccountList(); accountListView.ItemsSource = accountList; if (accountList.Count == 0) { this.Frame.Navigate(typeof(SignIn)); } }
private void Button_Forget_Click(object sender, RoutedEventArgs e) { if (activeAccount.UsesPassport == true) { PassportDelete(); } UserSelect.accountList.Remove(activeAccount); AccountsHelper.SaveAccountList(UserSelect.accountList); rootPage.NotifyUser("User " + activeAccount.Email + " deleted.", NotifyType.StatusMessage); button_Forget.IsEnabled = false; button_Forget.Content = "User Forgotten."; }
/// <summary> /// Gets the account list file and deserializes it from XML to a list of accounts object. /// </summary> /// <returns>List of account objects</returns> static public async Task <List <Account> > LoadAccountList() { try { StorageFile accountsFile = await ApplicationData.Current.LocalFolder.GetFileAsync(USER_LIST_FILE_NAME); string accountsXml = await Windows.Storage.FileIO.ReadTextAsync(accountsFile); return(AccountsHelper.DeserializeXmlToAccountList(accountsXml)); } catch (FileNotFoundException e) { List <Account> emptyAccountList = new List <Account>(); return(emptyAccountList); } }
/// <summary> /// Uses the AccountsHelper class to save the account list before we move on from /// the sign in process /// </summary> private void CleanUpUserList() { AccountsHelper.SaveAccountList(UserSelect.accountList); }