Example #1
0
        public PresenterMin(
            IViewMin viewMin,
            IViewMain viewMain,
            IResourcesService resources)
        {
            _viewMin   = viewMin;
            _viewMain  = viewMain;
            _resources = resources;

            //set initial form settings
            if (_viewMin != null)
            {
                _viewMin.VisibilityFormIcon1(false);
                _viewMin.VisibilityFormIcon2(false);
                _viewMin.StartPosition = FormStartPosition.Manual;
                if (_resources != null)
                {
                    _viewMin.SetImageFormIcon3(_resources.Closed);
                }
                _viewMin.FormResizable    = false;
                _viewMin.FormMovable      = false;
                _viewMin.SnapToScreenEdge = false;

                //subscribe to events
                _viewMin.VisibleChanged          += OnVisibleChanged;
                _viewMin.MouseEntersFormIcon3    += OnMouseEntersFormIcon3;
                _viewMin.MouseLeavesFormIcon3    += OnMouseLeavesFormIcon3;
                _viewMin.MouseClicksFormIcon3    += OnMouseClicksFormIcon3;
                _viewMin.MouseEnterLabelTitleTop += OnMouseEnterLabelTitleTop;
            }

            _clipboard         = new Clipboard();
            Clipboard.Changed += Clipboard_Changed;
        }
Example #2
0
        public PresenterMain(
            IViewMain viewMain,
            IViewMin viewMin,
            IViewUserSettings viewUserSettings,
            IViewAbout viewAbout,
            ISettingsService settings,
            IResourcesService resources,
            IViewMainSplContPanelUpTabs viewMainSplContPanelUp,
            IViewUserSettingsButtonsDown viewUserSettingsButtonsDown,
            Pasting pasting
            )
        {
            _view                        = viewMain;
            _viewMin                     = viewMin;
            _viewAbout                   = viewAbout;
            _settings                    = settings;
            _resources                   = resources;
            _viewUserSettings            = viewUserSettings;
            _viewMainSplContPanelUp      = viewMainSplContPanelUp;
            _viewUserSettingsButtonsDown = viewUserSettingsButtonsDown;
            _pasting                     = pasting;

            //set initial form settings
            if (_settings != null)
            {
                if (_view != null)
                {
                    _view.Size          = _settings.SizeMain;
                    _view.StartPosition = FormStartPosition.Manual;
                    _view.Location      = _settings.Location;
                }
            }

            if (settings != null && settings.Activated)
            {
                if (_resources != null)
                {
                    _view?.SetNotifyIconImage(IsWindowsLightThemeActive()
                        ? _resources.ActivatedForLightTheme
                        : _resources.ActivatedForDarkTheme);
                }
            }
            else
            {
                if (_resources != null)
                {
                    _view?.SetNotifyIconImage(IsWindowsLightThemeActive()
                        ? _resources.DeactivatedForLightTheme
                        : _resources.DeactivatedForDarkTheme);
                }
            }

            if (_view == null)
            {
                return;
            }
            _view.SetNotifyIconVisible(true);
            if (_resources != null)
            {
                _view.SetImageFormIcon1(settings != null && settings.Locked ? _resources.Locked : _resources.Unlocked);
                _view.SetImageFormIcon2(_resources.MinimizeUnselected);
                _view.SetImageFormIcon3(_resources.Closed);
            }

            //subscribe to events
            _view.Load += OnLoadView;
        }