public void ProcessClickSaveButton(Window window, bool isEdit, string windowName, string windowImage) { if (isEdit) window.Name = windowName; else window = AddWindow(windowName); if (windowImage == "") window.SetImage("Image/Myo.png"); else window.SetImage(windowImage); }
public void ProcessClickSaveButton(Window window, bool isEdit, string windowName, string windowImage) { if (isEdit) { window.Name = windowName; } else { window = AddWindow(windowName); } if (windowImage == "") { window.SetImage("Image/Myo.png"); } else { window.SetImage(windowImage); } }
//讀檔處理 public void easyControlLoad(string file) { if (!File.Exists(file)) { return; } XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(file); XmlNodeList windowNodeLists = xmlDoc.SelectNodes("easy-control/window"); foreach (XmlNode windowNode in windowNodeLists) { string windowName = windowNode.Attributes["windowName"].Value; string imagePath = windowNode.Attributes["imagePath"].Value; string winIsEnable = windowNode.Attributes["isEnable"].Value; Window window = _model.AddWindow(windowName); window.SetImage(imagePath); if (winIsEnable == "True") { window.IsEnable = true; } else { window.IsEnable = false; } XmlNodeList poseCombinationNodeLists = windowNode.ChildNodes; foreach (XmlNode poseCombinationNode in poseCombinationNodeLists) { PoseCombination poseCombination = new PoseCombination(); string poseCombinationIsContinue = poseCombinationNode.Attributes["isContinue"].Value; string poseCombinationIsEnable = poseCombinationNode.Attributes["isEnable"].Value; XmlNodeList poseKeyLists = poseCombinationNode.ChildNodes; XmlNode poseNode = poseKeyLists.Item(0); string poses = poseNode.InnerText; XmlNode keyNode = poseKeyLists.Item(1); string keys = keyNode.InnerText; XmlNode keyStateNode = poseKeyLists.Item(2); string keyStates = keyStateNode.InnerText; if (poseCombinationIsContinue == "True") { poseCombination.IsContinue = true; } else { poseCombination.IsContinue = false; } if (poseCombinationIsEnable == "True") { poseCombination.IsEnable = true; } else { poseCombination.IsEnable = false; } string[] pose = poses.Split('+'); for (int i = 0; i < pose.Count(); i++) { poseCombination.AddPose(pose[i]); } string[] key = keys.Split('+'); string[] keyState = keyStates.Split('+'); for (int i = 0; i < key.Count(); i++) { switch (keyState[i]) { case "Press": poseCombination.AddKey(_keyMap[key[i]], KeyStates.Press); break; case "Hold": poseCombination.AddKey(_keyMap[key[i]], KeyStates.Hold); break; case "Release": poseCombination.AddKey(_keyMap[key[i]], KeyStates.Release); break; default: break; } } poseCombination.GetImage = GetPoseCombinationImage(poseCombination, 644, 172); window.AddPoseCombination(poseCombination); } } }