public override void Terminate()
        {
            if (_host == null)
            {
                return;
            }

            GlobalWindowManager.WindowAdded -= OnWindowAdded;
            _host.MainWindow.FileClosingPre -= OnPreFileClosing;

            _keyManagerProvider.Dispose();
            _keyManagerProvider = null;

            _host = null;
        }
        public override bool Initialize(IPluginHost host)
        {
            if (_host != null)
            {
                Debug.Assert(false); Terminate();
            }
            if (host == null)
            {
                return(false);
            }

            Settings.Instance.Initialize(host.CustomConfig);

            _host = host;
            _keyManagerProvider = new KeyManagerProvider(host);

            _host.MainWindow.FileClosingPre += OnPreFileClosing;
            GlobalWindowManager.WindowAdded += OnWindowAdded;

            return(true);
        }