public LibraryBrowserFilter(Configuration.ConfigLibraryBrowserView libraryBrowserSettings) { LibraryBrowserSettings = libraryBrowserSettings; text = ""; sortType = libraryBrowserSettings.SortType; sortOrder = libraryBrowserSettings.SortOrder; globalSortType = libraryBrowserSettings.GlobalSortType; globalSortOrder = libraryBrowserSettings.GlobalSortOrder; }
public LibraryBrowserToolStrip(LibraryBrowserFilter libraryBrowserFilter, LibraryModel libraryModel, Configuration.ConfigLibraryBrowserView libraryBrowserSettings, SearchHandler searchHandler) { InitializeComponent(); LibraryBrowserFilter = libraryBrowserFilter; LibraryModel = libraryModel; LibraryBrowserSettings = libraryBrowserSettings; SearchHandler = searchHandler; toolStrip = new ToolStrip(); filterComboBox = new ToolStripSpringComboBox(); sortTypeComboBox = new ToolStripComboBox(); sortOrderComboBox = new ToolStripComboBox(); globalSortTypeComboBox = new ToolStripComboBox(); globalSortOrderComboBox = new ToolStripComboBox(); SuspendLayout(); filterComboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend; filterComboBox.AutoCompleteSource = AutoCompleteSource.ListItems; filterComboBox.DropDownStyle = ComboBoxStyle.DropDown; filterComboBox.Dock = DockStyle.Fill; filterComboBox.Margin = new Padding(0, 0, 6, 0); filterComboBox.KeyDown += FilterComboBox_KeyDown; filterComboBox.ComboBox.SelectedIndexChanged += ComboBox_SelectedIndexChanged; filterComboBox.ComboBox.SelectionChangeCommitted += FilterComboBox_SelectionChangeCommitted; // WORKAROUND: bug since win7 - selectedindex is wrong when a datasource is bound //searchComboBox.ComboBox.DataSource = galleryModel.Searches; //galleryModel.Searches.ListChanged += Searches_ListChanged; filterComboBox.ComboBox.OverrideMouseWheelBehaviour(); filterComboBox.EnableMiddleClickToClear(); filterComboBox.OverrideUpDownKeys(); sortTypeComboBox.Text = "&Sort"; sortTypeComboBox.FlatStyle = FlatStyle.Flat; sortTypeComboBox.DropDownStyle = ComboBoxStyle.DropDownList; List <ComboBoxItem> sortTypeItems = new List <ComboBoxItem> { new ComboBoxItem("orderByNone", "None", SortTypeComboBox_None, GallerySortType.None), new ComboBoxItem("orderByTitle", "Title", SortTypeComboBox_Title, GallerySortType.Title), new ComboBoxItem("orderByLanguage", "Language", SortTypeComboBox_Language, GallerySortType.Language), new ComboBoxItem("orderByArtist", "Artist", SortTypeComboBox_Artist, GallerySortType.Artist), new ComboBoxItem("orderByGroup", "Group", SortTypeComboBox_Group, GallerySortType.Group), new ComboBoxItem("orderByTag", "Tag", SortTypeComboBox_Tag, GallerySortType.Tag), new ComboBoxItem("orderByParody", "Parody", SortTypeComboBox_Parody, Tag = GallerySortType.Parody), new ComboBoxItem("orderByCharacter", "Character", SortTypeComboBox_Character, GallerySortType.Character), new ComboBoxItem("orderByCategory", "Category", SortTypeComboBox_Category, GallerySortType.Category), new ComboBoxItem("orderByScanlator", "Scanlator", SortTypeComboBox_Scanlator, GallerySortType.Scanlator), new ComboBoxItem("orderByUploadDate", "Upload Date", SortTypeComboBox_UploadDate, GallerySortType.UploadDate), new ComboBoxItem("orderByNumPages", "Num Pages", SortTypeComboBox_NumPages, GallerySortType.NumPages), new ComboBoxItem("orderByNumFavorites", "Num Favorites", SortTypeComboBox_NumFavorites, GallerySortType.NumFavorites), new ComboBoxItem("orderById", "Id", SortTypeComboBox_Id, GallerySortType.Id), //new SortItem("orderByComiket", "Comiket", SortTypeComboBox_Comiket, GallerySortType.Comiket), //new SortItem("orderByVersion", "Version", SortTypeComboBox_Version, GallerySortType.Version), //new SortItem("orderByCensorship", "Censorship", SortTypeComboBox_Censorship, GallerySortType.Censorship), }; sortTypeComboBox.Items.AddRange(sortTypeItems.Cast <object>().ToArray()); sortTypeComboBox.ComboBox.SelectionChangeCommitted += SortTypeComboBox_SelectionChangeCommitted; sortTypeComboBox.SelectedItem = sortTypeItems.First(x => (GallerySortType)x.Tag == LibraryBrowserFilter.SortType); sortTypeComboBox.ComboBox.OverrideMouseWheelBehaviour(); sortTypeComboBox.OverrideUpDownKeys(); sortOrderComboBox.Text = "&Sort"; sortOrderComboBox.FlatStyle = FlatStyle.Flat; sortOrderComboBox.DropDownStyle = ComboBoxStyle.DropDownList; List <ComboBoxItem> sortOrderItems = new List <ComboBoxItem> { new ComboBoxItem("orderByAscending", "Ascending", SortOrderComboBox_Ascending, SortOrder.Ascending), new ComboBoxItem("orderByDescending", "Descending", SortOrderComboBox_Descending, SortOrder.Descending) }; sortOrderComboBox.Items.AddRange(sortOrderItems.Cast <object>().ToArray()); sortOrderComboBox.ComboBox.SelectionChangeCommitted += SortOrderComboBox_SelectionChangeCommitted; sortOrderComboBox.SelectedItem = sortOrderItems.First(x => (SortOrder)x.Tag == LibraryBrowserFilter.SortOrder); sortOrderComboBox.ComboBox.OverrideMouseWheelBehaviour(); sortOrderComboBox.Enabled = LibraryBrowserFilter.SortType != GallerySortType.None; sortOrderComboBox.OverrideUpDownKeys(); globalSortTypeComboBox.Text = "&Sort"; globalSortTypeComboBox.FlatStyle = FlatStyle.Flat; globalSortTypeComboBox.DropDownStyle = ComboBoxStyle.DropDownList; List <ComboBoxItem> globalSortTypeItems = new List <ComboBoxItem> { new ComboBoxItem("orderByNone", "None", GlobalSortTypeComboBox_None, LibrarySortType.None), new ComboBoxItem("orderByCreationTime", "Creation time", GlobalSortTypeComboBox_CreationTime, LibrarySortType.CreationTime), new ComboBoxItem("orderByLastAccessTime", "Last access time", GlobalSortTypeComboBox_LastAccessTime, LibrarySortType.LastAccessTime), new ComboBoxItem("orderByLastWriteTime", "Last write time", GlobalSortTypeComboBox_LastWriteTime, LibrarySortType.LastWriteTime), }; globalSortTypeComboBox.Items.AddRange(globalSortTypeItems.Cast <object>().ToArray()); globalSortTypeComboBox.ComboBox.SelectionChangeCommitted += GlobalSortTypeComboBox_SelectionChangeCommitted; globalSortTypeComboBox.SelectedItem = globalSortTypeItems.First(x => (LibrarySortType)x.Tag == LibraryBrowserFilter.GlobalSortType); globalSortTypeComboBox.ComboBox.OverrideMouseWheelBehaviour(); globalSortTypeComboBox.OverrideUpDownKeys(); globalSortOrderComboBox.Text = "&Sort"; globalSortOrderComboBox.FlatStyle = FlatStyle.Flat; globalSortOrderComboBox.DropDownStyle = ComboBoxStyle.DropDownList; List <ComboBoxItem> globalSortOrderItems = new List <ComboBoxItem> { new ComboBoxItem("orderByAscending", "Ascending", GlobalSortOrderComboBox_Ascending, SortOrder.Ascending), new ComboBoxItem("orderByDescending", "Descending", GlobalSortOrderComboBox_Descending, SortOrder.Descending) }; globalSortOrderComboBox.Items.AddRange(globalSortOrderItems.Cast <object>().ToArray()); globalSortOrderComboBox.ComboBox.SelectionChangeCommitted += SortOrderComboBox_SelectionChangeCommitted; globalSortOrderComboBox.SelectedItem = globalSortOrderItems.First(x => (SortOrder)x.Tag == LibraryBrowserFilter.GlobalSortOrder); globalSortOrderComboBox.ComboBox.OverrideMouseWheelBehaviour(); globalSortOrderComboBox.Enabled = LibraryBrowserFilter.GlobalSortType != LibrarySortType.None; globalSortOrderComboBox.OverrideUpDownKeys(); toolStrip.Dock = DockStyle.Fill; toolStrip.CanOverflow = false; toolStrip.Items.Add(filterComboBox); toolStrip.Items.Add(sortTypeComboBox); toolStrip.Items.Add(sortOrderComboBox); toolStrip.Items.Add(globalSortTypeComboBox); toolStrip.Items.Add(globalSortOrderComboBox); // // this // Controls.Add(toolStrip); //LibraryModel.SearchesChanged += LibraryModel_SearchesChanged; LibraryModel.FiltersChanged += LibraryModel_FiltersChanged; libraryBrowserFilter.SortTypeChanged += LibraryBrowserFilter_SortTypeChanged; libraryBrowserFilter.SortOrderChanged += LibraryBrowserFilter_SortOrderChanged; libraryBrowserFilter.GlobalSortTypeChanged += LibraryBrowserFilter_GlobalSortTypeChanged; libraryBrowserFilter.GlobalSortOrderChanged += LibraryBrowserFilter_GlobalSortOrderChanged; ResumeLayout(false); }
public LibraryBrowserView(LibraryBrowserFilter libraryBrowserFilter, LibraryModel libraryModel, DocumentTemplate <ISearchProgressArg> libraryCovergridTemplate, DocumentTemplate <ISearchArg> libraryPreloadTemplate, DocumentTemplate <Metadata> libraryCovergridItemTemplate , IPathFormatter pathFormatter , PageDownloader pageDownloader , CoverDownloader coverLoader , MetadataKeywordLists metadataKeywordLists , Configuration.ConfigLibraryBrowserView libraryBrowserSettings , ISearchResultCache searchResultCache) { InitializeComponent(); LibraryBrowserFilter = libraryBrowserFilter; LibraryModel = libraryModel; PathFormatter = pathFormatter; SearchResultCache = searchResultCache; LibraryCovergridTemplate = libraryCovergridTemplate; LibraryPreloadTemplate = libraryPreloadTemplate; LibraryCovergridItemTemplate = libraryCovergridItemTemplate; PageDownloader = pageDownloader; CoverLoader = coverLoader; MetadataKeywordLists = metadataKeywordLists; LibraryBrowserSettings = libraryBrowserSettings; webBrowser = new WebBrowserEx(); backgroundWorker = new BackgroundWorker(); SuspendLayout(); webBrowser.AllowWebBrowserDrop = false; webBrowser.Dock = DockStyle.Fill; webBrowser.Name = "libraryWebBrowser"; webBrowser.BeforeDocumentCompleted += WebBrowser_BeforeDocumentCompleted; webBrowser.DocumentCompleted += WebBrowser_DocumentCompleted; backgroundWorker.WorkerReportsProgress = true; backgroundWorker.WorkerSupportsCancellation = true; backgroundWorker.DoWork += BackgroundWorker_DoWork; backgroundWorker.ProgressChanged += BackgroundWorker_ProgressChanged; backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted; PageDownloader.PageDownloadReportProgress += PageDownloader_PageDownloadReportProgress; PageDownloader.PagesDownloadStarted += PageDownloader_PagesDownloadStarted; PageDownloader.PagesDownloadCancelled += PageDownloader_PagesDownloadCancelled; PageDownloader.PagesDownloadCompleted += PageDownloader_PagesDownloadCompleted; CoverLoader.CoverDownloadReportProgress += CoverLoader_CoverDownloadReportProgress; CoverLoader.CoversDownloadStarted += CoverLoader_CoversDownloadStarted; CoverLoader.CoversDownloadCancelled += CoverLoader_CoversDownloadCancelled; CoverLoader.CoversDownloadCompleted += CoverLoader_CoversDownloadCompleted; MetadataKeywordLists.WhitelistChanged += Form_WhiteListChanged; MetadataKeywordLists.BlacklistChanged += Form_BlackListChanged; MetadataKeywordLists.IgnorelistChanged += Form_IgnoreListChanged; MetadataKeywordLists.HidelistChanged += Form_HideListChanged; //libraryModel.Poll += LibraryModel_Poll; libraryBrowserFilter.TextChanged += LibraryBrowserFilter_TextChanged; LibraryModel.PageIndexChanged += LibraryModel_PageIndexChanged; LibraryModel.SearchProgressArgChanged += LibraryModel_SearchProgressArgChanged; Controls.Add(webBrowser); ResumeLayout(false); }