private async void ResetAppButton_Tapped(object sender, TappedRoutedEventArgs e) { MessageDialog md = new MessageDialog("The data will be permanently lost. Consider creating a backup before this.\r\n\r\nNote: Doing this on 'system apps' is not safe, and might cause your phone to stop working.", "Are you sure you want to reset the state of this app?"); md.Commands.Add(new UICommand("Yes") { Id = 1 }); md.Commands.Add(new UICommand("No") { Id = 0 }); md.DefaultCommandIndex = 1; md.CancelCommandIndex = 0; var result = await md.ShowAsync(); if (((int)result.Id) == 1) { progress.Visibility = Visibility.Visible; BackupManager bm = new BackupManager(); bm.BackupProgress += Bm_BackupProgress; await bm.ResetAppData(currentApp.TheApp); bm.BackupProgress -= Bm_BackupProgress; FileOperations.RemoveFromGetContentsCache(currentApp.familyName); await currentApp.CalculateSize(); progress.Visibility = Visibility.Collapsed; progressText.Text = ""; } }
private async void listView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (listView.SelectedItem == null) { return; } if (listView.SelectionMode == ListViewSelectionMode.Single) { AppDetails.DataContext = null; AdvancedDetails.Visibility = Visibility.Collapsed; ShowAdvancedDetails.Visibility = App.hiddenMode ? Visibility.Visible : Visibility.Collapsed; AppData data = (AppData)listView.SelectedItem; AppDataExtension dataEx = App.GetAppDataEx(data); AppDetails.DataContext = dataEx; AppDetails.Visibility = Visibility.Visible; commandBar.Visibility = Visibility.Collapsed; currentApp = dataEx; List <Backup> backupsContainingThisApp = (from Backup b in BackupManager.currentBackups where b.Apps.Any(x => x.FamilyName == currentApp.familyName) select b).ToList(); noBackupsAvailable.Visibility = backupsContainingThisApp.Count == 0 ? Visibility.Visible : Visibility.Collapsed; backupsList.ItemsSource = backupsContainingThisApp; await dataEx.CalculateSize(); } }