internal void RegisterHotKey(string hotKeyString)
        {
            KeyboardHookModifierKeys modifiers = KeyboardHookModifierKeys.None;
            string modifiersString             = Properties.Settings.Default.HotKey;

            if (!string.IsNullOrEmpty(modifiersString))
            {
                if (modifiersString.ToLower().Contains("alt"))
                {
                    modifiers |= KeyboardHookModifierKeys.Alt;
                }
                if (modifiersString.ToLower().Contains("ctrl"))
                {
                    modifiers |= KeyboardHookModifierKeys.Control;
                }
                if (modifiersString.ToLower().Contains("shift"))
                {
                    modifiers |= KeyboardHookModifierKeys.Shift;
                }
                if (modifiersString.ToLower().Contains("win"))
                {
                    modifiers |= KeyboardHookModifierKeys.Win;
                }
            }

            RegisterHotKey(modifiers,
                           HotkeyControl.HotkeyFromString(
                               Properties.Settings.Default.HotKey));
        }
        internal void RegisterHotKey()
        {
            KeyboardHookModifierKeys modifiers = KeyboardHookModifierKeys.None;
            string modifiersString             = Properties.Settings.Default.HotKey;

            if (!string.IsNullOrEmpty(modifiersString))
            {
                if (modifiersString.ToUpperInvariant().Contains("ALT", StringComparison.InvariantCulture))
                {
                    modifiers |= KeyboardHookModifierKeys.Alt;
                }

                if (modifiersString.ToUpperInvariant().Contains("CTRL", StringComparison.InvariantCulture) ||
                    modifiersString.ToUpperInvariant().Contains("STRG", StringComparison.InvariantCulture))
                {
                    modifiers |= KeyboardHookModifierKeys.Control;
                }

                if (modifiersString.ToUpperInvariant().Contains("SHIFT", StringComparison.InvariantCulture))
                {
                    modifiers |= KeyboardHookModifierKeys.Shift;
                }

                if (modifiersString.ToUpperInvariant().Contains("WIN", StringComparison.InvariantCulture))
                {
                    modifiers |= KeyboardHookModifierKeys.Win;
                }
            }

            RegisterHotKey(
                modifiers,
                HotkeyControl.HotkeyFromString(
                    Properties.Settings.Default.HotKey));
        }
        ///// <summary>
        ///// Check if OneDrive is blocking hotkeys
        ///// </summary>
        ///// <returns>true if onedrive has hotkeys turned on</returns>
        //private static bool IsOneDriveBlockingHotkey()
        //{
        //    if (!Environment.OSVersion.IsWindows10())
        //    {
        //        return false;
        //    }
        //    var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
        //    var oneDriveSettingsPath = Path.Combine(localAppData, @"Microsoft\OneDrive\settings\Personal");
        //    if (!Directory.Exists(oneDriveSettingsPath))
        //    {
        //        return false;
        //    }
        //    var oneDriveSettingsFile = Directory.GetFiles(oneDriveSettingsPath, "*_screenshot.dat").FirstOrDefault();
        //    if (!File.Exists(oneDriveSettingsFile))
        //    {
        //        return false;
        //    }
        //    var screenshotSetting = File.ReadAllLines(oneDriveSettingsFile).Skip(1).Take(1).First();
        //    return "2".Equals(screenshotSetting);
        //}

        /// <summary>
        /// Displays a dialog for the user to choose how to handle hotkey registration failures:
        /// retry (allowing to shut down the conflicting application before),
        /// ignore (not registering the conflicting hotkey and resetting the respective config to "None", i.e. not trying to register it again on next startup)
        /// abort (do nothing about it)
        /// </summary>
        /// <param name="failedKeys">comma separated list of the hotkeys that could not be registered, for display in dialog text</param>
        /// <returns></returns>
        private static bool HandleFailedHotkeyRegistration(string failedKeys)
        {
            bool success = false;

#warning todo
            //var warningTitle = Language.GetString(LangKey.warning);
            string warningTitle = "Warning";
            //var message = string.Format(Language.GetString(LangKey.warning_hotkeys), failedKeys, IsOneDriveBlockingHotkey() ? " (OneDrive)" : "");
            string message = Translator.GetText("Could not register the hot key.");
            //DialogResult dr = MessageBox.Show(Instance, message, warningTitle, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation);
            DialogResult dr = MessageBox.Show(message, warningTitle, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation);
            if (dr == DialogResult.Retry)
            {
                //LOG.DebugFormat("Re-trying to register hotkeys");
                HotkeyControl.UnregisterHotkeys();
                success = RegisterHotkeys(false);
            }
            else if (dr == DialogResult.Ignore)
            {
                //LOG.DebugFormat("Ignoring failed hotkey registration");
                HotkeyControl.UnregisterHotkeys();
                success = RegisterHotkeys(true);
            }
            return(success);
        }
Example #4
0
        /// <summary>
        ///     Helper method to cleanly register a hotkey
        /// </summary>
        /// <param name="failedKeys"></param>
        /// <param name="functionName"></param>
        /// <param name="hotkeyString"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        private static bool RegisterHotkey(StringBuilder failedKeys, string functionName, string hotkeyString, HotKeyHandler handler)
        {
            var modifierKeyCode = HotkeyControl.HotkeyModifiersFromString(hotkeyString);
            var virtualKeyCode  = HotkeyControl.HotkeyFromString(hotkeyString);

            if (!Keys.None.Equals(virtualKeyCode))
            {
                if (HotkeyControl.RegisterHotKey(modifierKeyCode, virtualKeyCode, handler) < 0)
                {
                    Log.Debug().WriteLine("Failed to register {0} to hotkey: {1}", functionName, hotkeyString);
                    if (failedKeys.Length > 0)
                    {
                        failedKeys.Append(", ");
                    }
                    failedKeys.Append(hotkeyString);
                    return(false);
                }
                Log.Debug().WriteLine("Registered {0} to hotkey: {1}", functionName, hotkeyString);
            }
            else
            {
                Log.Info().WriteLine("Skipping hotkey registration for {0}, no hotkey set!", functionName);
            }
            return(true);
        }
        /// <summary>
        /// Helper method to cleanly register a hotkey
        /// </summary>
        /// <param name="failedKeys"></param>
        /// <param name="functionName"></param>
        /// <param name="hotkeyString"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        private static bool RegisterHotkey(StringBuilder failedKeys, string hotkeyString, HotKeyHandler handler)
        {
            Keys modifierKeyCode = HotkeyControl.HotkeyModifiersFromString(hotkeyString);
            Keys virtualKeyCode  = HotkeyControl.HotkeyFromString(hotkeyString);

            if (!Keys.None.Equals(virtualKeyCode))
            {
                if (HotkeyControl.RegisterHotKey(modifierKeyCode, virtualKeyCode, handler) < 0)
                {
#warning logging
                    //LOG.DebugFormat("Failed to register {0} to hotkey: {1}", functionName, hotkeyString);
                    if (failedKeys.Length > 0)
                    {
                        failedKeys.Append(", ");
                    }
                    failedKeys.Append(hotkeyString);
                    return(false);
                }
#warning logging
                //LOG.DebugFormat("Registered {0} to hotkey: {1}", functionName, hotkeyString);
            }
            else
            {
#warning logging
                //LOG.InfoFormat("Skipping hotkey registration for {0}, no hotkey set!", functionName);
            }
            return(true);
        }
