private void SaveButton_Click(object sender, EventArgs e) { XElement title = new XElement("title", NameInput.Text); XElement path = new XElement("path", "(command)"); XElement enabled = new XElement("run", "True"); XElement commands = new XElement("commands"); foreach (string command in CommandList.Items) { if (command != "") { commands.Add(new XElement("command", command)); } } XElement action = new XElement("action", title, path, enabled, commands); action.SetAttributeValue("type", "command"); action.SetAttributeValue("id", SaveData.generateId()); SaveData.data.Root.Add(action); SaveData.saveData(); manager.reloadList(); Hide(); }
private void DeleteButton_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to delete this action?", "Confirm deletion", MessageBoxButtons.YesNo) == DialogResult.Yes) { //delet XElement removeAction = new XElement("artifact"); foreach (var action in SaveData.data.Descendants("action")) { if ((string)action.Attribute("id") == id) { removeAction = action; } } removeAction.Remove(); SaveData.saveData(); manager.reloadList(); } }
private void SaveButton_Click(object sender, EventArgs e) { XElement title = new XElement("title", NameInput.Text); XElement path = new XElement("path", PathInput.Text); XElement enabled = new XElement("run", "True"); XElement action = new XElement("action", title, path, enabled); action.SetAttributeValue("type", "program"); action.SetAttributeValue("id", SaveData.generateId()); SaveData.data.Root.Add(action); SaveData.saveData(); manager.reloadList(); Hide(); }
private void EnabledCheck_CheckedChanged(object sender, EventArgs e) { if (SaveData.data != null) { string state = "True"; if (!EnabledCheck.Checked) { state = "False"; } foreach (var action in SaveData.data.Descendants("action")) { if ((string)action.Attribute("id") == id) { foreach (var enabledProp in action.Descendants("run")) { enabledProp.Value = state; } } } SaveData.saveData(); } }