public async void DeleteThemeDialog(int id) { ContentDialog deleteDialog = new ContentDialog { Title = "Delete Theme Permanently?", Content = "If you delete this theme you will not be able to recover it. Are you sure you want to PERMANENTLY delete this Theme?", PrimaryButtonText = "Delete", CloseButtonText = "Cancel" }; ContentDialogResult result = await deleteDialog.ShowAsync(); if (result == ContentDialogResult.Primary) { // Delete the theme var theme = ThemeRepository.Find(id); if (theme == null) { return; } ThemeRepository.RemoveAndCommit(id); // Remove from the Themes List for (int i = Themes.Count - 1; i >= 0; i--) { if (Themes[i].ID == id) { Themes.RemoveAt(i); break; } } } }
public override void OnNavigatedTo() { Debug.WriteLine($"{nameof(ThemeDetailsViewModel)} - {nameof(OnNavigatedTo)}"); // Grab the parameter Theme = ThemeRepository.Find(((WallpaperTheme)NavigationService.Parameter).ID); FileCache.Clear(); // Enable or Disable the Active Theme Buttons ActiveThemeService activeThemeService = new ActiveThemeService(); if (activeThemeService.GetActiveDesktopThemeID() == Theme.ID) { SetActiveDesktopThemeButtonEnabled = false; } else { SetActiveDesktopThemeButtonEnabled = true; } if (activeThemeService.GetActiveLockscreenThemeID() == Theme.ID) { SetActiveLockscreenThemeButtonEnabled = false; } else { SetActiveLockscreenThemeButtonEnabled = true; } // Update the UI Elements in Settings RevertNameChangeCommand.Execute(null); RevertWallpaperSelectionMethodCommand.Execute(null); RevertWallpaperChangeFrequencyCommand.Execute(null); RefreshDirectoriesCommand.Execute(null); // Load the files Progress <IndicatorProgressReport> progress = new Progress <IndicatorProgressReport>(); progress.ProgressChanged += Progress_ProgressChanged; LoadFileCache(progress); }
public async void DeleteThemeDialog() { ContentDialog deleteDialog = new ContentDialog { Title = "Delete Theme Permanently?", Content = "If you delete this theme you will not be able to recover it. Are you sure you want to PERMANENTLY delete this Theme?", PrimaryButtonText = "Delete", CloseButtonText = "Cancel" }; ContentDialogResult result = await deleteDialog.ShowAsync(); if (result == ContentDialogResult.Primary) { // Check the Active Themes and get rid of them if needed ActiveThemeService activeThemeService = new ActiveThemeService(); if (activeThemeService.GetActiveDesktopThemeID() == Theme.ID) { activeThemeService.DeselectActiveDesktopTheme(); } if (activeThemeService.GetActiveLockscreenThemeID() == Theme.ID) { activeThemeService.DeselectActiveLockscreenTheme(); } // Delete the theme var theme = ThemeRepository.Find(Theme.ID); if (theme == null) { return; } ThemeRepository.RemoveAndCommit(Theme.ID); // Redirect to the MainPage MainViewModel.Instance.NavigateThemesCommand.Execute(null); } }