private void fromXml(XmlReader r) { for (int i = 0; i < r.AttributeCount; i++) { r.MoveToAttribute(i); switch (r.Name) { case "Event": this.evstring = r.Value; break; case "Modifier": foreach(string mod in parent.Modifiers) { if(String.Equals(mod, r.Value)) { this.modifier = mod; modifiercode = parent.ParseModifierToCode(mod); break; } } break; case "Key": keystring = r.Value; keycode = parent.ParseStringToKeyCode(r.Value); break; case "Activity": foreach (string act in parent.Activities) { if (String.Equals(act.ToString(), r.Value)) { this.activity = act; break; } } break; case "Context": context = r.Value; break; } } r.MoveToElement(); foreach (EventObject ev in parent.Events) { if (String.Equals(ev.EvString, this.evstring)) { this.ev = ev; } } return; }
public UserCommand(EventObject handler, string key, string activity, string modifier, string evstr, UserCommandMapping par) { //if (handler == null) //{ // log.ErrorFormat("handler == null"); //} //if (par == null) //{ // log.ErrorFormat("par == null"); //} ev = handler; parent = par; this.activity = activity; this.modifier = modifier; this.modifiercode = parent.ParseStringToKeyCode(modifier); this.evstring = evstr; this.keystring = key; this.keycode = parent.ParseStringToKeyCode(keystring); this.context = ev.Context; }