private void button7_Click(object sender, EventArgs e) { SequenceInfo si = comboBox1.SelectedItem as SequenceInfo; if (si != null) { using (SelectActionForm dlg = new SelectActionForm(Core)) { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dlg.SelectedAction != null) { si.Actions.Add(dlg.SelectedAction); ListViewItem lvi = new ListViewItem(new string[] { Utils.LanguageSupport.Instance.GetTranslation(dlg.SelectedAction.Plugin), Utils.LanguageSupport.Instance.GetTranslation(dlg.SelectedAction.Action), Utils.LanguageSupport.Instance.GetTranslation(dlg.SelectedAction.SubAction) }); lvi.Tag = dlg.SelectedAction; listView1.Items.Add(lvi); SequenceInfo.SaveActionSequences(_sequenceInfos); } } } } }
private void button2_Click(object sender, EventArgs e) { SequenceInfo si = comboBox1.SelectedItem as SequenceInfo; if (si != null) { Framework.Interfaces.IPluginUIMainWindow main = (from Framework.Interfaces.IPluginUIMainWindow a in Core.GetPlugin(Framework.PluginType.UIMainWindow) select a).FirstOrDefault(); (this.OwnerPlugin as ActionList).DeleteAction(si.Name); main.RemoveAction(OwnerPlugin, "Action sequence", si.Name); comboBox1.Items.Remove(si); comboBox1_SelectedIndexChanged(this, EventArgs.Empty); _sequenceInfos.Remove(si); SequenceInfo.SaveActionSequences(_sequenceInfos); } }
private void button3_Click(object sender, EventArgs e) { if (textBox1.Text.Length > 0) { SequenceInfo si = new SequenceInfo(); si.Name = textBox1.Text; _sequenceInfos.Add(si); Framework.Interfaces.IPluginUIMainWindow main = (from Framework.Interfaces.IPluginUIMainWindow a in Core.GetPlugin(Framework.PluginType.UIMainWindow) select a).FirstOrDefault(); (this.OwnerPlugin as ActionList).AddNewAction(si.Name); main.AddAction(OwnerPlugin, "Action sequence", si.Name); comboBox1.Items.Add(si); comboBox1.SelectedItem = si; comboBox1_SelectedIndexChanged(this, EventArgs.Empty); SequenceInfo.SaveActionSequences(_sequenceInfos); } }
private void button4_Click(object sender, EventArgs e) { SequenceInfo si = comboBox1.SelectedItem as SequenceInfo; if (si != null) { Framework.Interfaces.IPluginUIMainWindow main = (from Framework.Interfaces.IPluginUIMainWindow a in Core.GetPlugin(Framework.PluginType.UIMainWindow) select a).FirstOrDefault(); (this.OwnerPlugin as ActionList).DeleteAction(si.Name); main.RemoveAction(OwnerPlugin, "Action sequence", si.Name); si.Name = textBox1.Text; (this.OwnerPlugin as ActionList).AddNewAction(si.Name); main.AddAction(OwnerPlugin, "Action sequence", si.Name); typeof(ComboBox).InvokeMember("RefreshItems", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, comboBox1, new object[] { }); comboBox1_SelectedIndexChanged(this, EventArgs.Empty); SequenceInfo.SaveActionSequences(_sequenceInfos); } }
private void button8_Click(object sender, EventArgs e) { SequenceInfo si = comboBox1.SelectedItem as SequenceInfo; if (si != null && listView1.SelectedItems.Count > 0 && listView1.SelectedIndices[0] < listView1.Items.Count - 1) { SequenceInfo.ActionInfo ai = listView1.SelectedItems[0].Tag as SequenceInfo.ActionInfo; if (ai != null) { int index = listView1.SelectedIndices[0] + 1; si.Actions.Remove(ai); si.Actions.Insert(index, ai); comboBox1_SelectedIndexChanged(this, EventArgs.Empty); listView1.Items[index].Selected = true; listView1_SelectedIndexChanged(this, EventArgs.Empty); SequenceInfo.SaveActionSequences(_sequenceInfos); } } }