Example #6
0
        public void UpdateUI()
        {
            this.Text = lang.GetString(LangKey.application_title);
            this.contextmenu_settings.Text          = lang.GetString(LangKey.contextmenu_settings);
            this.contextmenu_capturearea.Text       = lang.GetString(LangKey.contextmenu_capturearea);
            this.contextmenu_capturelastregion.Text = lang.GetString(LangKey.contextmenu_capturelastregion);
            this.contextmenu_capturewindow.Text     = lang.GetString(LangKey.contextmenu_capturewindow);
            this.contextmenu_capturefullscreen.Text = lang.GetString(LangKey.contextmenu_capturefullscreen);
            this.contextmenu_captureclipboard.Text  = lang.GetString(LangKey.contextmenu_captureclipboard);
            this.contextmenu_openfile.Text          = lang.GetString(LangKey.contextmenu_openfile);
            this.contextmenu_quicksettings.Text     = lang.GetString(LangKey.contextmenu_quicksettings);
            this.contextmenu_help.Text              = lang.GetString(LangKey.contextmenu_help);
            this.contextmenu_about.Text             = lang.GetString(LangKey.contextmenu_about);
            this.contextmenu_donate.Text            = lang.GetString(LangKey.contextmenu_donate);
            this.contextmenu_exit.Text              = lang.GetString(LangKey.contextmenu_exit);
            this.contextmenu_captureie.Text         = lang.GetString(LangKey.contextmenu_captureie);
            this.contextmenu_openrecentcapture.Text = lang.GetString(LangKey.contextmenu_openrecentcapture);

            // Show hotkeys in Contextmenu
            this.contextmenu_capturearea.ShortcutKeyDisplayString       = HotkeyControl.GetLocalizedHotkeyStringFromString(conf.RegionHotkey);
            this.contextmenu_capturelastregion.ShortcutKeyDisplayString = HotkeyControl.GetLocalizedHotkeyStringFromString(conf.LastregionHotkey);
            this.contextmenu_capturewindow.ShortcutKeyDisplayString     = HotkeyControl.GetLocalizedHotkeyStringFromString(conf.WindowHotkey);
            this.contextmenu_capturefullscreen.ShortcutKeyDisplayString = HotkeyControl.GetLocalizedHotkeyStringFromString(conf.FullscreenHotkey);
            this.contextmenu_captureie.ShortcutKeyDisplayString         = HotkeyControl.GetLocalizedHotkeyStringFromString(conf.IEHotkey);
        }
Example #7
0
        public void Start()
        {
            Log.Debug().WriteLine("Registering hotkeys");
            // Make sure all hotkeys pass this window!
            HotkeyControl.RegisterHotkeyHwnd(_windowHandle.Handle);

            RegisterHotkeys(false);

            Log.Debug().WriteLine("Started hotkeys");
        }
Example #8
0
        public void UpdateUi()
        {
            // As the form is never loaded, call ApplyLanguage ourselves
            ApplyLanguage();

            // Show hotkeys in Contextmenu
            contextmenu_capturearea.ShortcutKeyDisplayString       = HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.RegionHotkey);
            contextmenu_capturelastregion.ShortcutKeyDisplayString = HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.LastregionHotkey);
            contextmenu_capturewindow.ShortcutKeyDisplayString     = HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.WindowHotkey);
            contextmenu_capturefullscreen.ShortcutKeyDisplayString = HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.FullscreenHotkey);
            contextmenu_captureie.ShortcutKeyDisplayString         = HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.IEHotkey);
        }
Example #9
0
 protected override void WndProc(ref Message m)
 {
     if (ClipboardHelper.HandleClipboardMessages(ref m))
     {
         return;
     }
     if (HotkeyControl.HandleMessages(ref m))
     {
         return;
     }
     base.WndProc(ref m);
 }
Example #10
0
        private IEnumerator <object> ReadHotkeyPreference(string hotkeyName, HotkeyControl hotkeyControl)
        {
            Future <string> f;

            yield return(DB.GetPreference("Hotkeys." + hotkeyName + ".Key").Run(out f));

            hotkeyControl.Hotkey = (Keys)Enum.Parse(typeof(Keys), f.Result ?? "None", true);

            yield return(DB.GetPreference("Hotkeys." + hotkeyName + ".Modifiers").Run(out f));

            hotkeyControl.HotkeyModifiers = (Keys)Enum.Parse(typeof(Keys), f.Result ?? "None", true);
        }
Example #11
0
 protected override void WndProc(ref Message m)
 {
     if (HotkeyControl.HandleMessages(ref m))
     {
         return;
     }
     // BUG-1809 prevention, filter the InputLangChange messages
     if (WmInputLangChangeRequestFilter.PreFilterMessageExternal(ref m))
     {
         return;
     }
     base.WndProc(ref m);
 }
Example #12
0
 private void ReloadConfiguration(object source, FileSystemEventArgs e)
 {
     lang.SetLanguage(conf.Language);
     this.Invoke((MethodInvoker) delegate
     {
         // Even update language when needed
         UpdateUI();
         // Update the hotkey
         // Make sure the current hotkeys are disabled
         HotkeyControl.UnregisterHotkeys();
         RegisterHotkeys();
     });
 }
Example #13
0
        public void Shutdown()
        {
            Log.Debug().WriteLine("Stopping hotkeys");

            // Make sure hotkeys are disabled
            try
            {
                HotkeyControl.UnregisterHotkeys();
            }
            catch (Exception e)
            {
                Log.Error().WriteLine(e, "Error unregistering hotkeys!");
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.ExtraData is Settings settings)
            {
                Settings = settings;
            }
            else
            {
                throw new ArgumentException("Unexpected Parameter setting.");
            }

            InitializeComponent();
            tbMsgTextOriginal            = HotkeyControl.tbMsg.Text;
            tbMsgForegroundColorOriginal = HotkeyControl.tbMsg.Foreground;

            HotkeyControl.SetHotkey(new Infrastructure.Hotkey.HotkeyModel(Settings.Hotkey), false);
        }
Example #15
0
        private void Settings_okayClick(object sender, EventArgs e)
        {
            if (CheckSettings())
            {
                HotkeyControl.UnregisterHotkeys();
                SaveSettings();
                StoreFields();
                MainForm.RegisterHotkeys();

                // Make sure the current language & settings are reflected in the Main-context menu
                MainForm.Instance.UpdateUi();
                DialogResult = DialogResult.OK;
            }
            else
            {
                tabcontrol.SelectTab(tab_output);
            }
        }
Example #16
0
        public MainForm(CopyDataTransport dataTransport)
        {
            instance = this;
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            lang = Language.GetInstance();
            IniConfig.IniChanged += new FileSystemEventHandler(ReloadConfiguration);

            // Make sure all hotkeys pass this window!
            HotkeyControl.RegisterHotkeyHWND(this.Handle);
            RegisterHotkeys();

            tooltip = new ToolTip();

            UpdateUI();
            InitializeQuickSettingsMenu();

            captureForm = new CaptureForm();

            // Load all the plugins
            PluginHelper.instance.LoadPlugins(this, captureForm);
            SoundHelper.Initialize();

            // Enable the Greenshot icon to be visible, this prevents Problems with the context menu
            notifyIcon.Visible = true;

            // Create a new instance of the class: copyData = new CopyData();
            copyData = new CopyData();

            // Assign the handle:
            copyData.AssignHandle(this.Handle);
            // Create the channel to send on:
            copyData.Channels.Add("Greenshot");
            // Hook up received event:
            copyData.CopyDataReceived += new CopyDataReceivedEventHandler(CopyDataDataReceived);

            if (dataTransport != null)
            {
                HandleDataTransport(dataTransport);
            }
            ClipboardHelper.RegisterClipboardViewer(this.Handle);
        }
Example #17
0
        /// <summary>
        ///     Displays a dialog for the user to choose how to handle hotkey registration failures:
        ///     retry (allowing to shut down the conflicting application before),
        ///     ignore (not registering the conflicting hotkey and resetting the respective config to "None", i.e. not trying to
        ///     register it again on next startup)
        ///     abort (do nothing about it)
        /// </summary>
        /// <param name="failedKeys">comma separated list of the hotkeys that could not be registered, for display in dialog text</param>
        /// <returns></returns>
        private bool HandleFailedHotkeyRegistration(string failedKeys)
        {
            var success      = false;
            var warningTitle = Language.GetString(LangKey.warning);
            var message      = string.Format(Language.GetString(LangKey.warning_hotkeys), failedKeys, IsOneDriveBlockingHotkey() ? " (OneDrive)" : "");
            var dr           = MessageBox.Show(MainForm.Instance, message, warningTitle, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation);

            if (dr == DialogResult.Retry)
            {
                Log.Debug().WriteLine("Re-trying to register hotkeys");
                HotkeyControl.UnregisterHotkeys();
                success = RegisterHotkeys(false);
            }
            else if (dr == DialogResult.Ignore)
            {
                Log.Debug().WriteLine("Ignoring failed hotkey registration");
                HotkeyControl.UnregisterHotkeys();
                success = RegisterHotkeys(true);
            }
            return(success);
        }
