示例#1
0
 private void StandardKeyDown(object sender, KeyEventArgs e)
 {
     StandardKeyInput.Focus();
     e.Handled = true;
     if (PressedKeys.Contains(e.Key))
     {
         return;
     }
     PressedKeys.Add(e.Key);
 }
示例#2
0
        private void ChangeStandardKey(object sender, KeyEventArgs e)
        {
            System.Windows.Forms.KeysConverter kc = new System.Windows.Forms.KeysConverter();
            string a = "";

            PressedKeys.Sort();
            PressedKeys.Reverse();
            foreach (Key k in PressedKeys)
            {
                if (a != "")
                {
                    a += "+";
                }
                a += kc.ConvertToString(k);
            }

            if (e.Key == Key.RightAlt)
            {
                PressedKeys.Remove(Key.LeftCtrl);
            }
            PressedKeys.Remove(e.Key);
            StandardKeyInput.Focus();
            e.Handled = true;

            if (Ignore)
            {
                if (PressedKeys.Count == 0)
                {
                    Ignore = false;
                }
                return;
            }
            else
            {
                ((ModProjectButtonViewModel)DataContext).StandardKey = a;
                if (PressedKeys.Count > 0)
                {
                    Ignore = true;
                }
            }
        }