public NonFictionSearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, string searchQuery,
                                                   List <NonFictionBook> searchResults)
            : base(mainModel, parentWindowContext, LibgenObjectType.NON_FICTION_BOOK, searchQuery)
        {
            columnSettings = mainModel.AppSettings.NonFiction.Columns;
            LanguageFormatter formatter = MainModel.Localization.CurrentLanguage.Formatter;

            books = new ObservableCollection <NonFictionSearchResultItemViewModel>(searchResults.Select(book =>
                                                                                                        new NonFictionSearchResultItemViewModel(book, formatter)));
            Initialize();
        }
Пример #2
0
        public NonFictionSearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, string searchQuery,
                                                   List <NonFictionBook> searchResults)
            : base(mainModel, parentWindowContext, LibgenObjectType.NON_FICTION_BOOK, searchQuery)
        {
            columnSettings = mainModel.AppSettings.NonFiction.Columns;
            LanguageFormatter formatter = MainModel.Localization.CurrentLanguage.Formatter;

            books = new ObservableCollection <NonFictionSearchResultItemViewModel>(searchResults.Select(book =>
                                                                                                        new NonFictionSearchResultItemViewModel(book, formatter)));
            OpenDetailsCommand          = new Command(param => OpenDetails((param as NonFictionSearchResultItemViewModel)?.Book));
            BookDataGridEnterKeyCommand = new Command(BookDataGridEnterKeyPressed);
            Initialize();
        }
Пример #3
0
 public NonFictionSearchResultsTabViewModel(MainModel mainModel, IWindowContext parentWindowContext, string searchQuery,
                                            ObservableCollection <NonFictionBook> searchResults)
     : base(mainModel, parentWindowContext, searchQuery)
 {
     columnSettings                   = mainModel.AppSettings.NonFiction.Columns;
     this.searchQuery                 = searchQuery;
     books                            = searchResults;
     ExportPanelViewModel             = new ExportPanelViewModel(mainModel, LibgenObjectType.NON_FICTION_BOOK, parentWindowContext);
     ExportPanelViewModel.ClosePanel += CloseExportPanel;
     OpenDetailsCommand               = new Command(param => OpenDetails(param as NonFictionBook));
     SearchCommand                    = new Command(Search);
     ExportCommand                    = new Command(ShowExportPanel);
     BookDataGridEnterKeyCommand      = new Command(BookDataGridEnterKeyPressed);
     Initialize();
 }
Пример #4
0
 private void ValidateAndCorrectNonFictionSettings()
 {
     if (NonFiction == null)
     {
         NonFiction = NonFictionSettings.Default;
     }
     else
     {
         if (NonFiction.DetailsWindow == null)
         {
             NonFiction.DetailsWindow = NonFictionDetailsWindowSettings.Default;
         }
         else
         {
             NonFictionDetailsWindowSettings nonFictionDetailsWindow = NonFiction.DetailsWindow;
             if (nonFictionDetailsWindow.Width < NON_FICTION_DETAILS_WINDOW_MIN_WIDTH)
             {
                 nonFictionDetailsWindow.Width = NON_FICTION_DETAILS_WINDOW_MIN_WIDTH;
             }
             if (nonFictionDetailsWindow.Height < NON_FICTION_DETAILS_WINDOW_MIN_HEIGHT)
             {
                 nonFictionDetailsWindow.Height = NON_FICTION_DETAILS_WINDOW_MIN_HEIGHT;
             }
         }
         if (NonFiction.Columns == null)
         {
             NonFiction.Columns = NonFictionColumnSettings.Default;
         }
         else
         {
             NonFictionColumnSettings nonFictionColumns = NonFiction.Columns;
             if (nonFictionColumns.TitleColumnWidth < NON_FICTION_GRID_TITLE_COLUMN_MIN_WIDTH)
             {
                 nonFictionColumns.TitleColumnWidth = NON_FICTION_GRID_TITLE_COLUMN_MIN_WIDTH;
             }
             if (nonFictionColumns.AuthorsColumnWidth < NON_FICTION_GRID_AUTHORS_COLUMN_MIN_WIDTH)
             {
                 nonFictionColumns.AuthorsColumnWidth = NON_FICTION_GRID_AUTHORS_COLUMN_MIN_WIDTH;
             }
             if (nonFictionColumns.SeriesColumnWidth < NON_FICTION_GRID_SERIES_COLUMN_MIN_WIDTH)
             {
                 nonFictionColumns.SeriesColumnWidth = NON_FICTION_GRID_SERIES_COLUMN_MIN_WIDTH;
             }
             if (nonFictionColumns.YearColumnWidth < NON_FICTION_GRID_YEAR_COLUMN_MIN_WIDTH)
             {
                 nonFictionColumns.YearColumnWidth = NON_FICTION_GRID_YEAR_COLUMN_MIN_WIDTH;
             }
             if (nonFictionColumns.PublisherColumnWidth < NON_FICTION_GRID_PUBLISHER_COLUMN_MIN_WIDTH)
             {
                 nonFictionColumns.PublisherColumnWidth = NON_FICTION_GRID_PUBLISHER_COLUMN_MIN_WIDTH;
             }
             if (nonFictionColumns.FormatColumnWidth < NON_FICTION_GRID_FORMAT_COLUMN_MIN_WIDTH)
             {
                 nonFictionColumns.FormatColumnWidth = NON_FICTION_GRID_FORMAT_COLUMN_MIN_WIDTH;
             }
             if (nonFictionColumns.FileSizeColumnWidth < NON_FICTION_GRID_FILESIZE_COLUMN_MIN_WIDTH)
             {
                 nonFictionColumns.FileSizeColumnWidth = NON_FICTION_GRID_FILESIZE_COLUMN_MIN_WIDTH;
             }
             if (nonFictionColumns.OcrColumnWidth < NON_FICTION_GRID_OCR_COLUMN_MIN_WIDTH)
             {
                 nonFictionColumns.OcrColumnWidth = NON_FICTION_GRID_OCR_COLUMN_MIN_WIDTH;
             }
             if (nonFictionColumns.ExistsInLibraryColumnWidth < NON_FICTION_GRID_EXISTS_IN_LIBRARY_COLUMN_MIN_WIDTH)
             {
                 nonFictionColumns.ExistsInLibraryColumnWidth = NON_FICTION_GRID_EXISTS_IN_LIBRARY_COLUMN_MIN_WIDTH;
             }
         }
         NonFiction.ExportPanel = ValidateAndCorrectExportPanelSettings(NonFiction.ExportPanel);
     }
 }