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); }
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(); }
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(); }
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; }