Beispiel #1
0
        public static KeyStoreInfoCollection ReadStore(XmlElement xmlElement)
        {
            KeyStoreInfoCollection storeCollection = new KeyStoreInfoCollection();

            foreach (XmlElement childElement in xmlElement.ChildNodes.OfType <XmlElement>())
            {
                if (childElement.Name == KEY_STORE_INFO)
                {
                    try
                    {
                        KeyStoreInfo keyStore = new KeyStoreInfo();
                        switch ((KEY_TYPE)int.Parse(childElement.GetAttribute(KEY_STORE_TYPE)))
                        {
                        case KEY_TYPE.KEYBOARD:
                            keyStore.SetStoreValue((Keys)int.Parse(childElement.GetAttribute(KEY_STORE_VALUE)));
                            break;

                        case KEY_TYPE.JOYSTICK:
                            keyStore.SetStoreValue((JoystickButtons)int.Parse(childElement.GetAttribute(KEY_STORE_VALUE)));
                            break;
                        }
                        storeCollection.Add(keyStore);
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            return(storeCollection);
        }
Beispiel #2
0
        public void KeyboardClick(object sender, KeyboardHookArgs e)
        {
            TextBox textBox = (TextBox)Keyboard.FocusedElement;

            if (textBox == null)
            {
                return;
            }

            KeyStoreInfo keyStore = textBox.DataContext as KeyStoreInfo;

            if (keyStore != null)
            {
                keyStore.SetStoreValue(e.Key);
                //ItemList.Focus();
            }

            FinishInput();
        }
Beispiel #3
0
        public void JoyStickClick(object sender, JoystickEventArgs e)
        {
            TextBox textBox = Keyboard.FocusedElement as TextBox;

            if (textBox == null)
            {
                return;
            }

            KeyStoreInfo keyStore = textBox.DataContext as KeyStoreInfo;

            if (keyStore != null)
            {
                keyStore.SetStoreValue(WinManager.GetClickButton(e.Buttons));
                //ItemList.Focus();
            }

            FinishInput();
        }
Beispiel #4
0
        public static KeyStoreInfoCollection ReadStore(XmlElement xmlElement)
        {
            KeyStoreInfoCollection storeCollection = new KeyStoreInfoCollection();
            foreach (XmlElement childElement in xmlElement.ChildNodes.OfType<XmlElement>())
            {
                if (childElement.Name == KEY_STORE_INFO)
                {
                    try
                    {
                        KeyStoreInfo keyStore = new KeyStoreInfo();
                        switch((KEY_TYPE)int.Parse(childElement.GetAttribute(KEY_STORE_TYPE)))
                        {
                            case KEY_TYPE.KEYBOARD:
                                keyStore.SetStoreValue((Keys)int.Parse(childElement.GetAttribute(KEY_STORE_VALUE)));
                                break;
                            case KEY_TYPE.JOYSTICK:
                                keyStore.SetStoreValue((JoystickButtons)int.Parse(childElement.GetAttribute(KEY_STORE_VALUE)));
                                break;
                        }
                        storeCollection.Add(keyStore);
                    }
                    catch(Exception e)
                    {

                    }
                }
            }
            return storeCollection;
        }