Example #18
0
        /// <summary>
        /// Helper method to cleanly register a hotkey.
        /// </summary>
        /// <param name="failedKeys">failedKeys.</param>
        /// <param name="hotkeyString">hotkeyString.</param>
        /// <param name="handler">handler.</param>
        /// <returns>bool success.</returns>
        private static bool RegisterHotkey(StringBuilder failedKeys, string hotkeyString, HotKeyHandler handler)
        {
            Keys modifierKeyCode = HotkeyControl.HotkeyModifiersFromString(hotkeyString);
            Keys virtualKeyCode  = HotkeyControl.HotkeyFromString(hotkeyString);

            if (!Keys.None.Equals(virtualKeyCode))
            {
                if (HotkeyControl.RegisterHotKey(modifierKeyCode, virtualKeyCode, handler) < 0)
                {
                    if (failedKeys.Length > 0)
                    {
                        failedKeys.Append(", ");
                    }

                    failedKeys.Append(hotkeyString);
                    return(false);
                }
            }

            return(true);
        }
Example #19
0
        ///// <summary>
        ///// Check if OneDrive is blocking hotkeys
        ///// </summary>
        ///// <returns>true if onedrive has hotkeys turned on</returns>
        // private static bool IsOneDriveBlockingHotkey()
        // {
        //    if (!Environment.OSVersion.IsWindows10())
        //    {
        //        return false;
        //    }
        //    var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
        //    var oneDriveSettingsPath = Path.Combine(localAppData, @"Microsoft\OneDrive\settings\Personal");
        //    if (!Directory.Exists(oneDriveSettingsPath))
        //    {
        //        return false;
        //    }
        //    var oneDriveSettingsFile = Directory.GetFiles(oneDriveSettingsPath, "*_screenshot.dat").FirstOrDefault();
        //    if (!File.Exists(oneDriveSettingsFile))
        //    {
        //        return false;
        //    }
        //    var screenshotSetting = File.ReadAllLines(oneDriveSettingsFile).Skip(1).Take(1).First();
        //    return "2".Equals(screenshotSetting);
        // }

        /// <summary>
        /// Displays a dialog for the user to choose how to handle hotkey registration failures:
        /// retry (allowing to shut down the conflicting application before),
        /// ignore (not registering the conflicting hotkey and resetting the respective config to "None", i.e. not trying to register it again on next startup)
        /// abort (do nothing about it).
        /// </summary>
        /// <param name="failedKeys">comma separated list of the hotkeys that could not be registered, for display in dialog text.</param>
        /// <returns>bool success.</returns>
        private static bool HandleFailedHotkeyRegistration(string failedKeys)
        {
            bool         success      = false;
            string       warningTitle = Translator.GetText("Warning");
            string       message      = Translator.GetText("Could not register the hot key.") + failedKeys;
            DialogResult dr           = MessageBox.Show(message, warningTitle, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation);

            if (dr == DialogResult.Retry)
            {
                // LOG.DebugFormat("Re-trying to register hotkeys");
                HotkeyControl.UnregisterHotkeys();
                success = RegisterHotkeys(false);
            }
            else if (dr == DialogResult.Ignore)
            {
                // LOG.DebugFormat("Ignoring failed hotkey registration");
                HotkeyControl.UnregisterHotkeys();
                success = RegisterHotkeys(true);
            }

            return(success);
        }
Example #20
0
        public HelperForm()
        {
            InitializeComponent();

            memory         = new CrashMemory();
            dataControl    = new DataControl(memory);
            hotkeyControl  = new HotkeyControl(memory, dataControl);
            processControl = new ProcessControl(memory, dataControl, hotkeyControl, this);

            flowLayoutPanel.Controls.Add(processControl);
            flowLayoutPanel.Controls.Add(dataControl);
            flowLayoutPanel.Controls.Add(hotkeyControl);
            flowLayoutPanel.Height--;

            refreshTimer = new Timer
            {
                Interval = (int)(1000f / Framerate),
            };

            refreshTimer.Tick += (sender, e) => { RefreshHelper(); };
            processControl.Rescan();
        }
Example #21
0
        /// <inheritdoc />
        public void ReloadConfig()
        {
            Log.Info().WriteLine("Reload requested");
            try
            {
                IniConfig.Current?.ReloadAsync().Wait();
                _mainForm.Invoke((MethodInvoker)(() =>
                {
                    // Even update language when needed, this should be done automatically :)
                    _mainForm.UpdateUi();

                    // Make sure the current hotkeys are disabled
                    HotkeyControl.UnregisterHotkeys();
                    // and registered again (should be automated)
                    _hotkeyHandler.RegisterHotkeys(true);
                }));
            }
            catch (Exception ex)
            {
                Log.Warn().WriteLine(ex, "Exception while reloading configuration: ");
            }
        }
Example #22
0
        /// <summary>
        ///     Displays a dialog for the user to choose how to handle hotkey registration failures:
        ///     retry (allowing to shut down the conflicting application before),
        ///     ignore (not registering the conflicting hotkey and resetting the respective config to "None", i.e. not trying to
        ///     register it again on next startup)
        ///     abort (do nothing about it)
        /// </summary>
        /// <param name="failedKeys">comma separated list of the hotkeys that could not be registered, for display in dialog text</param>
        /// <returns></returns>
        private bool HandleFailedHotkeyRegistration(string failedKeys)
        {
            var success      = false;
            var warningTitle = _greenshotLanguage.Warning;
            var message      = string.Format(_greenshotLanguage.WarningHotkeys, failedKeys, IsOneDriveBlockingHotkey() ? " (OneDrive)" : "");
            var dialogResult = MessageBox.Show(MainForm.Instance, message, warningTitle, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation);

            switch (dialogResult)
            {
            case DialogResult.Retry:
                Log.Debug().WriteLine("Re-trying to register hotkeys");
                HotkeyControl.UnregisterHotkeys();
                success = RegisterHotkeys(false);
                break;

            case DialogResult.Ignore:
                Log.Debug().WriteLine("Ignoring failed hotkey registration");
                HotkeyControl.UnregisterHotkeys();
                success = RegisterHotkeys(true);
                break;
            }
            return(success);
        }
Example #23
0
 private void EnterHotkeyControl(object sender, EventArgs e)
 {
     HotkeyControl.UnregisterHotkeys();
     _inHotkey = true;
 }
Example #24
0
 void SettingsFormShown(object sender, EventArgs e)
 {
     HotkeyControl.UnregisterHotkeys();
 }
