Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         SelectedAction = listView1.SelectedItems[0].Tag as SequenceInfo.ActionInfo;
         DialogResult   = System.Windows.Forms.DialogResult.OK;
     }
 }
Beispiel #2
0
        public SelectActionForm(Framework.Interfaces.ICore core)
            : this()
        {
            this.Text         = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.button1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SELECT);
            this.listView1.Columns[0].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_PLUGIN);
            this.listView1.Columns[1].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ACTION);
            this.listView1.Columns[2].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SUBACTION);

            char[] sep = new char[] { '|' };
            List <SequenceInfo.ActionInfo>      allActions = new List <SequenceInfo.ActionInfo>();
            List <Framework.Interfaces.IPlugin> plugins    = core.GetPlugins();

            foreach (var p in plugins)
            {
                List <string> actions = p.GetActionSubactionList(sep[0]);
                foreach (string s in actions)
                {
                    string[] parts             = s.Split(sep, 2);
                    SequenceInfo.ActionInfo ai = new SequenceInfo.ActionInfo();
                    ai.Plugin = p.GetType().ToString();
                    ai.Action = parts[0];
                    if (parts.Length == 2)
                    {
                        ai.SubAction = parts[1];
                    }
                    else
                    {
                        ai.SubAction = "";
                    }
                    allActions.Add(ai);
                }
            }
            var allact = (from a in allActions select a).OrderBy(x => x.Plugin).ThenBy(x => x.Action).ThenBy(x => x.SubAction);

            foreach (var a in allact)
            {
                ListViewItem lvi = new ListViewItem(new string[] {
                    Utils.LanguageSupport.Instance.GetTranslation(a.Plugin),
                    Utils.LanguageSupport.Instance.GetTranslation(a.Action),
                    Utils.LanguageSupport.Instance.GetTranslation(a.SubAction)
                });
                lvi.Tag = a;
                listView1.Items.Add(lvi);
            }

            listView1.ListViewItemSorter = new Utils.ListViewColumnSorter();
            (listView1.ListViewItemSorter as Utils.ListViewColumnSorter).SortColumn = 0;
            (listView1.ListViewItemSorter as Utils.ListViewColumnSorter).Order      = SortOrder.Ascending;
        }
Beispiel #3
0
        public SelectActionForm(Framework.Interfaces.ICore core)
            : this()
        {
            this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.button1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SELECT);
            this.listView1.Columns[0].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_PLUGIN);
            this.listView1.Columns[1].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ACTION);
            this.listView1.Columns[2].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SUBACTION);

            char[] sep = new char[]{'|'};
            List<SequenceInfo.ActionInfo> allActions = new List<SequenceInfo.ActionInfo>();
            List<Framework.Interfaces.IPlugin> plugins = core.GetPlugins();
            foreach (var p in plugins)
            {
                List<string> actions = p.GetActionSubactionList(sep[0]);
                foreach (string s in actions)
                {
                    string[] parts = s.Split(sep, 2);
                    SequenceInfo.ActionInfo ai = new SequenceInfo.ActionInfo();
                    ai.Plugin = p.GetType().ToString();
                    ai.Action = parts[0];
                    if (parts.Length == 2)
                    {
                        ai.SubAction = parts[1];
                    }
                    else
                    {
                        ai.SubAction = "";
                    }
                    allActions.Add(ai);
                }
            }
            var allact = (from a in allActions select a).OrderBy(x => x.Plugin).ThenBy(x => x.Action).ThenBy(x => x.SubAction);
            foreach (var a in allact)
            {
                ListViewItem lvi = new ListViewItem(new string[]{
                Utils.LanguageSupport.Instance.GetTranslation(a.Plugin),
                Utils.LanguageSupport.Instance.GetTranslation(a.Action),
                Utils.LanguageSupport.Instance.GetTranslation(a.SubAction)
                });
                lvi.Tag = a;
                listView1.Items.Add(lvi);
            }

            listView1.ListViewItemSorter = new Utils.ListViewColumnSorter();
            (listView1.ListViewItemSorter as Utils.ListViewColumnSorter).SortColumn = 0;
            (listView1.ListViewItemSorter as Utils.ListViewColumnSorter).Order = SortOrder.Ascending;

        }
Beispiel #4
0
        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);
                }
            }
        }
Beispiel #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         SelectedAction = listView1.SelectedItems[0].Tag as SequenceInfo.ActionInfo;
         DialogResult = System.Windows.Forms.DialogResult.OK;
     }
 }