Exemple #1
0
        internal static KeyCode FromSfmlKeyCode(SfmlKeyboard.Key key)
        {
            if (key == SfmlKeyboard.Key.KeyCount)
            {
                return(KeyCode.Unsupported);
            }

            return((KeyCode)key);
        }
Exemple #2
0
        private void Handler_AddMapping_GenericKeyDown(ExtraButtons extraValue, Keyboard.Key keyboardValue, MouseButton mouseValue)
        {
            if (lastClickedButton != null && lastClickedButton.Parent != null)
            {
                StackPanel parentStackPanel = (StackPanel)lastClickedButton.Parent;
                if (parentStackPanel.Tag != null)
                {
                    if (keyboardValue != Keyboard.Key.Escape)
                    {
                        VirtualKey vk = (VirtualKey)parentStackPanel.Tag;

                        int         index    = (int)lastClickedButton.Tag;
                        PhysicalKey valueOld = null;

                        if (Settings.MappingsContainsKey(vk))
                        {
                            if (index < Settings.Mappings[vk].PhysicalKeys.Count)
                            {
                                valueOld = Settings.Mappings[vk].PhysicalKeys[index];
                            }
                        }

                        PhysicalKey valueNew = new PhysicalKey();
                        valueNew.ExtraValue    = extraValue;
                        valueNew.KeyboardValue = keyboardValue;
                        valueNew.MouseValue    = mouseValue;

                        UserSettings.SetMapping(vk, valueOld, valueNew);
                    }

                    lastClickedButton = null;
                    ((MainViewModel)DataContext).RefreshData();
                    WaitingForKeyPress_Hide();
                }
            }
        }
Exemple #3
0
 internal static Key Convert(this SKeyboard.Key key)
 {
     return((Key)key);
 }