Exemplo n.º 1
0
        private void OnNotifyKeybindingsClicked(object sender, EventArgs e)
        {
            SymbolBindingsMenuItem.Checked = false;
            NumpadBindingsMenuItem.Checked = false;
            CustomBindingsMenuItem.Checked = true;

            Properties.Settings.Default.NumpadBindings = false;
            Properties.Settings.Default.CustomBindings = true;

            using (Forms.KeybindingsUI keybindingsUI = new Forms.KeybindingsUI())
            {
                var result = keybindingsUI.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    LoadBindingConfiguration();
                    KeyBindings = CustomBindings;
                }
            }
        }
Exemplo n.º 2
0
        private void OnNotifyMenuBindingsClicked(object sender, EventArgs e)
        {
            if (sender == SymbolBindingsMenuItem)
            {
                if (SymbolBindingsMenuItem.Checked)
                {
                    return;
                }

                SymbolBindingsMenuItem.Checked = true;
                NumpadBindingsMenuItem.Checked = false;
                CustomBindingsMenuItem.Checked = false;

                Properties.Settings.Default.NumpadBindings = false;
                Properties.Settings.Default.CustomBindings = false;

                foreach (KeyBinding keyBinding in KeyBindings)
                {
                    keyBinding.Unregister(Handle);
                }

                KeyBindings = SymbolBindings;
            }
            else if (sender == NumpadBindingsMenuItem)
            {
                if (NumpadBindingsMenuItem.Checked)
                {
                    return;
                }

                SymbolBindingsMenuItem.Checked = false;
                NumpadBindingsMenuItem.Checked = true;
                CustomBindingsMenuItem.Checked = false;

                Properties.Settings.Default.NumpadBindings = true;
                Properties.Settings.Default.CustomBindings = false;

                foreach (KeyBinding keyBinding in KeyBindings)
                {
                    keyBinding.Unregister(Handle);
                }

                KeyBindings = NumpadBindings;
            }
            else if (sender == CustomBindingsMenuItem)
            {
                if (CustomBindingsMenuItem.Checked)
                {
                    return;
                }

                SymbolBindingsMenuItem.Checked = false;
                NumpadBindingsMenuItem.Checked = false;
                CustomBindingsMenuItem.Checked = true;

                Properties.Settings.Default.CustomBindings = true;
                Properties.Settings.Default.NumpadBindings = false;

                foreach (KeyBinding keyBinding in KeyBindings)
                {
                    keyBinding.Unregister(Handle);
                }

                if (CustomBindings == null)
                {
                    using (Forms.KeybindingsUI keybindingsUI = new Forms.KeybindingsUI())
                    {
                        var result = keybindingsUI.ShowDialog();
                        if (result == System.Windows.Forms.DialogResult.OK)
                        {
                            LoadBindingConfiguration();
                            KeyBindings = CustomBindings;
                        }
                    }
                }
                LoadBindingConfiguration();
                KeyBindings = CustomBindings;
            }

            foreach (KeyBinding keyBinding in KeyBindings)
            {
                keyBinding.Register(Handle);
            }

            Properties.Settings.Default.Save();
        }