Beispiel #1
0
 public SearchHandler(
     LibraryModel libraryModel
     , TabControlEx mainViewTabControl
     , TabPage libraryBrowserViewTabPage
     , TabPage galleryBrowserViewTabPage
     , Configuration.ConfigCache cacheSettings
     , ISearchResultCache searchResultCache
     , ILogger logger
     , BrowsingModel browsingModel
     , IPathFormatter pathFormatter
     , HttpClient httpClient
     , IQueryParser queryParser
     , GalleryModel galleryModel
     , DetailsModel detailsModel
     , GalleryDownloader galleryDownloader)
 {
     LibraryModel              = libraryModel;
     MainViewTabControl        = mainViewTabControl;
     LibraryBrowserViewTabPage = libraryBrowserViewTabPage;
     GalleryBrowserViewTabPage = galleryBrowserViewTabPage;
     CacheSettings             = cacheSettings;
     SearchResultCache         = searchResultCache;
     Logger            = logger;
     BrowsingModel     = browsingModel;
     PathFormatter     = pathFormatter;
     HttpClient        = httpClient;
     QueryParser       = queryParser;
     GalleryModel      = galleryModel;
     DetailsModel      = detailsModel;
     GalleryDownloader = galleryDownloader;
 }
Beispiel #2
0
        public DetailsBrowserView(DetailsBrowserFilter detailsBrowserFilter, DetailsModel detailsModel, DocumentTemplate <Metadata> detailsTemplate, DocumentTemplate <Metadata> downloadTemplate, DocumentTemplate <Metadata> detailsPreloadTemplate
                                  , GalleryDownloader galleryDownloader
                                  , PageDownloader pageDownloader
                                  , CoverDownloader coverDownloader
                                  , MetadataKeywordLists metadataKeywordLists
                                  , Configuration.ConfigDetailsBrowserView detailsBrowserSettings
                                  , ISearchResultCache searchResultCache
                                  , ICacheFileSystem cacheFileSystem)
        {
            InitializeComponent();

            DetailsBrowserFilter   = detailsBrowserFilter;
            DetailsModel           = detailsModel;
            DetailsTemplate        = detailsTemplate;
            DownloadTemplate       = downloadTemplate;
            DetailsPreloadTemplate = detailsPreloadTemplate;
            GalleryDownloader      = galleryDownloader;
            PageDownloader         = pageDownloader;
            CoverDownloader        = coverDownloader;
            MetadataKeywordLists   = metadataKeywordLists;
            DetailsBrowserSettings = detailsBrowserSettings;
            SearchResultCache      = searchResultCache;
            CacheFileSystem        = cacheFileSystem;

            webBrowser = new WebBrowserEx();

            SuspendLayout();

            webBrowser.AllowWebBrowserDrop = false;
            webBrowser.Dock = DockStyle.Fill;
            webBrowser.Name = "detailsWwebBrowser";
            webBrowser.BeforeDocumentCompleted += WebBrowser_BeforeDocumentCompleted;
            webBrowser.DocumentCompleted       += WebBrowser_DocumentCompleted;

            GalleryDownloader.GalleryDownloadReportProgress += GalleryDownloader_GalleryDownloadReportProgress;
            GalleryDownloader.GalleryDownloadStarted        += GalleryDownloader_GalleryDownloadStarted;
            GalleryDownloader.GalleryDownloadCancelled      += GalleryDownloader_GalleryDownloadCancelled;
            GalleryDownloader.GalleryDownloadCompleted      += GalleryDownloader_GalleryDownloadCompleted;

            PageDownloader.PageDownloadReportProgress += PageDownloader_PageDownloadReportProgress;
            PageDownloader.PagesDownloadStarted       += PageDownloader_PagesDownloadStarted;
            PageDownloader.PagesDownloadCancelled     += PageDownloader_PagesDownloadCancelled;
            PageDownloader.PagesDownloadCompleted     += PageDownloader_PagesDownloadCompleted;

            CoverDownloader.CoverDownloadReportProgress += CoverDownloader_CoverDownloadReportProgress;
            CoverDownloader.CoversDownloadStarted       += CoverDownloader_CoversDownloadStarted;
            CoverDownloader.CoversDownloadCancelled     += CoverDownloader_CoversDownloadCancelled;
            CoverDownloader.CoversDownloadCompleted     += CoverDownloader_CoversDownloadCompleted;

            MetadataKeywordLists.WhitelistChanged  += Form_WhiteListChanged;
            MetadataKeywordLists.BlacklistChanged  += Form_BlackListChanged;
            MetadataKeywordLists.IgnorelistChanged += Form_IgnoreListChanged;
            MetadataKeywordLists.HidelistChanged   += Form_HideListChanged;

            DetailsModel.MetadataChanged += DetailsModel_MetadataChanged;

            Controls.Add(webBrowser);

            ResumeLayout(false);
        }
