Пример #1
0
 public void ToHotKeyToAction(HotKeyToAction hotKeyToAction)
 {
     hotKeyToAction.Enabled        = checkBoxEnabled.Checked;
     hotKeyToAction.HotKey.Control = checkBoxControl.Checked;
     hotKeyToAction.HotKey.Alt     = checkBoxAlt.Checked;
     hotKeyToAction.HotKey.Shift   = checkBoxShift.Checked;
     hotKeyToAction.HotKey.Key     = Key;
 }
Пример #2
0
 public void FromHotKeyToAction(HotKeyToAction hotKeyToAction)
 {
     SetStates(hotKeyToAction.Enabled);
     checkBoxControl.Checked = hotKeyToAction.HotKey.Control;
     checkBoxAlt.Checked     = hotKeyToAction.HotKey.Alt;
     checkBoxShift.Checked   = hotKeyToAction.HotKey.Shift;
     Key = hotKeyToAction.HotKey.Key;
     SetTextBoxKey();
 }
Пример #3
0
        private void OnKeyUp(object sender, KeyEventArgs e, HotKeyToAction hotKeyToAction)
        {
            switch (hotKeyToAction.Action)
            {
            case HotKeyAction.MapPrevious:
            case HotKeyAction.MapNext:

            case HotKeyAction.SaveFirst:
            case HotKeyAction.SaveLast:
            case HotKeyAction.SavePrevious:
            case HotKeyAction.SaveNext:

            case HotKeyAction.SaveRestore:
            case HotKeyAction.SaveBackup:
            case HotKeyAction.SaveDelete:

            case HotKeyAction.SettingSwitchAutoBackup:
                e.Handled = true;
                break;
            }
        }
Пример #4
0
        private void OnKeyDown(object sender, KeyEventArgs e, HotKeyToAction hotKeyToAction)
        {
            Logger.Log(_hotKeysManager.GetCurrentStates() + ", " + e.KeyCode, LogLevel.Debug);

            if (!_settingManager.HotKeysActive)
            {
                return;
            }

            SlotManager slotManager = null;

            if (tabControl1.SelectedTab == tabPageSlot1)
            {
                slotManager = _slot1;
            }

            if (tabControl1.SelectedTab == tabPageSlot2)
            {
                slotManager = _slot2;
            }

            if (tabControl1.SelectedTab == tabPageSlot3)
            {
                slotManager = _slot3;
            }

            if (slotManager != null)
            {
                switch (hotKeyToAction.Action)
                {
                case HotKeyAction.MapPrevious:
                    slotManager.MapSelectPrevious();
                    e.Handled = true;
                    break;

                case HotKeyAction.MapNext:
                    slotManager.MapSelectNext();
                    e.Handled = true;
                    break;

                case HotKeyAction.SaveFirst:
                    slotManager.SaveSelectFirst();
                    e.Handled = true;
                    break;

                case HotKeyAction.SaveLast:
                    slotManager.SaveSelectLast();
                    e.Handled = true;
                    break;

                case HotKeyAction.SavePrevious:
                    slotManager.SaveSelectPrevious();
                    e.Handled = true;
                    break;

                case HotKeyAction.SaveNext:
                    slotManager.SaveSelectNext();
                    e.Handled = true;
                    break;

                case HotKeyAction.SaveRestore:
                    if (slotManager.ActionSaveRestore())
                    {
                        if (_settingManager.HotKeysSound)
                        {
                            SoundManager.PlaySuccess();
                        }
                    }
                    else
                    {
                        if (_settingManager.HotKeysSound)
                        {
                            SoundManager.PlayError();
                        }
                    }

                    e.Handled = true;
                    break;

                case HotKeyAction.SaveBackup:
                    if (slotManager.ActionSaveBackup(false))
                    {
                        if (_settingManager.HotKeysSound)
                        {
                            SoundManager.PlaySuccess();
                        }
                    }
                    else
                    {
                        if (_settingManager.HotKeysSound)
                        {
                            SoundManager.PlayError();
                        }
                    }

                    e.Handled = true;
                    break;

                case HotKeyAction.SaveDelete:
                    if (slotManager.ActionSaveDelete())
                    {
                        if (_settingManager.HotKeysSound)
                        {
                            SoundManager.PlaySuccess();
                        }
                    }
                    else
                    {
                        if (_settingManager.HotKeysSound)
                        {
                            SoundManager.PlayError();
                        }
                    }

                    e.Handled = true;
                    break;

                case HotKeyAction.SettingSwitchAutoBackup:
                    if (slotManager.ActionSettingSwitchAutoBackup())
                    {
                        if (_settingManager.HotKeysSound)
                        {
                            SoundManager.PlaySuccess();
                        }
                    }
                    else
                    {
                        if (_settingManager.HotKeysSound)
                        {
                            SoundManager.PlayError();
                        }
                    }

                    e.Handled = true;
                    break;
                }
            }
        }