Пример #1
0
        /// <summary>
        /// Used for touch screen users, but works for PC users too
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void FlyoutBtnDelete_Click(object sender, RoutedEventArgs e)
        {
            // Hide flyout
            taskFlyout.Hide();

            // Create dialog and check button click result
            var deleteDialog = new DeleteConfirmationView();
            var result       = await deleteDialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                // Close pane when done
                splitView.IsPaneOpen = false;

                // Delete Task from collection and databaseIn
                var deleteSuccess = (SelectedModel != null) ? ViewModel.DeleteTask(SelectedModel) : false;


                if (deleteSuccess)
                {
                    UpdateCardIndexes();
                    KanbanInAppNotification.Show("Task deleted from board successfully", 3000);
                }
                else
                {
                    KanbanInAppNotification.Show("Task failed to be deleted. Please try again or restart the application.", 3000);
                }
            }
            else
            {
                return;
            }
        }
Пример #2
0
        private async void CardBtnDelete_Click(object sender, RoutedEventArgs e)
        {
            var originalSource = (FrameworkElement)sender;

            SelectedModel = originalSource.DataContext as CustomKanbanModel;

            // Create dialog and check button click result
            var deleteDialog = new DeleteConfirmationView();
            var result       = await deleteDialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                // Close pane when done
                splitView.IsPaneOpen = false;

                // Delete Task from collection and database
                var deleteSuccess = (SelectedModel != null) ? ViewModel.DeleteTask(SelectedModel) : false;

                if (deleteSuccess)
                {
                    KanbanInAppNotification.Show("Task deleted from board successfully", 4000);
                }
            }
            else
            {
                return;
            }
        }