public SingleIputKey(XmlNodeList keyNodes) : base(keyNodes) { this.repeater.Tick += new EventHandler(repeater_Tick); for (int k = 0; k < keyNodes.Count; k++) { switch (keyNodes[k].Name) { case "scancode": uint sc = 0; uint.TryParse(keyNodes[k].InnerText, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out sc); this.keyInput = new KeyInput(sc); if (this.label == null) this.Content = this.keyInput.GetShiftState(ShiftState.None, false); break; case "repeating": if (keyNodes[k].InnerText == "yes") this.Repeating = true; else if (keyNodes[k].InnerText == "no") this.Repeating = false; break; } } }
protected override bool SetValue(string name, string value) { switch (name.ToLower()) { case "scancode": uint scancodeOut = 0; uint.TryParse(value, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out scancodeOut); this.keyInput = new KeyInput(scancodeOut); if (!this.keyInput.IsDeadKey(Ziyi.ShiftState.None, false)) this.Content = this.keyInput.GetShiftState(Ziyi.ShiftState.None, false); break; case "repeating": if (value == "yes" || value == "true") this.Repeating = true; else if (value == "no" || value == "false") this.Repeating = false; break; default: return base.SetValue(name, value); } return true; }