Example #25
0
 private void InitializeComponent()
 {
     this.components       = new Container();
     this.label1           = new Label();
     this.txtStyleName     = new TextBox();
     this.toolTip1         = new ToolTip(this.components);
     this.panel2           = new Panel();
     this.groupBox1        = new GroupBox();
     this.label5           = new Label();
     this.label4           = new Label();
     this.btnKeyDelete     = new Button();
     this.hotkey           = new HotkeyControl();
     this.listKeys         = new ListBox();
     this.btnKeyEntry      = new Button();
     this.btnOk            = new Button();
     this.btnCancel        = new Button();
     this.panel3           = new Panel();
     this.groupBox2        = new GroupBox();
     this.listStyleItem    = new StyleItemListBox();
     this.listAllStyleItem = new StyleItemListBox();
     this.label3           = new Label();
     this.label2           = new Label();
     this.btnItemDelete    = new Button();
     this.btnInsert        = new Button();
     this.btnItemDown      = new Button();
     this.btnItemUp        = new Button();
     this.toolTip2         = new ToolTip(this.components);
     this.panel2.SuspendLayout();
     this.groupBox1.SuspendLayout();
     this.panel3.SuspendLayout();
     this.groupBox2.SuspendLayout();
     base.SuspendLayout();
     this.label1.AutoSize        = true;
     this.label1.Font            = new Font("宋体", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x80);
     this.label1.ForeColor       = SystemColors.ControlText;
     this.label1.Location        = new Point(1, 0x12f);
     this.label1.Name            = "label1";
     this.label1.Size            = new Size(0x3d, 12);
     this.label1.TabIndex        = 0;
     this.label1.Text            = "自动操作名∶";
     this.txtStyleName.BackColor = Color.FromArgb(0xce, 230, 0xf7);
     this.txtStyleName.Font      = new Font("宋体", 10f, FontStyle.Regular, GraphicsUnit.Point, 0x80);
     this.txtStyleName.ImeMode   = ImeMode.On;
     this.txtStyleName.Location  = new Point(3, 0x13d);
     this.txtStyleName.Name      = "txtStyleName";
     this.txtStyleName.Size      = new Size(0xc1, 0x15);
     this.txtStyleName.TabIndex  = 1;
     this.toolTip2.SetToolTip(this.txtStyleName, "您可以对具体自动操作命名。");
     this.txtStyleName.TextChanged += new EventHandler(this.txtStyleName_TextChanged);
     this.toolTip1.Active           = false;
     this.toolTip1.AutoPopDelay     = 0x1388;
     this.toolTip1.InitialDelay     = 0;
     this.toolTip1.ReshowDelay      = 100;
     this.toolTip1.ToolTipIcon      = ToolTipIcon.Info;
     this.toolTip1.ToolTipTitle     = "aaa";
     this.toolTip1.UseAnimation     = false;
     this.toolTip1.UseFading        = false;
     this.panel2.Controls.Add(this.label1);
     this.panel2.Controls.Add(this.groupBox1);
     this.panel2.Controls.Add(this.txtStyleName);
     this.panel2.Controls.Add(this.btnOk);
     this.panel2.Controls.Add(this.btnCancel);
     this.panel2.Dock     = DockStyle.Right;
     this.panel2.Location = new Point(0x243, 0);
     this.panel2.Name     = "panel2";
     this.panel2.Size     = new Size(0xcc, 0x17d);
     this.panel2.TabIndex = 2;
     this.groupBox1.Controls.Add(this.label5);
     this.groupBox1.Controls.Add(this.label4);
     this.groupBox1.Controls.Add(this.btnKeyDelete);
     this.groupBox1.Controls.Add(this.hotkey);
     this.groupBox1.Controls.Add(this.listKeys);
     this.groupBox1.Controls.Add(this.btnKeyEntry);
     this.groupBox1.Location    = new Point(3, 11);
     this.groupBox1.Name        = "groupBox1";
     this.groupBox1.Size        = new Size(0xc1, 0xd4);
     this.groupBox1.TabIndex    = 0;
     this.groupBox1.TabStop     = false;
     this.groupBox1.Text        = "指定快捷键";
     this.label5.AutoSize       = true;
     this.label5.Location       = new Point(10, 0x52);
     this.label5.Name           = "label5";
     this.label5.Size           = new Size(0x44, 12);
     this.label5.TabIndex       = 3;
     this.label5.Text           = "快捷键分配:";
     this.label4.AutoSize       = true;
     this.label4.Location       = new Point(10, 0x17);
     this.label4.Name           = "label4";
     this.label4.Size           = new Size(0x1b, 12);
     this.label4.TabIndex       = 0;
     this.label4.Text           = "快捷键:";
     this.btnKeyDelete.Location = new Point(0x85, 0xb3);
     this.btnKeyDelete.Name     = "btnKeyDelete";
     this.btnKeyDelete.Size     = new Size(0x30, 0x18);
     this.btnKeyDelete.TabIndex = 5;
     this.btnKeyDelete.Text     = "删除";
     this.btnKeyDelete.UseVisualStyleBackColor = true;
     this.btnKeyDelete.Click += new EventHandler(this.btnKeyDelete_Click);
     this.hotkey.Hotkey       = Keys.None;
     this.hotkey.Location     = new Point(12, 40);
     this.hotkey.Name         = "hotkey";
     this.hotkey.Size         = new Size(0xa9, 0x13);
     this.hotkey.TabIndex     = 1;
     this.toolTip2.SetToolTip(this.hotkey, "创建应用自动操作的快捷键。");
     this.hotkey.KeyUp += new KeyEventHandler(this.hotkey_KeyUp);
     this.listKeys.FormattingEnabled = true;
     this.listKeys.IntegralHeight    = false;
     this.listKeys.ItemHeight        = 12;
     this.listKeys.Location          = new Point(12, 0x63);
     this.listKeys.Name     = "listKeys";
     this.listKeys.Size     = new Size(0xa9, 0x4e);
     this.listKeys.TabIndex = 4;
     this.toolTip2.SetToolTip(this.listKeys, "选择参考图,如果点击分配的快捷键则应用自动操作。");
     this.btnKeyEntry.Location = new Point(0x85, 60);
     this.btnKeyEntry.Name     = "btnKeyEntry";
     this.btnKeyEntry.Size     = new Size(0x30, 0x18);
     this.btnKeyEntry.TabIndex = 2;
     this.btnKeyEntry.Text     = "登记";
     this.btnKeyEntry.UseVisualStyleBackColor = true;
     this.btnKeyEntry.Click                += new EventHandler(this.btnKeyEntry_Click);
     this.btnKeyEntry.KeyPress             += new KeyPressEventHandler(this.hotkey_KeyPress);
     this.btnOk.Anchor                      = AnchorStyles.Left | AnchorStyles.Bottom;
     this.btnOk.Location                    = new Point(3, 0x158);
     this.btnOk.Name                        = "btnOk";
     this.btnOk.Size                        = new Size(0x67, 0x1c);
     this.btnOk.TabIndex                    = 1;
     this.btnOk.Text                        = "确定";
     this.btnOk.UseVisualStyleBackColor     = true;
     this.btnOk.Click                      += new EventHandler(this.btnOk_Click);
     this.btnCancel.Anchor                  = AnchorStyles.Left | AnchorStyles.Bottom;
     this.btnCancel.DialogResult            = DialogResult.Cancel;
     this.btnCancel.Location                = new Point(0x70, 0x158);
     this.btnCancel.Name                    = "btnCancel";
     this.btnCancel.Size                    = new Size(0x54, 0x1c);
     this.btnCancel.TabIndex                = 2;
     this.btnCancel.Text                    = "取消";
     this.btnCancel.UseVisualStyleBackColor = true;
     this.btnCancel.Click                  += new EventHandler(this.btnCancel_Click);
     this.panel3.Controls.Add(this.groupBox2);
     this.panel3.Dock      = DockStyle.Fill;
     this.panel3.Location  = new Point(0, 0);
     this.panel3.Name      = "panel3";
     this.panel3.Size      = new Size(0x243, 0x17d);
     this.panel3.TabIndex  = 1;
     this.groupBox2.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
     this.groupBox2.Controls.Add(this.listStyleItem);
     this.groupBox2.Controls.Add(this.listAllStyleItem);
     this.groupBox2.Controls.Add(this.label3);
     this.groupBox2.Controls.Add(this.label2);
     this.groupBox2.Controls.Add(this.btnItemDelete);
     this.groupBox2.Controls.Add(this.btnInsert);
     this.groupBox2.Controls.Add(this.btnItemDown);
     this.groupBox2.Controls.Add(this.btnItemUp);
     this.groupBox2.Location              = new Point(12, 11);
     this.groupBox2.Name                  = "groupBox2";
     this.groupBox2.Padding               = new Padding(6);
     this.groupBox2.Size                  = new Size(0x22d, 0x16a);
     this.groupBox2.TabIndex              = 0;
     this.groupBox2.TabStop               = false;
     this.groupBox2.Text                  = "自动操作的装配";
     this.listStyleItem.Anchor            = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
     this.listStyleItem.DrawMode          = DrawMode.OwnerDrawFixed;
     this.listStyleItem.Font              = new Font("黑体", 10f);
     this.listStyleItem.FormattingEnabled = true;
     this.listStyleItem.HelpFont          = new Font("黑体", 8f);
     this.listStyleItem.HelpForeColor     = Color.SteelBlue;
     this.listStyleItem.IntegralHeight    = false;
     this.listStyleItem.ItemDragMove      = true;
     this.listStyleItem.ItemHeight        = 0x27;
     this.listStyleItem.ItemKeyDelete     = true;
     this.listStyleItem.ItemLine          = true;
     this.listStyleItem.ItemLineColor     = Color.LightSteelBlue;
     this.listStyleItem.Items.AddRange(new object[] { "第1项", "第2项", "第3项" });
     this.listStyleItem.LeftSpace    = 0x22;
     this.listStyleItem.Location     = new Point(0x128, 40);
     this.listStyleItem.Name         = "listStyleItem";
     this.listStyleItem.Size         = new Size(250, 0x133);
     this.listStyleItem.TabIndex     = 4;
     this.listStyleItem.TerminateEnd = true;
     this.toolTip2.SetToolTip(this.listStyleItem, "自上而下依次应用自动操作项目。");
     this.listStyleItem.DoubleClick         += new EventHandler(this.listStyleItem_DoubleClick);
     this.listStyleItem.Click               += new EventHandler(this.listAllStyleItem_Click);
     this.listAllStyleItem.Anchor            = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
     this.listAllStyleItem.DrawMode          = DrawMode.OwnerDrawFixed;
     this.listAllStyleItem.Font              = new Font("黑体", 10f);
     this.listAllStyleItem.FormattingEnabled = true;
     this.listAllStyleItem.HelpFont          = new Font("黑体", 8f);
     this.listAllStyleItem.HelpForeColor     = Color.SteelBlue;
     this.listAllStyleItem.IntegralHeight    = false;
     this.listAllStyleItem.ItemDragMove      = false;
     this.listAllStyleItem.ItemHeight        = 0x27;
     this.listAllStyleItem.ItemKeyDelete     = false;
     this.listAllStyleItem.ItemLine          = true;
     this.listAllStyleItem.ItemLineColor     = Color.LightSteelBlue;
     this.listAllStyleItem.Items.AddRange(new object[] { "第1项", "第2项", "第3项" });
     this.listAllStyleItem.LeftSpace           = 0x22;
     this.listAllStyleItem.Location            = new Point(9, 40);
     this.listAllStyleItem.Name                = "listAllStyleItem";
     this.listAllStyleItem.ScrollAlwaysVisible = true;
     this.listAllStyleItem.Size                = new Size(250, 0x133);
     this.listAllStyleItem.TabIndex            = 1;
     this.listAllStyleItem.TerminateEnd        = false;
     this.listAllStyleItem.DoubleClick        += new EventHandler(this.listAllStyleItem_DoubleClick);
     this.listAllStyleItem.Click              += new EventHandler(this.listAllStyleItem_Click);
     this.label3.AutoSize        = true;
     this.label3.Location        = new Point(0x126, 0x19);
     this.label3.Name            = "label3";
     this.label3.Size            = new Size(0x55, 12);
     this.label3.TabIndex        = 3;
     this.label3.Text            = "登记方式:";
     this.label2.AutoSize        = true;
     this.label2.Location        = new Point(9, 0x19);
     this.label2.Name            = "label2";
     this.label2.Size            = new Size(0x43, 12);
     this.label2.TabIndex        = 0;
     this.label2.Text            = "自动操作列表:";
     this.btnItemDelete.Anchor   = AnchorStyles.Right | AnchorStyles.Top;
     this.btnItemDelete.Font     = new Font("宋体", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0x80);
     this.btnItemDelete.Image    = Resources.Close;
     this.btnItemDelete.Location = new Point(0x205, 14);
     this.btnItemDelete.Name     = "btnItemDelete";
     this.btnItemDelete.Size     = new Size(0x1d, 0x17);
     this.btnItemDelete.TabIndex = 7;
     this.toolTip2.SetToolTip(this.btnItemDelete, "删除选定的项目。");
     this.btnItemDelete.UseVisualStyleBackColor = true;
     this.btnItemDelete.Click += new EventHandler(this.btnItemDelete_Click);
     this.btnInsert.Anchor     = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
     this.btnInsert.Location   = new Point(0x109, 0x33);
     this.btnInsert.Name       = "btnInsert";
     this.btnInsert.Size       = new Size(0x19, 0x11e);
     this.btnInsert.TabIndex   = 2;
     this.btnInsert.Text       = ">>";
     this.btnInsert.UseVisualStyleBackColor = true;
     this.btnInsert.Click     += new EventHandler(this.btnInsert_Click);
     this.btnItemDown.Anchor   = AnchorStyles.Right | AnchorStyles.Top;
     this.btnItemDown.Font     = new Font("宋体", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0x80);
     this.btnItemDown.Image    = Resources.ArrowDown;
     this.btnItemDown.Location = new Point(0x1c8, 14);
     this.btnItemDown.Name     = "btnItemDown";
     this.btnItemDown.Size     = new Size(0x1d, 0x17);
     this.btnItemDown.TabIndex = 5;
     this.toolTip2.SetToolTip(this.btnItemDown, "更改选定项目的顺序。");
     this.btnItemDown.UseVisualStyleBackColor = true;
     this.btnItemDown.Click += new EventHandler(this.btnItemDown_Click);
     this.btnItemUp.Anchor   = AnchorStyles.Right | AnchorStyles.Top;
     this.btnItemUp.Font     = new Font("宋体", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0x80);
     this.btnItemUp.Image    = Resources.ArrowUp;
     this.btnItemUp.Location = new Point(0x1e4, 14);
     this.btnItemUp.Name     = "btnItemUp";
     this.btnItemUp.Size     = new Size(0x1d, 0x17);
     this.btnItemUp.TabIndex = 6;
     this.toolTip2.SetToolTip(this.btnItemUp, "更改选定项目的顺序。");
     this.btnItemUp.UseVisualStyleBackColor = true;
     this.btnItemUp.Click    += new EventHandler(this.btnItemUp_Click);
     base.AutoScaleDimensions = new SizeF(6f, 12f);
     base.AutoScaleMode       = AutoScaleMode.Font;
     base.CancelButton        = this.btnCancel;
     base.ClientSize          = new Size(0x30f, 0x17d);
     base.Controls.Add(this.panel3);
     base.Controls.Add(this.panel2);
     this.DoubleBuffered = true;
     base.MaximizeBox    = false;
     base.MinimizeBox    = false;
     this.MinimumSize    = new Size(0x2b4, 0x19f);
     base.Name           = "StyleEditForm";
     base.ShowIcon       = false;
     base.ShowInTaskbar  = false;
     base.StartPosition  = FormStartPosition.CenterParent;
     this.Text           = "StyleEditForm";
     base.Shown         += new EventHandler(this.StyleEditForm_Shown);
     this.panel2.ResumeLayout(false);
     this.panel2.PerformLayout();
     this.groupBox1.ResumeLayout(false);
     this.groupBox1.PerformLayout();
     this.panel3.ResumeLayout(false);
     this.groupBox2.ResumeLayout(false);
     this.groupBox2.PerformLayout();
     base.ResumeLayout(false);
 }
