コード例 #1
0
        private async void DeleteCategoryAppButton_Click(object sender, RoutedEventArgs e)
        {
            var CurrentCategory = (Categories)CategoryBox.SelectedValue;
            NotificationControl SuccessNotification;

            DeleteCategoryDialog dialog = new DeleteCategoryDialog();
            await dialog.ShowAsync();

            switch (dialog.Result)
            {
            case Results.Delete:
                //Remove all favorites in category
                GifologyDatabase.DeleteImageInCategory(CurrentCategory);
                GifologyDatabase.DeleteCategories(CurrentCategory);
                SuccessNotification = Notifications.CreateNotification("SuccessNotification", "Category Deleted", "Success", false);
                SuccessNotification.ShowHideNotification(true);
                break;

            case Results.Keep:
                //Don't delete favorites
                GifologyDatabase.MoveImageToUncategorized(CurrentCategory);
                GifologyDatabase.DeleteCategories(CurrentCategory);
                SuccessNotification = Notifications.CreateNotification("SuccessNotification", "Category Deleted", "Success", false);
                SuccessNotification.ShowHideNotification(true);
                break;

            case Results.Cancel:
                return;

            default:
                break;
            }

            LoadCategoryList(0);
        }
コード例 #2
0
        private async void DeleteCategory()
        {
            DeleteCategoryDialog dialog = new DeleteCategoryDialog(Categories);

            ContentDialogResult result = await dialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                if (dialog.SelectedCategory != null)
                {
                    _itemRepository.DeleteCategoryWithItems(dialog.SelectedCategory.Id);
                    Categories.Remove(dialog.SelectedCategory);
                    DeleteItemsWithCategory(dialog.SelectedCategory);
                    BuildItemList();
                }
            }
        }
コード例 #3
0
        private async void DeleteCategory()
        {
            DeleteCategoryDialog dialog = new DeleteCategoryDialog(new ObservableCollection <Category>(TripCategories));

            ContentDialogResult result = await dialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                if (dialog.SelectedCategory != null)
                {
                    _tripRepository.DeleteCategoryWithItems(dialog.SelectedCategory.Id);
                    TripCategories.Remove(dialog.SelectedCategory);
                    DeleteItemsWithCategory(dialog.SelectedCategory);
                    BuildItemList();
                }
            }
        }