Example #1
0
        private void load(object sender, EventArgs e)
        {
            updateDownloadButton();
            updateDeckButtons();

            System.Windows.Forms.Application.AddMessageFilter(this);
            CardSuggestModel.StartSuggestThread();
            DeckSuggestModel.StartSuggestThread();
        }
Example #2
0
        private void load(object sender, EventArgs e)
        {
            updateDownloadButton();
            updateDeckButtons();

            CardSuggestModel.StartSuggestThread();
            DeckSuggestModel.StartSuggestThread();

            if (SelectedTab != null)
            {
                SelectedTab.Focus();
                SelectedTab.FocusSearch();
            }
        }
Example #3
0
        public FormRoot(Func <FormMain> formMainFactory,
                        DownloaderSubsystem downloaderSubsystem,
                        NewsService newsService,
                        CardSuggestModel cardSuggestModel,
                        DeckSuggestModel deckSuggestModel,
                        [Named(GuiModule.DefaultTooltipScope)] TooltipController tooltipController,
                        [Named(GuiModule.QuickFilterTooltipScope)] TooltipController quickFilterTooltipController,
                        CardRepository repo,
                        DeckSerializationSubsystem serialization,
                        UiModel uiModel,
                        ColorSchemeEditor colorSchemeEditor,
                        App app,
                        AppSourceConfig appSourceConfig,
                        UiConfigRepository uiConfigRepository)
            : this()
        {
            TooltipController            = tooltipController;
            QuickFilterTooltipController = quickFilterTooltipController;

            UiModel = uiModel;

            DeckSuggestModel = deckSuggestModel;

            CardSuggestModel    = cardSuggestModel;
            CardSuggestModel.Ui = UiModel;

            _app                = app;
            _appSourceConfig    = appSourceConfig;
            _uiConfigRepository = uiConfigRepository;
            _repo               = repo;
            _serialization      = serialization;
            _colorSchemeEditor  = colorSchemeEditor;

            _formMainFactory     = formMainFactory;
            _downloaderSubsystem = downloaderSubsystem;
            _newsService         = newsService;

            KeyPreview      = true;
            PreviewKeyDown += previewKeyDown;
            KeyDown        += formKeyDown;

            QueryHandleDrag += queryHandleDrag;
            Load            += load;
            Closed          += closed;

            _tabs.AllowDrop              = true;
            _tabs.TabAdded              += tabCreated;
            _tabs.TabRemoving           += tabClosing;
            _tabs.TabRemoved            += tabClosed;
            _tabs.SelectedIndexChanging += selectedTabChanging;
            _tabs.SelectedIndexChanged  += selectedTabChanged;
            _tabs.DragOver              += tabsDragOver;

            _tabs.MouseEnter += tabMouseEnter;
            _tabs.MouseEnter += tabMouseLeave;
            _tabs.MouseMove  += tabMouseMove;

            MessageFilter.Instance.GlobalMouseMove += globalMouseMove;
            FormClosing += formClosing;

            _newsService.NewsFetched   += newsFetched;
            _newsService.NewsDisplayed += newsDisplayed;
            _downloaderSubsystem.ProgressCalculated += downloaderProgressCalculated;

            setupExternalLinks();
            setupButtonClicks();
            setupLanguageMenu();

            setupTooltips();

            foreach (var button in _deckButtons)
            {
                button.Enabled = false;
            }

            Text = $"Mtgdb.Gui v{AppDir.GetVersion()}";

            scale();
            updateFormBorderColor();
            ColorSchemeController.SystemColorsChanging += updateFormBorderColor;

            _menuColors.BackColor = SystemColors.Control;
            _menuColors.ForeColor = SystemColors.ControlText;

            if (components == null)
            {
                components = new Container();
            }

            components.Add(new UiConfigMenuSubsystem(
                               _menuUiScale,
                               _menuUiSmallImageQuality,
                               _menuUiSuggestDownloadMissingImages,
                               _menuUiImagesCacheCapacity,
                               _menuUiUndoDepth,
                               _menuUiApplySearchBar,
                               _checkboxAllPanels,
                               _checkboxTopPanel, _checkboxRightPanel, _checkboxSearchBar, _repo, uiConfigRepository));

            _dropdownOpenDeck.BeforeShow    = () => setMenuMode(_dropdownOpenDeck);
            _dropdownSaveDeck.BeforeShow    = () => setMenuMode(_dropdownSaveDeck);
            _dropdownColorScheme.BeforeShow = updateMenuColors;

            _ctsLifetime = new CancellationTokenSource();
            _ctsLifetime.Token.When(_repo.IsLoadingComplete).Run(repositoryLoaded);
        }
Example #4
0
 private void closed(object sender, EventArgs e)
 {
     CardSuggestModel.AbortSuggestThread();
     DeckSuggestModel.AbortSuggestThread();
 }
Example #5
0
 private void closed(object sender, EventArgs e)
 {
     unsubscribeButtonEvents();
     CardSuggestModel.AbortSuggestThread();
     DeckSuggestModel.AbortSuggestThread();
 }
Example #6
0
        public FormRoot(Func <FormMain> formMainFactory,
                        DownloaderSubsystem downloaderSubsystem,
                        NewsService newsService,
                        CardSuggestModel cardSuggestModel,
                        DeckSuggestModel deckSuggestModel,
                        TooltipController tooltipController,
                        CardRepository repo,
                        DeckSerializationSubsystem serialization,
                        UiModel uiModel,
                        Application application)
            : this()
        {
            TooltipController = tooltipController;
            UiModel           = uiModel;

            DeckSuggestModel = deckSuggestModel;

            CardSuggestModel    = cardSuggestModel;
            CardSuggestModel.Ui = UiModel;

            _application         = application;
            _repo                = repo;
            _serialization       = serialization;
            _buttonSubsystem     = new ButtonSubsystem();
            _formMainFactory     = formMainFactory;
            _downloaderSubsystem = downloaderSubsystem;
            _newsService         = newsService;

            KeyPreview      = true;
            PreviewKeyDown += previewKeyDown;
            KeyDown        += formKeyDown;

            _repo.LoadingComplete += repositoryLoaded;

            QueryHandleDrag += queryHandleDrag;
            Load            += load;
            Closed          += closed;

            _tabs.AllowDrop              = true;
            _tabs.AddNewTabsToTheLeft    = true;
            _tabs.TabAdded              += tabCreated;
            _tabs.TabRemoving           += tabClosing;
            _tabs.TabRemoved            += tabClosed;
            _tabs.SelectedIndexChanging += selectedTabChanging;
            _tabs.SelectedIndexChanged  += selectedTabChanged;
            _tabs.DragOver              += tabsDragOver;
            _tabs.MouseMove             += tabMouseMove;

            FormClosing += formClosing;

            _newsService.NewsFetched   += newsFetched;
            _newsService.NewsDisplayed += newsDisplayed;
            _downloaderSubsystem.ProgressCalculated += downloaderProgressCalculated;

            setupButtons();

            setupExternalLinks();
            setupButtonClicks();
            setupLanguageMenu();
            setupTooltips();

            if (!DesignMode)
            {
                SnapTo(Direction.North, default(Point));
            }

            foreach (var button in _deckButtons)
            {
                button.Enabled = false;
            }

            Text = $"Mtgdb.Gui v{AppDir.GetVersion()}";

            WindowState = FormWindowState.Minimized;
        }