Example #26
0
        public MainWindow()
        {
            // Set to autorun on startup
            reg.SetValue(Constants.AppName, System.Windows.Forms.Application.ExecutablePath.ToString());

            InitializeComponent();

            main = this;

            int devHeight = 1080;
            int devWidth  = 1920;

            main.Width  = SystemParameters.PrimaryScreenWidth;
            main.Height = SystemParameters.PrimaryScreenHeight;

            // Make the application fullscreen
            WindowState = WindowState.Maximized;
            WindowStyle = WindowStyle.None;

            hightRaio = main.Height / devHeight;
            widthRaio = main.Width / devWidth;

            KeyHandler = new HotkeyControl();

            // Set of hotkey timer
            KeyHandler.ShowMe.Elapsed += OnTimedEvent;

            // So that the window can't the covered
            Topmost = true;

            // Add closing blocking func to the main window closing event so that the window can't closed
            Closing += MainWindow_Closing;

            // So that it can't be minimized
            StateChanged += TriedToCloseMe;

            Hide();

            // Get the with of the primary screen and set it to the media element width
            VidPlayer.Width  = SystemParameters.PrimaryScreenWidth;
            VidPlayer.Height = SystemParameters.PrimaryScreenHeight;

            // Stretch the media element's hight in a uniform way
            VidPlayer.Stretch = Stretch.Uniform;

            // The highest the volume can be
            VidPlayer.Volume = 1;

            VidPlayer.MediaEnded += PlayNextVideo;

            // Find the progress bar showing the time until the user can take the test again
            ProgressUntilTestAgain.Visibility = Visibility.Hidden;


            // Hind everything user the question event is triggered
            HideEverything();

            TextWrongAnswers.Text = "Wrong Answers Left: " + (Constants.WrongAnswerMax - WrongAnswerIndex).ToString();

            // normalise the elements locations by screen size
            this.ButtonLocNormalise(button);
            this.ButtonLocNormalise(button1);
            this.ButtonLocNormalise(button2);
            this.ButtonLocNormalise(button3);
            this.TextBoxLocNormalise(QuestionText);
            this.TextBoxLocNormalise(TextRightAnswers);
            this.TextBoxLocNormalise(TextWrongAnswers);

            VolumeHandler = new VolumeControl();
        }
