Beispiel #1
0
        private void Discard_OnClick(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show(String.Format(UiLang.Get("BookDeleteConfirm"), BookInfoGet("Title")), UiLang.Get("BookDeleteConfirmTitle"), MessageBoxButton.YesNo) != MessageBoxResult.Yes)
            {
                return;
            }

            BookKeeper.Discard(_bookFile);
            Close();
        }
Beispiel #2
0
        private void BookGrid_OnKeyUp(object sender, KeyEventArgs e)
        {
            var dataGrid           = (DataGrid)sender;
            var forcedSettingValue = (Keyboard.IsKeyDown(Key.LeftShift)
                ? true
                : (Keyboard.IsKeyDown(Key.LeftCtrl) ? false : (bool?)null));

            switch (e.Key)
            {
            case Key.Delete:
                if (
                    MessageBox.Show(
                        String.Format(UiLang.Get("DeleteBooksConfirm"),
                                      dataGrid.SelectedItems.Count), UiLang.Get("DiscardBook"), MessageBoxButton.YesNo) !=
                    MessageBoxResult.Yes)
                {
                    return;
                }

                foreach (var book in dataGrid.SelectedItems.Cast <Book>().ToList())
                {
                    BookKeeper.Discard(book.BookFile);
                }

                break;

            case Key.F:
                foreach (var book in dataGrid.SelectedItems.Cast <Book>().ToList())
                {
                    BookInfoSet("Favorite", (forcedSettingValue ?? (!book.Favorite)), book.BookFile);
                }

                BookGridReload();     //Reload grid in the main window
                break;

            case Key.S:
                foreach (var book in dataGrid.SelectedItems.Cast <Book>().ToList())
                {
                    BookInfoSet("Sync", (forcedSettingValue ?? (!book.Sync)), book.BookFile);
                }

                BookGridReload();     //Reload grid in the main window
                break;

            case Key.D:
                foreach (var book in dataGrid.SelectedItems.Cast <Book>().ToList())
                {
                    BookInfoSet("Sync", (forcedSettingValue ?? (!book.Sync)), book.BookFile);
                    BookInfoSet("Favorite", (forcedSettingValue ?? (!book.Favorite)), book.BookFile);
                }
                BookGridReload();     //Reload grid in the main window
                break;
            }
        }