private void ControllerOnShortcutChanged(bool fromView, PluginShortcut shortcut, Keys key)
        {
            var str = ShortkeyUtils.KeyToString(key);

            switch (shortcut)
            {
            case PluginShortcut.HideOverlay:
                buttonShortcutHide.Text = str;
                break;
            }
        }
        private void buttonShortcutHide_Click(object sender, EventArgs e)
        {
            var dialog = new ShortcutDialog
            {
                CurrentKey = ShortkeyUtils.StringToKey(_plugin.Settings.ShortcutHide)
            };
            var result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                var key = dialog.CurrentKey;

                _controller.NotifyShortcutChanged(true, PluginShortcut.HideOverlay, key);
            }
        }
        private void ControllerOnShortcutChanged(bool fromView, PluginShortcut shortcut, Keys key)
        {
            if (!fromView)
            {
                return;
            }

            var ks = ShortkeyUtils.KeyToString(key);

            switch (shortcut)
            {
            case PluginShortcut.HideOverlay:
                ShortcutHide = ks;
                break;
            }
        }
Example #4
0
        public void NotifySettingsLoaded()
        {
            try
            {
                _controller.NotifyOverlayFontChanged(false,
                                                     (Font)TypeDescriptor.GetConverter(typeof(Font)).ConvertFromString(OverlayFont));
            }
            catch (Exception)
            {
                _controller.NotifyOverlayFontChanged(true, new Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular));
            }

            _controller.NotifyShortcutChanged(false, PluginShortcut.HideOverlay, ShortkeyUtils.StringToKey(ShortcutHide));

            _controller.NotifySettingsLoaded();
        }
        public void NotifySettingsLoaded()
        {
            try
            {
                _controller.NotifyOverlayFontChanged(false,
                                                     (Font)TypeDescriptor.GetConverter(typeof(Font)).ConvertFromString(OverlayFont));
            }
            catch (Exception)
            {
                _controller.NotifyOverlayFontChanged(true, new Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular));
            }

            _controller.NotifyTranslateProviderChanged(false, TranslateProvider, TranslateApiKey, TranslateLangFrom, TranslateLangTo);
            _controller.NotifyProxyChanged(false, ProxyType, ProxyServer, ProxyPort, ProxyUser, ProxyPassword, ProxyDomain);
            _controller.NotifyShortcutChanged(false, PluginShortcut.HideOverlay, ShortkeyUtils.StringToKey(ShortcutHide));

            _controller.NotifySettingsLoaded();
        }