Example #27
0
        public void Initialize()
        {
            Log.Debug().WriteLine("Initializing MainForm.");
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            try
            {
                InitializeComponent();
                SetupBitmapScaleHandler();
            }
            catch (ArgumentException ex)
            {
                // Added for Bug #1420, this doesn't solve the issue but maybe the user can do something with it.
                ex.Data.Add("more information here", "http://support.microsoft.com/kb/943140");
                throw;
            }
            notifyIcon.Icon = GreenshotResources.GetGreenshotIcon();

            // Disable access to the settings, for feature #3521446
            contextmenu_settings.Visible = !_coreConfiguration.DisableSettings;

            UpdateUi();

            if (_coreConfiguration.DisableQuickSettings)
            {
                contextmenu_quicksettings.Visible = false;
            }
            else
            {
                // Do after all plugins & finding the destination, otherwise they are missing!
                InitializeQuickSettingsMenu();
            }

            // Set the Greenshot icon visibility depending on the configuration. (Added for feature #3521446)
            // Setting it to true this late prevents Problems with the context menu
            notifyIcon.Visible = !_coreConfiguration.HideTrayicon;

            // Check if it's the first time launch?
            if (_coreConfiguration.IsFirstLaunch)
            {
                _coreConfiguration.IsFirstLaunch = false;
                Log.Info().WriteLine("FirstLaunch: Created new configuration, showing balloon.");
                try
                {
                    notifyIcon.BalloonTipClicked += BalloonTipClicked;
                    notifyIcon.BalloonTipClosed  += BalloonTipClosed;
                    notifyIcon.ShowBalloonTip(2000, "Greenshot", string.Format(_greenshotLanguage.TooltipFirststart, HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.RegionHotkey)), ToolTipIcon.Info);
                }
                catch (Exception ex)
                {
                    Log.Warn().WriteLine(ex, "Exception while showing first launch: ");
                }
            }

            // Make Greenshot use less memory after startup
            if (_coreConfiguration.MinimizeWorkingSetSize)
            {
                PsApi.EmptyWorkingSet();
            }
        }