Beispiel #3
0
        // NOTE: at the moment both details and download share the same webbrowser.
        private bool ShowDetailsOrDownload(int galleryId, Action <Metadata> action)
        {
            DetailsModel.AddSearch(galleryId);

            string cachedMetadataFilePath;

            if (PathFormatter.IsEnabled)
            {
                cachedMetadataFilePath = PathFormatter.GetMetadata(galleryId);
            }
            else
            {
                cachedMetadataFilePath = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}", PathFormatter.GetCacheDirectory(), galleryId, ".json");
            }

            Metadata metadata = SearchResultCache.Find(galleryId) ?? JsonUtility.LoadFromFile <Metadata>(cachedMetadataFilePath);

            if (metadata == null)
            {
                // let it download in the background, DetailsBrowserView will respond to its completion event.
                GalleryDownloader.Download(galleryId);

                return(false);
            }

            if (metadata == null)
            {
                MessageBox.Show("can't find metadata");

                return(false);
            }

            if (action != null)
            {
                action.Invoke(metadata);
            }

            return(true);
        }
Beispiel #4
0
        public Taskbar(CoverDownloader coverDownloader, GalleryDownloader galleryDownloader, PageDownloader pageDownloader, ISearchResultCache searchResultCache, ICacheFileSystem cacheFileSystem)
        {
            CoverDownloader   = coverDownloader;
            GalleryDownloader = galleryDownloader;
            PageDownloader    = pageDownloader;
            SearchResultCache = searchResultCache;
            CacheFileSystem   = cacheFileSystem;

            taskbarManager = new TaskbarManager();
            progressBar    = new ProgressBar();

            progressBar.ValueChanged += ProgressBar_ValueChanged;
            progressBar.StateChanged += ProgressBar_StateChanged;

            CoverDownloader.CoversDownloadStarted       += CoverDownloader_CoversDownloadStarted;
            CoverDownloader.CoverDownloadReportProgress += CoverDownloader_CoverDownloadReportProgress;

            GalleryDownloader.GalleryDownloadStarted        += GalleryDownloader_GalleryDownloadStarted;
            GalleryDownloader.GalleryDownloadReportProgress += GalleryDownloader_GalleryDownloadReportProgress;

            PageDownloader.PagesDownloadEnqueued      += PageDownloader_PagesDownloadEnqueued;
            PageDownloader.PageDownloadReportProgress += PageDownloader_PageDownloadReportProgress;
        }
