Esempio n. 1
0
        public override bool Initialize(IPluginHost host)
        {
            if (host == null)
            {
                return(false);
            }

            _host = host;

            _options        = new KeeThemeOptions(host);
            _controlVisitor = new ControlVisitor(HandleControlVisit);
            _theme          = new KeeTheme();

            _win10ThemeMonitor = new Win10ThemeMonitor(_options);
            _win10ThemeMonitor.Initialize();

            if (Program.TriggerSystem.Enabled)
            {
                // It's better to enable theme as late as possible, but not too late
                Program.TriggerSystem.RaisingEvent += HandleTriggerSystemRaisingEvent;
            }
            else
            {
                InitializeTheme();
            }

            GlobalWindowManager.WindowAdded += HandleGlobalWindowManagerWindowAdded;

            return(true);
        }
Esempio n. 2
0
 private void ApplyThemeInOpenForms()
 {
     foreach (Form openForm in Application.OpenForms)
     {
         Win10ThemeMonitor.UseImmersiveDarkMode(openForm, _theme.Enabled);
         _controlVisitor.Visit(openForm);
     }
     Program.MainForm.RefreshEntriesList();
 }
Esempio n. 3
0
        private void HandleGlobalWindowManagerWindowAdded(object sender, GwmWindowEventArgs e)
        {
            if (_theme.Enabled)
            {
                _controlVisitor.Visit(e.Form);
            }

            Win10ThemeMonitor.UseImmersiveDarkMode(e.Form, _theme.Enabled);

            var optionsForm = e.Form as OptionsForm;

            if (optionsForm != null)
            {
                optionsForm.Shown += HandleOptionsFormShown;
            }
        }