Example #28
0
 private void InitializeComponent()
 {
     this.components       = new System.ComponentModel.Container();
     this.label1           = new System.Windows.Forms.Label();
     this.txtStyleName     = new System.Windows.Forms.TextBox();
     this.toolTip1         = new System.Windows.Forms.ToolTip(this.components);
     this.panel2           = new System.Windows.Forms.Panel();
     this.groupBox1        = new System.Windows.Forms.GroupBox();
     this.label5           = new System.Windows.Forms.Label();
     this.label4           = new System.Windows.Forms.Label();
     this.btnKeyDelete     = new System.Windows.Forms.Button();
     this.hotkey           = new SETUNA.Main.HotkeyControl();
     this.listKeys         = new System.Windows.Forms.ListBox();
     this.btnKeyEntry      = new System.Windows.Forms.Button();
     this.btnOk            = new System.Windows.Forms.Button();
     this.btnCancel        = new System.Windows.Forms.Button();
     this.panel3           = new System.Windows.Forms.Panel();
     this.groupBox2        = new System.Windows.Forms.GroupBox();
     this.listStyleItem    = new SETUNA.Main.StyleItemListBox();
     this.listAllStyleItem = new SETUNA.Main.StyleItemListBox();
     this.label3           = new System.Windows.Forms.Label();
     this.label2           = new System.Windows.Forms.Label();
     this.btnItemDelete    = new System.Windows.Forms.Button();
     this.btnInsert        = new System.Windows.Forms.Button();
     this.btnItemDown      = new System.Windows.Forms.Button();
     this.btnItemUp        = new System.Windows.Forms.Button();
     this.toolTip2         = new System.Windows.Forms.ToolTip(this.components);
     this.panel2.SuspendLayout();
     this.groupBox1.SuspendLayout();
     this.panel3.SuspendLayout();
     this.groupBox2.SuspendLayout();
     this.SuspendLayout();
     //
     // label1
     //
     this.label1.AutoSize  = true;
     this.label1.Font      = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
     this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
     this.label1.Location  = new System.Drawing.Point(2, 682);
     this.label1.Margin    = new System.Windows.Forms.Padding(7, 0, 7, 0);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(180, 27);
     this.label1.TabIndex  = 0;
     this.label1.Text      = "自动操作名∶";
     //
     // txtStyleName
     //
     this.txtStyleName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(206)))), ((int)(((byte)(230)))), ((int)(((byte)(247)))));
     this.txtStyleName.Font      = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
     this.txtStyleName.ImeMode   = System.Windows.Forms.ImeMode.On;
     this.txtStyleName.Location  = new System.Drawing.Point(7, 713);
     this.txtStyleName.Margin    = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.txtStyleName.Name      = "txtStyleName";
     this.txtStyleName.Size      = new System.Drawing.Size(445, 42);
     this.txtStyleName.TabIndex  = 1;
     this.toolTip2.SetToolTip(this.txtStyleName, "您可以对具体自动操作命名。");
     this.txtStyleName.TextChanged += new System.EventHandler(this.txtStyleName_TextChanged);
     //
     // toolTip1
     //
     this.toolTip1.Active       = false;
     this.toolTip1.AutoPopDelay = 5000;
     this.toolTip1.InitialDelay = 0;
     this.toolTip1.ReshowDelay  = 100;
     this.toolTip1.ToolTipIcon  = System.Windows.Forms.ToolTipIcon.Info;
     this.toolTip1.ToolTipTitle = "aaa";
     this.toolTip1.UseAnimation = false;
     this.toolTip1.UseFading    = false;
     //
     // panel2
     //
     this.panel2.Controls.Add(this.label1);
     this.panel2.Controls.Add(this.groupBox1);
     this.panel2.Controls.Add(this.txtStyleName);
     this.panel2.Controls.Add(this.btnOk);
     this.panel2.Controls.Add(this.btnCancel);
     this.panel2.Dock     = System.Windows.Forms.DockStyle.Right;
     this.panel2.Location = new System.Drawing.Point(1351, 0);
     this.panel2.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.panel2.Name     = "panel2";
     this.panel2.Size     = new System.Drawing.Size(476, 857);
     this.panel2.TabIndex = 2;
     //
     // groupBox1
     //
     this.groupBox1.Controls.Add(this.label5);
     this.groupBox1.Controls.Add(this.label4);
     this.groupBox1.Controls.Add(this.btnKeyDelete);
     this.groupBox1.Controls.Add(this.hotkey);
     this.groupBox1.Controls.Add(this.listKeys);
     this.groupBox1.Controls.Add(this.btnKeyEntry);
     this.groupBox1.Location = new System.Drawing.Point(7, 25);
     this.groupBox1.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.groupBox1.Name     = "groupBox1";
     this.groupBox1.Padding  = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.groupBox1.Size     = new System.Drawing.Size(450, 477);
     this.groupBox1.TabIndex = 0;
     this.groupBox1.TabStop  = false;
     this.groupBox1.Text     = "指定快捷键";
     //
     // label5
     //
     this.label5.AutoSize = true;
     this.label5.Location = new System.Drawing.Point(23, 184);
     this.label5.Margin   = new System.Windows.Forms.Padding(7, 0, 7, 0);
     this.label5.Name     = "label5";
     this.label5.Size     = new System.Drawing.Size(174, 27);
     this.label5.TabIndex = 3;
     this.label5.Text     = "快捷键分配:";
     //
     // label4
     //
     this.label4.AutoSize = true;
     this.label4.Location = new System.Drawing.Point(23, 52);
     this.label4.Margin   = new System.Windows.Forms.Padding(7, 0, 7, 0);
     this.label4.Name     = "label4";
     this.label4.Size     = new System.Drawing.Size(120, 27);
     this.label4.TabIndex = 0;
     this.label4.Text     = "快捷键:";
     //
     // btnKeyDelete
     //
     this.btnKeyDelete.Location = new System.Drawing.Point(310, 403);
     this.btnKeyDelete.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.btnKeyDelete.Name     = "btnKeyDelete";
     this.btnKeyDelete.Size     = new System.Drawing.Size(112, 54);
     this.btnKeyDelete.TabIndex = 5;
     this.btnKeyDelete.Text     = "删除";
     this.btnKeyDelete.UseVisualStyleBackColor = true;
     this.btnKeyDelete.Click += new System.EventHandler(this.btnKeyDelete_Click);
     //
     // hotkey
     //
     this.hotkey.Hotkey   = System.Windows.Forms.Keys.None;
     this.hotkey.Location = new System.Drawing.Point(28, 90);
     this.hotkey.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.hotkey.Name     = "hotkey";
     this.hotkey.Size     = new System.Drawing.Size(394, 43);
     this.hotkey.TabIndex = 1;
     this.toolTip2.SetToolTip(this.hotkey, "创建应用自动操作的快捷键。");
     this.hotkey.KeyUp += new System.Windows.Forms.KeyEventHandler(this.hotkey_KeyUp);
     //
     // listKeys
     //
     this.listKeys.FormattingEnabled = true;
     this.listKeys.IntegralHeight    = false;
     this.listKeys.ItemHeight        = 27;
     this.listKeys.Location          = new System.Drawing.Point(28, 223);
     this.listKeys.Margin            = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.listKeys.Name     = "listKeys";
     this.listKeys.Size     = new System.Drawing.Size(389, 170);
     this.listKeys.TabIndex = 4;
     this.toolTip2.SetToolTip(this.listKeys, "选择参考图,如果点击分配的快捷键则应用自动操作。");
     //
     // btnKeyEntry
     //
     this.btnKeyEntry.Location = new System.Drawing.Point(310, 135);
     this.btnKeyEntry.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.btnKeyEntry.Name     = "btnKeyEntry";
     this.btnKeyEntry.Size     = new System.Drawing.Size(112, 54);
     this.btnKeyEntry.TabIndex = 2;
     this.btnKeyEntry.Text     = "登记";
     this.btnKeyEntry.UseVisualStyleBackColor = true;
     this.btnKeyEntry.Click    += new System.EventHandler(this.btnKeyEntry_Click);
     this.btnKeyEntry.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.hotkey_KeyPress);
     //
     // btnOk
     //
     this.btnOk.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this.btnOk.Location = new System.Drawing.Point(7, 774);
     this.btnOk.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.btnOk.Name     = "btnOk";
     this.btnOk.Size     = new System.Drawing.Size(240, 63);
     this.btnOk.TabIndex = 1;
     this.btnOk.Text     = "确定";
     this.btnOk.UseVisualStyleBackColor = true;
     this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
     //
     // btnCancel
     //
     this.btnCancel.Anchor                  = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this.btnCancel.DialogResult            = System.Windows.Forms.DialogResult.Cancel;
     this.btnCancel.Location                = new System.Drawing.Point(261, 774);
     this.btnCancel.Margin                  = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.btnCancel.Name                    = "btnCancel";
     this.btnCancel.Size                    = new System.Drawing.Size(196, 63);
     this.btnCancel.TabIndex                = 2;
     this.btnCancel.Text                    = "取消";
     this.btnCancel.UseVisualStyleBackColor = true;
     this.btnCancel.Click                  += new System.EventHandler(this.btnCancel_Click);
     //
     // panel3
     //
     this.panel3.Controls.Add(this.groupBox2);
     this.panel3.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.panel3.Location = new System.Drawing.Point(0, 0);
     this.panel3.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.panel3.Name     = "panel3";
     this.panel3.Size     = new System.Drawing.Size(1351, 857);
     this.panel3.TabIndex = 1;
     //
     // groupBox2
     //
     this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                    | System.Windows.Forms.AnchorStyles.Left)
                                                                   | System.Windows.Forms.AnchorStyles.Right)));
     this.groupBox2.Controls.Add(this.listStyleItem);
     this.groupBox2.Controls.Add(this.listAllStyleItem);
     this.groupBox2.Controls.Add(this.label3);
     this.groupBox2.Controls.Add(this.label2);
     this.groupBox2.Controls.Add(this.btnItemDelete);
     this.groupBox2.Controls.Add(this.btnInsert);
     this.groupBox2.Controls.Add(this.btnItemDown);
     this.groupBox2.Controls.Add(this.btnItemUp);
     this.groupBox2.Location = new System.Drawing.Point(28, 25);
     this.groupBox2.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.groupBox2.Name     = "groupBox2";
     this.groupBox2.Padding  = new System.Windows.Forms.Padding(14, 14, 14, 14);
     this.groupBox2.Size     = new System.Drawing.Size(1300, 814);
     this.groupBox2.TabIndex = 0;
     this.groupBox2.TabStop  = false;
     this.groupBox2.Text     = "自动操作的装配";
     //
     // listStyleItem
     //
     this.listStyleItem.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                        | System.Windows.Forms.AnchorStyles.Left)
                                                                       | System.Windows.Forms.AnchorStyles.Right)));
     this.listStyleItem.DrawMode          = System.Windows.Forms.DrawMode.OwnerDrawFixed;
     this.listStyleItem.Font              = new System.Drawing.Font("黑体", 10F);
     this.listStyleItem.FormattingEnabled = true;
     this.listStyleItem.HelpFont          = new System.Drawing.Font("黑体", 8F);
     this.listStyleItem.HelpForeColor     = System.Drawing.Color.SteelBlue;
     this.listStyleItem.IntegralHeight    = false;
     this.listStyleItem.ItemDragMove      = true;
     this.listStyleItem.ItemHeight        = 39;
     this.listStyleItem.ItemKeyDelete     = true;
     this.listStyleItem.ItemLine          = true;
     this.listStyleItem.ItemLineColor     = System.Drawing.Color.LightSteelBlue;
     this.listStyleItem.Items.AddRange(new object[] {
         "第1项",
         "第2项",
         "第3项"
     });
     this.listStyleItem.LeftSpace    = 34;
     this.listStyleItem.Location     = new System.Drawing.Point(691, 90);
     this.listStyleItem.Margin       = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.listStyleItem.Name         = "listStyleItem";
     this.listStyleItem.Size         = new System.Drawing.Size(578, 686);
     this.listStyleItem.TabIndex     = 4;
     this.listStyleItem.TerminateEnd = true;
     this.toolTip2.SetToolTip(this.listStyleItem, "自上而下依次应用自动操作项目。");
     this.listStyleItem.Click       += new System.EventHandler(this.listAllStyleItem_Click);
     this.listStyleItem.DoubleClick += new System.EventHandler(this.listStyleItem_DoubleClick);
     //
     // listAllStyleItem
     //
     this.listAllStyleItem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                          | System.Windows.Forms.AnchorStyles.Left)));
     this.listAllStyleItem.DrawMode          = System.Windows.Forms.DrawMode.OwnerDrawFixed;
     this.listAllStyleItem.Font              = new System.Drawing.Font("黑体", 10F);
     this.listAllStyleItem.FormattingEnabled = true;
     this.listAllStyleItem.HelpFont          = new System.Drawing.Font("黑体", 8F);
     this.listAllStyleItem.HelpForeColor     = System.Drawing.Color.SteelBlue;
     this.listAllStyleItem.IntegralHeight    = false;
     this.listAllStyleItem.ItemDragMove      = false;
     this.listAllStyleItem.ItemHeight        = 39;
     this.listAllStyleItem.ItemKeyDelete     = false;
     this.listAllStyleItem.ItemLine          = true;
     this.listAllStyleItem.ItemLineColor     = System.Drawing.Color.LightSteelBlue;
     this.listAllStyleItem.Items.AddRange(new object[] {
         "第1项",
         "第2项",
         "第3项"
     });
     this.listAllStyleItem.LeftSpace           = 34;
     this.listAllStyleItem.Location            = new System.Drawing.Point(21, 90);
     this.listAllStyleItem.Margin              = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.listAllStyleItem.Name                = "listAllStyleItem";
     this.listAllStyleItem.ScrollAlwaysVisible = true;
     this.listAllStyleItem.Size                = new System.Drawing.Size(578, 686);
     this.listAllStyleItem.TabIndex            = 1;
     this.listAllStyleItem.TerminateEnd        = false;
     this.listAllStyleItem.Click              += new System.EventHandler(this.listAllStyleItem_Click);
     this.listAllStyleItem.DoubleClick        += new System.EventHandler(this.listAllStyleItem_DoubleClick);
     //
     // label3
     //
     this.label3.AutoSize = true;
     this.label3.Location = new System.Drawing.Point(686, 56);
     this.label3.Margin   = new System.Windows.Forms.Padding(7, 0, 7, 0);
     this.label3.Name     = "label3";
     this.label3.Size     = new System.Drawing.Size(147, 27);
     this.label3.TabIndex = 3;
     this.label3.Text     = "登记方式:";
     //
     // label2
     //
     this.label2.AutoSize = true;
     this.label2.Location = new System.Drawing.Point(21, 56);
     this.label2.Margin   = new System.Windows.Forms.Padding(7, 0, 7, 0);
     this.label2.Name     = "label2";
     this.label2.Size     = new System.Drawing.Size(201, 27);
     this.label2.TabIndex = 0;
     this.label2.Text     = "自动操作列表:";
     //
     // btnItemDelete
     //
     this.btnItemDelete.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.btnItemDelete.Font     = new System.Drawing.Font("宋体", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
     this.btnItemDelete.Image    = global::Properties.Resources.Close;
     this.btnItemDelete.Location = new System.Drawing.Point(1206, 32);
     this.btnItemDelete.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.btnItemDelete.Name     = "btnItemDelete";
     this.btnItemDelete.Size     = new System.Drawing.Size(68, 52);
     this.btnItemDelete.TabIndex = 7;
     this.toolTip2.SetToolTip(this.btnItemDelete, "删除选定的项目。");
     this.btnItemDelete.UseVisualStyleBackColor = true;
     this.btnItemDelete.Click += new System.EventHandler(this.btnItemDelete_Click);
     //
     // btnInsert
     //
     this.btnInsert.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                   | System.Windows.Forms.AnchorStyles.Left)));
     this.btnInsert.Location = new System.Drawing.Point(618, 115);
     this.btnInsert.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.btnInsert.Name     = "btnInsert";
     this.btnInsert.Size     = new System.Drawing.Size(58, 644);
     this.btnInsert.TabIndex = 2;
     this.btnInsert.Text     = ">>";
     this.btnInsert.UseVisualStyleBackColor = true;
     this.btnInsert.Click += new System.EventHandler(this.btnInsert_Click);
     //
     // btnItemDown
     //
     this.btnItemDown.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.btnItemDown.Font     = new System.Drawing.Font("宋体", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
     this.btnItemDown.Image    = global::Properties.Resources.ArrowDown;
     this.btnItemDown.Location = new System.Drawing.Point(1064, 32);
     this.btnItemDown.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.btnItemDown.Name     = "btnItemDown";
     this.btnItemDown.Size     = new System.Drawing.Size(68, 52);
     this.btnItemDown.TabIndex = 5;
     this.toolTip2.SetToolTip(this.btnItemDown, "更改选定项目的顺序。");
     this.btnItemDown.UseVisualStyleBackColor = true;
     this.btnItemDown.Click += new System.EventHandler(this.btnItemDown_Click);
     //
     // btnItemUp
     //
     this.btnItemUp.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.btnItemUp.Font     = new System.Drawing.Font("宋体", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
     this.btnItemUp.Image    = global::Properties.Resources.ArrowUp;
     this.btnItemUp.Location = new System.Drawing.Point(1129, 32);
     this.btnItemUp.Margin   = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.btnItemUp.Name     = "btnItemUp";
     this.btnItemUp.Size     = new System.Drawing.Size(68, 52);
     this.btnItemUp.TabIndex = 6;
     this.toolTip2.SetToolTip(this.btnItemUp, "更改选定项目的顺序。");
     this.btnItemUp.UseVisualStyleBackColor = true;
     this.btnItemUp.Click += new System.EventHandler(this.btnItemUp_Click);
     //
     // StyleEditForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(14F, 27F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.CancelButton        = this.btnCancel;
     this.ClientSize          = new System.Drawing.Size(1827, 857);
     this.Controls.Add(this.panel3);
     this.Controls.Add(this.panel2);
     this.DoubleBuffered = true;
     this.Margin         = new System.Windows.Forms.Padding(7, 7, 7, 7);
     this.MaximizeBox    = false;
     this.MinimizeBox    = false;
     this.MinimumSize    = new System.Drawing.Size(1577, 835);
     this.Name           = "StyleEditForm";
     this.ShowIcon       = false;
     this.ShowInTaskbar  = false;
     this.StartPosition  = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Text           = "StyleEditForm";
     this.Shown         += new System.EventHandler(this.StyleEditForm_Shown);
     this.panel2.ResumeLayout(false);
     this.panel2.PerformLayout();
     this.groupBox1.ResumeLayout(false);
     this.groupBox1.PerformLayout();
     this.panel3.ResumeLayout(false);
     this.groupBox2.ResumeLayout(false);
     this.groupBox2.PerformLayout();
     this.ResumeLayout(false);
 }
Example #29
0
        private IEnumerator <object> WriteHotkeyPreference(string hotkeyName, HotkeyControl hotkeyControl)
        {
            yield return(DB.SetPreference("Hotkeys." + hotkeyName + ".Key", hotkeyControl.Hotkey.ToString()));

            yield return(DB.SetPreference("Hotkeys." + hotkeyName + ".Modifiers", hotkeyControl.HotkeyModifiers.ToString()));
        }
Example #30
0
 private void TextBoxHotkeyEnter(object sender, EventArgs e)
 {
     HotkeyControl.UnregisterHotkeys();
     inHotkey = true;
 }