Beispiel #5
0
        public MainForm()
        {
            InitializeComponent();
            ProcessCommandLine();

            staticHttpClient = new StaticHttpClient(Settings.Network);

            pathFormatter = new PathFormatter(Program.ApplicationPath, Program.SourcePath, Settings.PathFormatter.Custom, Settings.PathFormatter, Settings.Lists.Tags.LanguageNames, Settings.PathFormatter.IsEnabled);

            tagsModel         = new TagsModel();
            tokenModifiers    = TokenModifiers.All.Concat(new ITokenModifier[] { new TagTokenModifier(tagsModel) }).ToArray();
            bookmarkFormatter = new BookmarkFormatter(Settings.Lists.Bookmarks, Settings.Lists.Tags, tagsModel, pathFormatter, tokenModifiers);
            bookmarksModel    = new BookmarksModel(tagsModel, bookmarkFormatter);
            libraryModel      = new LibraryModel(pathFormatter.GetCacheDirectory(), new WinformsTimer(0, Settings.Polling.LibraryRefreshInterval));
            browsingModel     = new BrowsingModel();
            galleryModel      = new GalleryModel(tagsModel);
            detailsModel      = new DetailsModel();

            metadataKeywordLists = new MetadataKeywordLists();
            metadataProcessors   = new List <IMetadataProcessor>();
            metadataConverters   = new List <IMetadataConverter>();
            archiveWriters       = new List <IArchiveWriter>();
            queryParser          = new QueryParser(tagsModel);

            coreTextFormatter     = new CoreTextFormatter(pathFormatter, tokenModifiers);
            aboutTextFormatter    = new AboutTextFormatter(pathFormatter);
            tagTextFormatter      = new TagTextFormatter();
            metadataTextFormatter = new MetadataTextFormatter(pathFormatter, Settings.Lists.Tags.LanguageNames, metadataKeywordLists, tokenModifiers);

            documentTemplates                      = new DocumentTemplates();
            documentTemplates.About                = new DocumentTemplate <object>("about", Settings.Cache.Templates, pathFormatter, (x, context) => aboutTextFormatter.Format(x));
            documentTemplates.Details              = new DocumentTemplate <Metadata>("details", Settings.Cache.Templates, pathFormatter, (text, context) => metadataTextFormatter.Format(text, context));
            documentTemplates.DetailsPreload       = new DocumentTemplate <Metadata>("details-preload", Settings.Cache.Templates, pathFormatter, (text, context) => metadataTextFormatter.Format(text, context));
            documentTemplates.Download             = new DocumentTemplate <Metadata>("download", Settings.Cache.Templates, pathFormatter, (text, context) => metadataTextFormatter.Format(text, context));
            documentTemplates.GalleryTooltip       = new DocumentTemplate <Metadata>("gallery-tooltip", Settings.Cache.Templates, pathFormatter, (text, context) => metadataTextFormatter.Format(text, context));
            documentTemplates.LibraryCovergrid     = new DocumentTemplate <ISearchProgressArg>("library-covergrid", Settings.Cache.Templates, pathFormatter, (text, context) => searchProgressArgTextFormatter.Format(text, context, "library"));
            documentTemplates.LibraryCovergridItem = new DocumentTemplate <Metadata>("library-covergrid-item", Settings.Cache.Templates, pathFormatter, (text, context) => metadataTextFormatter.Format(text, context));
            documentTemplates.SearchCovergrid      = new DocumentTemplate <ISearchProgressArg>("search-covergrid", Settings.Cache.Templates, pathFormatter, (text, context) => searchProgressArgTextFormatter.Format(text, context, "search"));
            documentTemplates.SearchCovergridItem  = new DocumentTemplate <Metadata>("search-covergrid-item", Settings.Cache.Templates, pathFormatter, (text, context) => metadataTextFormatter.Format(text, context));
            documentTemplates.SearchPreload        = new DocumentTemplate <ISearchArg>("search-preload", Settings.Cache.Templates, pathFormatter, (text, context) => searchArgTextFormatter.Format(text, context));
            documentTemplates.Startup              = new DocumentTemplate <object>("startup", Settings.Cache.Templates, pathFormatter, (text, context) => coreTextFormatter.Format(text, context));

            searchArgTextFormatter         = new SearchArgTextFormatter(pathFormatter, metadataKeywordLists, tagsModel, tokenModifiers);
            searchProgressArgTextFormatter = new SearchProgressArgTextFormatter(pathFormatter, metadataKeywordLists, tagsModel, metadataTextFormatter, tokenModifiers, documentTemplates.SearchCovergridItem, documentTemplates.LibraryCovergridItem);

            metadataCache     = new MetadataCache();
            searchResultCache = new SearchResultCache(metadataCache);
            sessionManager    = new SessionManager(pathFormatter, searchResultCache, Settings.Cache.Session.RecentLifeSpan, Settings.Cache.Session.SearchLifeSpan, Settings.Cache.Session.TaggedLifeSpan, Settings.Network);
            cacheFileSystem   = new CacheFileSystem(pathFormatter, searchResultCache, archiveWriters);
            pluginSystem      = new PluginSystem(Logger, pathFormatter, cacheFileSystem, archiveWriters, metadataConverters, metadataProcessors);

            backgroundTaskWorker = new BackgroundTaskWorker()
            {
                IdleWaitTime = Settings.BackgroundWorkers.BackgroundTaskWorker.IdleWaitTime, MaxConcurrentJobCount = Settings.BackgroundWorkers.BackgroundTaskWorker.MaxConcurrentJobCount
            };
            pageDownloader = new PageDownloader(staticHttpClient.Client, pathFormatter, searchResultCache, cacheFileSystem)
            {
                IdleWaitTime = Settings.BackgroundWorkers.PageDownloader.IdleWaitTime, MaxConcurrentJobCount = Settings.BackgroundWorkers.PageDownloader.MaxConcurrentJobCount
            };
            coverDownloader = new CoverDownloader(staticHttpClient.Client, pathFormatter, metadataKeywordLists)
            {
                IdleWaitTime = Settings.BackgroundWorkers.CoverDownloader.IdleWaitTime, MaxConcurrentJobCount = Settings.BackgroundWorkers.CoverDownloader.MaxConcurrentJobCount
            };
            coverLoader = new CoverDownloader(staticHttpClient.Client, pathFormatter, metadataKeywordLists)
            {
                IdleWaitTime = Settings.BackgroundWorkers.CoverLoader.IdleWaitTime, MaxConcurrentJobCount = Settings.BackgroundWorkers.CoverLoader.MaxConcurrentJobCount
            };
            galleryDownloader = new GalleryDownloader(staticHttpClient.Client, pathFormatter, searchResultCache)
            {
                IdleWaitTime = Settings.BackgroundWorkers.GalleryDownloader.IdleWaitTime, MaxConcurrentJobCount = Settings.BackgroundWorkers.GalleryDownloader.MaxConcurrentJobCount
            };

            detailsTabControl         = new TabControlEx();
            detailsTabPage            = new TabPage();
            downloadTabPage           = new TabPage();
            listsTabControl           = new TabControlEx();
            tagsTabPage               = new TabPage();
            bookmarksTabPage          = new TabPage();
            libraryTabPage            = new TabPage();
            browsingTabPage           = new TabPage();
            mainViewTabControl        = new TabControlEx();
            galleryBrowserViewTabPage = new TabPage();
            libraryBrowserViewTabPage = new TabPage();
            downloadsListViewTabPage  = new TabPage();
            webBrowserToolTip         = new WebBrowserTreeNodeToolTip(pathFormatter, documentTemplates.GalleryTooltip);
            loadTimer = new Timer(components);

            searchHandler = new SearchHandler(
                libraryModel
                , mainViewTabControl
                , libraryBrowserViewTabPage
                , galleryBrowserViewTabPage
                , Settings.Cache
                , searchResultCache
                , Logger
                , browsingModel
                , pathFormatter
                , staticHttpClient.Client
                , queryParser
                , galleryModel
                , detailsModel
                , galleryDownloader
                , sessionManager
                , Settings.Network);

            bookmarkPromptUtility = new BookmarkPromptUtility(bookmarksModel, Settings.Lists.Bookmarks);

            tagsFilter           = new TagsFilter(Settings.Lists.Tags, metadataKeywordLists);
            bookmarksFilter      = new BookmarksFilter(Settings.Lists.Bookmarks);
            libraryFilter        = new LibraryFilter(Settings.Lists.Library);
            browsingFilter       = new BrowsingFilter(Settings.Lists.Browsing);
            libraryBrowserFilter = new LibraryBrowserFilter(Settings.Library.Browser);
            galleryBrowserFilter = new GalleryBrowserFilter(Settings.Gallery.Browser);
            detailsBrowserFilter = new DetailsBrowserFilter(Settings.Details.Browser);

            tagsTreeView       = new TagsTreeView(tagsFilter, tagsModel, tagTextFormatter, Settings.Lists.Tags, metadataKeywordLists, searchHandler, bookmarkPromptUtility, staticHttpClient.Client);
            tagsToolStrip      = new TagsToolStrip(tagsFilter, tagsModel, Settings.Lists.Tags, metadataKeywordLists, Settings.Polling.FilterDelay);
            bookmarksTreeView  = new BookmarksTreeView(bookmarksFilter, bookmarksModel, Settings.Lists.Bookmarks, webBrowserToolTip, queryParser, cacheFileSystem, searchHandler);
            bookmarksToolStrip = new BookmarksToolStrip(bookmarksFilter, bookmarksModel, Settings.Lists.Bookmarks, Settings.Polling.FilterDelay);
            libraryTreeView    = new LibraryTreeView(libraryFilter, libraryModel, archiveWriters, webBrowserToolTip, searchHandler, cacheFileSystem);
            libraryToolStrip   = new LibraryToolStrip(libraryFilter, libraryModel, Settings.Lists.Library, Settings.Polling.FilterDelay);
            browsingTreeView   = new BrowsingTreeView(browsingFilter, browsingModel, Settings.Lists.Browsing, searchHandler, sessionManager, queryParser);
            browsingToolStrip  = new BrowsingToolStrip(browsingFilter, browsingModel, Settings.Lists.Browsing, Settings.Polling.FilterDelay);

            galleryBrowserView      = new GalleryBrowserView(galleryBrowserFilter, galleryModel, documentTemplates.SearchCovergrid, documentTemplates.SearchPreload, pathFormatter, Settings.Gallery.Browser, pageDownloader, coverDownloader, metadataKeywordLists, tagsModel, searchHandler);
            galleryToolStrip        = new GalleryBrowserToolStrip(galleryBrowserFilter, galleryModel, Settings.Gallery.Browser, searchHandler);
            libraryBrowserView      = new LibraryBrowserView(libraryBrowserFilter, libraryModel, documentTemplates.LibraryCovergrid, documentTemplates.SearchPreload, documentTemplates.LibraryCovergridItem, pathFormatter, pageDownloader, coverLoader, metadataKeywordLists, Settings.Library.Browser, searchResultCache);
            libraryBrowserToolStrip = new LibraryBrowserToolStrip(libraryBrowserFilter, libraryModel, Settings.Library.Browser, searchHandler);
            detailsToolStrip        = new DetailsBrowserToolStrip(detailsBrowserFilter, detailsModel, searchHandler);
            detailsBrowserView      = new DetailsBrowserView(detailsBrowserFilter, detailsModel, documentTemplates.Details, documentTemplates.Download, documentTemplates.DetailsPreload, galleryDownloader, pageDownloader, coverDownloader, metadataKeywordLists, Settings.Details.Browser, searchResultCache, cacheFileSystem);
            theme                  = new Theme();
            applicationLoader      = new ApplicationLoader();
            fullScreenRestoreState = new FullScreenRestoreState();
            mainMenuStrip          = new MainMenuStrip(Settings);
            startupSpecialHandler  = new StartupSpecialHandler(Settings.Gallery, tagsModel, metadataKeywordLists, searchHandler);
            taskbar                = new Taskbar(coverDownloader, galleryDownloader, pageDownloader, searchResultCache, cacheFileSystem);

            publicApi = new PublicApi(staticHttpClient.Client
                                      , pathFormatter
                                      , cacheFileSystem
                                      , searchResultCache
                                      , searchHandler
                                      , bookmarkPromptUtility
                                      , pluginSystem
                                      , libraryBrowserToolStrip
                                      , Settings.Library
                                      , galleryToolStrip
                                      , Settings.Gallery
                                      , Settings.Details
                                      , galleryDownloader
                                      , coverDownloader
                                      , pageDownloader
                                      , Settings.Notifications
                                      , metadataKeywordLists
                                      , Settings
                                      );

            splitContainer1 = new SplitContainerEx();
            splitContainer2 = new SplitContainerEx();
            splitContainer3 = new SplitContainerEx();

            splitContainer1.BeginInit();
            splitContainer1.Panel2.SuspendLayout();
            splitContainer1.SuspendLayout();

            splitContainer2.BeginInit();
            splitContainer2.Panel1.SuspendLayout();
            splitContainer2.SuspendLayout();

            splitContainer3.BeginInit();
            splitContainer3.SuspendLayout();

            SuspendLayout();

            //
            //
            //
            loadTimer.Interval = 100;
            loadTimer.Tick    += LoadTimer_Tick;

            //
            //
            //
            tagsTabPage.Name     = "tagsTabPage";
            tagsTabPage.TabIndex = 0;
            tagsTabPage.Tag      = "tags";
            tagsTabPage.Text     = "Tags";
            tagsTabPage.UseVisualStyleBackColor = true;

            bookmarksTabPage.Name     = "bookmarksTabPage";
            bookmarksTabPage.TabIndex = 1;
            bookmarksTabPage.Tag      = "bookmarks";
            bookmarksTabPage.Text     = "Bookmarks";
            bookmarksTabPage.UseVisualStyleBackColor = true;

            libraryTabPage.Name     = "libraryTabPage";
            libraryTabPage.TabIndex = 2;
            libraryTabPage.Tag      = "library";
            libraryTabPage.Text     = "Library";
            libraryTabPage.UseVisualStyleBackColor = true;

            browsingTabPage.Name     = "browsingTabPage";
            browsingTabPage.TabIndex = 4;
            browsingTabPage.Tag      = "browsing";
            browsingTabPage.Text     = "Browsing";
            browsingTabPage.UseVisualStyleBackColor = true;

            //
            //
            //
            listsTabControl.Dock          = DockStyle.Fill;
            listsTabControl.Name          = "treeViewTabControl";
            listsTabControl.SelectedIndex = -1;
            listsTabControl.TabIndex      = 2;
            listsTabControl.TabPages.Add(tagsTabPage);
            listsTabControl.TabPages.Add(bookmarksTabPage);
            listsTabControl.TabPages.Add(libraryTabPage);
            listsTabControl.TabPages.Add(browsingTabPage);
            listsTabControl.Selected += TreeViewTabControl_Selected;

            splitContainer3.Panel1.Controls.Add(listsTabControl);

            //
            //
            //
            tagsTreeView.Dock = DockStyle.Fill;

            //
            //
            //
            tagsToolStrip.Dock         = DockStyle.Top;
            tagsToolStrip.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            tagsToolStrip.AutoSize     = true;

            //
            //
            //
            tagsTabPage.Controls.Add(tagsTreeView);
            tagsTabPage.Controls.Add(tagsToolStrip);

            //
            //
            //
            bookmarksModel.ItemAdded   += BookmarksModel_ItemAdded;
            bookmarksModel.ItemChanged += BookmarksModel_ItemChanged;

            //
            //
            //
            bookmarksTreeView.Dock = DockStyle.Fill;

            //
            //
            //
            bookmarksToolStrip.Dock         = DockStyle.Top;
            bookmarksToolStrip.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            bookmarksToolStrip.AutoSize     = true;

            //
            //
            //
            bookmarksTabPage.Controls.Add(bookmarksTreeView);
            bookmarksTabPage.Controls.Add(bookmarksToolStrip);

            //
            //
            //
            libraryTreeView.Dock = DockStyle.Fill;

            //
            //
            //
            libraryToolStrip.Dock         = DockStyle.Top;
            libraryToolStrip.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            libraryToolStrip.AutoSize     = true;

            //
            //
            //
            libraryTabPage.Controls.Add(libraryTreeView);
            libraryTabPage.Controls.Add(libraryToolStrip);

            //
            //
            //
            browsingModel.ItemAdded   += BrowsingModel_ItemAdded;
            browsingModel.ItemChanged += BrowsingModel_ItemChanged;

            //
            //
            //
            browsingToolStrip.Dock         = DockStyle.Top;
            browsingToolStrip.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            browsingToolStrip.AutoSize     = true;

            //
            //
            //
            browsingTreeView.Dock = DockStyle.Fill;

            //
            //
            //
            browsingTabPage.Controls.Add(browsingTreeView);
            browsingTabPage.Controls.Add(browsingToolStrip);

            //
            //
            //
            galleryBrowserViewTabPage.Name     = "galleryBrowserViewTabPage";
            galleryBrowserViewTabPage.Padding  = Padding.Empty;
            galleryBrowserViewTabPage.TabIndex = 0;
            galleryBrowserViewTabPage.Text     = "Search";
            galleryBrowserViewTabPage.UseVisualStyleBackColor = true;

            //
            //
            //
            libraryBrowserViewTabPage.Name     = "libraryBrowserViewTabPage";
            libraryBrowserViewTabPage.TabIndex = 1;
            libraryBrowserViewTabPage.Text     = "Library";
            libraryBrowserViewTabPage.UseVisualStyleBackColor = true;

            //
            //
            //
            downloadsListViewTabPage.Name     = "downloadsListViewTabPage";
            downloadsListViewTabPage.TabIndex = 2;
            downloadsListViewTabPage.Text     = "Downloads";
            downloadsListViewTabPage.UseVisualStyleBackColor = true;

            //
            //
            //
            mainViewTabControl.Controls.Add(galleryBrowserViewTabPage);
            mainViewTabControl.Controls.Add(libraryBrowserViewTabPage);
            mainViewTabControl.Controls.Add(downloadsListViewTabPage);
            mainViewTabControl.Dock          = DockStyle.Fill;
            mainViewTabControl.Name          = "mainViewTabControl";
            mainViewTabControl.SelectedIndex = 0;
            mainViewTabControl.TabIndex      = 2;
            mainViewTabControl.Selected     += MainViewTabControl_Selected;

            splitContainer3.Panel2.Controls.Add(mainViewTabControl);
            splitContainer2.Panel2.Controls.Add(detailsTabControl);

            //
            // detailsTabControl
            //
            detailsTabControl.Controls.Add(detailsTabPage);
            detailsTabControl.Controls.Add(downloadTabPage);
            detailsTabControl.Dock          = DockStyle.Fill;
            detailsTabControl.Name          = "detailsTabControl";
            detailsTabControl.SelectedIndex = 0;
            detailsTabControl.TabIndex      = 2;

            //
            // detailsTabPage
            //
            detailsTabPage.Name     = "detailsTabPage";
            detailsTabPage.TabIndex = 0;
            detailsTabPage.Text     = "Details";
            detailsTabPage.UseVisualStyleBackColor = true;

            //
            // downloadTabPage
            //
            downloadTabPage.Name     = "downloadTabPage";
            downloadTabPage.TabIndex = 1;
            downloadTabPage.Text     = "Download";
            downloadTabPage.UseVisualStyleBackColor = true;

            //
            //
            //
            galleryBrowserView.Dock = DockStyle.Fill;
            galleryBrowserView.WebBrowser.ObjectForScripting = publicApi;

            //
            //
            //
            galleryToolStrip.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            galleryToolStrip.AutoSize     = true;
            galleryToolStrip.Dock         = DockStyle.Top;

            //
            //
            //
            galleryBrowserViewTabPage.Controls.Add(galleryBrowserView);
            galleryBrowserViewTabPage.Controls.Add(galleryToolStrip);

            //
            //
            //
            libraryBrowserView.Dock = DockStyle.Fill;
            libraryBrowserView.WebBrowser.ObjectForScripting = publicApi;

            //
            //
            //
            libraryBrowserToolStrip.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            libraryBrowserToolStrip.AutoSize     = true;
            libraryBrowserToolStrip.Dock         = DockStyle.Top;

            //
            //
            //
            libraryBrowserViewTabPage.Controls.Add(libraryBrowserView);
            libraryBrowserViewTabPage.Controls.Add(libraryBrowserToolStrip);

            //
            //
            //
            detailsToolStrip.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            detailsToolStrip.AutoSize     = true;
            detailsToolStrip.Dock         = DockStyle.Top;

            //
            //
            //
            detailsBrowserView.Dock = DockStyle.Fill;
            detailsBrowserView.WebBrowser.ObjectForScripting = publicApi;

            //
            //
            //
            detailsTabPage.Controls.Add(detailsBrowserView);
            detailsTabPage.Controls.Add(detailsToolStrip);

            //
            // splitContainer1
            //
            splitContainer1.Dock          = DockStyle.Fill;
            splitContainer1.FixedPanel    = FixedPanel.Panel1;
            splitContainer1.Margin        = new Padding(0);
            splitContainer1.Name          = "splitContainer1";
            splitContainer1.Orientation   = Orientation.Horizontal;
            splitContainer1.Panel1MinSize = 22;

            //
            // splitContainer1.Panel2
            //
            splitContainer1.Panel2.Controls.Add(splitContainer2);
            splitContainer1.Size              = new Size(1364, 637);
            splitContainer1.SplitterDistance  = 25;
            splitContainer1.SplitterIncrement = 22;
            splitContainer1.SplitterWidth     = 7;
            splitContainer1.TabIndex          = 2;

            //
            // splitContainer2
            //
            splitContainer2.Dock       = DockStyle.Fill;
            splitContainer2.FixedPanel = FixedPanel.Panel2;
            splitContainer2.Margin     = new Padding(0);
            splitContainer2.Name       = "splitContainer2";

            //
            // splitContainer2.Panel1
            //
            splitContainer2.Panel1.Controls.Add(splitContainer3);
            splitContainer2.Size             = new Size(1364, 605);
            splitContainer2.SplitterDistance = 1214;
            splitContainer2.SplitterWidth    = 7;
            splitContainer2.TabIndex         = 1;

            //
            // splitContainer3
            //
            splitContainer3.Dock             = DockStyle.Fill;
            splitContainer3.FixedPanel       = FixedPanel.Panel1;
            splitContainer3.Margin           = new Padding(0);
            splitContainer3.Name             = "splitContainer3";
            splitContainer3.Size             = new Size(1214, 605);
            splitContainer3.SplitterDistance = 200;
            splitContainer3.SplitterWidth    = 7;
            splitContainer3.TabIndex         = 0;

            //
            // applicationMenuStrip
            //
            mainMenuStrip.Exit               += MainMenuStrip_Exit;
            mainMenuStrip.ToggleListsPanel   += MainMenuStrip_ToggleListsPanel;
            mainMenuStrip.ToggleDetailsPanel += MainMenuStrip_ToggleDetailsPanel;
            mainMenuStrip.ToggleFullScreen   += MainMenuStrip_ToggleFullScreen;
            mainMenuStrip.ShowAbout          += MainMenuStrip_ShowAbout;
            mainMenuStrip.ShowPlugins        += MainMenuStrip_ShowPlugins;

            //
            // this
            //
            Controls.Add(splitContainer1);
            Controls.Add(mainMenuStrip);
            Controls.Add(webBrowserToolTip);
            webBrowserToolTip.BringToFront();
            MainMenuStrip = mainMenuStrip;
            Padding       = new Padding(0);
            Text          = aboutTextFormatter.Format(Settings.Window.TextFormat);
            if (Settings.Network.Offline)
            {
                Text += " [OFFLINE]";
            }
            Enabled = false;

            //
            // splash screen
            //
            if (Settings.SplashScreen.IsVisible)
            {
                startupWebBrowser      = new StartupWebBrowserView(coreTextFormatter, documentTemplates.Startup, applicationLoader);
                startupWebBrowser.Name = "startupWebBrowserView";
                startupWebBrowser.Dock = DockStyle.Fill;
                startupWebBrowser.WebBrowser.DocumentCompleted += WebBrowser_DocumentCompleted;

                Controls.Add(startupWebBrowser);
                startupWebBrowser.BringToFront();

                // avoid flickering
                listsTabControl.Visible    = false;
                mainViewTabControl.Visible = false;
                detailsTabControl.Visible  = false;
            }

            backgroundTaskWorker.ProgressChanged += TaskBackgroundWorker_ProgressChanged;

            pageDownloader.PagesDownloadCompleted += PageDownloader_PagesDownloadCompleted;

            ReadTheme();
            ApplyTheme();
            ApplyVisualStyles();

            splitContainer1.Panel2.ResumeLayout(false);
            splitContainer1.EndInit();
            splitContainer1.ResumeLayout(false);

            splitContainer2.Panel1.ResumeLayout(false);
            splitContainer2.EndInit();
            splitContainer2.ResumeLayout(false);

            splitContainer3.EndInit();
            splitContainer3.ResumeLayout(false);

            ResumeLayout(false);
            PerformLayout();
        }