Esempio n. 1
0
 private void button_save_hotkeys_Click(object sender, RoutedEventArgs e)
 {
     if (edit)
     {
         if (textbox_combination.Text != "")
         {
             string Action = HotKeys.GetAction("=" + textbox_combination.Text);
             if (Action != "" && Action != raw_action[combo_action.SelectedIndex].ToString())
             {
                 ErrorException(Languages.Translate("Combination") + " \"" + textbox_combination.Text + "\" " + Languages.Translate("already used for") + " \"" + Languages.Translate(Action) + "\".");
                 return;
             }
         }
         string output = "";
         foreach (string line in HotKeys.Data)
         {
             if (line.Contains("="))
             {
                 string[] action = line.Trim().Split(new string[] { "=" }, StringSplitOptions.None);
                 if (action[0] == raw_action[combo_action.SelectedIndex].ToString())
                 {
                     output += action[0] + "=" + textbox_combination.Text + "; ";
                 }
                 else
                 {
                     output += line.Trim() + "; ";
                 }
             }
         }
         Settings.HotKeys = output;
         p.SetHotKeys(); //Тут происходит обновление HotKeys.Data
         UpdateHotKeysBox();
         Menu_Changed(null, null);
     }
 }
Esempio n. 2
0
        private void WindowKeyDown(object sender, KeyEventArgs e)
        {
            if (numl.txt_box.IsFocused || numt.txt_box.IsFocused || numr.txt_box.IsFocused || numb.txt_box.IsFocused)
            {
                return;
            }
            string key         = new System.Windows.Input.KeyConverter().ConvertToString(e.Key);
            string mod         = new System.Windows.Input.ModifierKeysConverter().ConvertToString(System.Windows.Input.Keyboard.Modifiers);
            string PressedKeys = "=" + ((mod.Length > 0) ? mod + "+" : "") + key;

            string Action = HotKeys.GetAction(PressedKeys);

            e.Handled = (Action.Length > 0);

            switch (Action)
            {
            case ("Frame forward"): Frame_Shift(1); break;

            case ("Frame back"): Frame_Shift(-1); break;

            case ("10 frames forward"): Frame_Shift(10); break;

            case ("10 frames backward"): Frame_Shift(-10); break;

            case ("100 frames forward"): Frame_Shift(100); break;

            case ("100 frames backward"): Frame_Shift(-100); break;

            case ("30 sec. forward"): Frame_Shift(Convert.ToInt32(fps * 30)); break;

            case ("30 sec. backward"): Frame_Shift(-Convert.ToInt32(fps * 30)); break;

            case ("3 min. forward"): Frame_Shift(Convert.ToInt32(fps * 180)); break;

            case ("3 min. backward"): Frame_Shift(-Convert.ToInt32(fps * 180)); break;

            case ("Fullscreen"): button_fullscreen_Click(null, null); break;
            }
        }