コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form_ActionEditor newActionForm = new Form_ActionEditor();

            newActionForm.ShowDialog();

            if (newActionForm.selectedType != "")
            {
                if (newActionForm.selectedType == "Key press" && newActionForm.selectedKey != Keys.None || newActionForm.selectedType == "Timer" && newActionForm.selectedTimer != 0)
                {
                    Actions myNewAction = new Actions(newActionForm.selectedType, newActionForm.selectedKey, newActionForm.modifier, newActionForm.selectedTimer);
                    actionList.Add(myNewAction);
                    listBox_MacroList.DataSource = null;
                    listBox_MacroList.DataSource = actionList;
                }
            }
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Actions referenceAction = (Actions)listBox_MacroList.SelectedItem;

            // We are touching the action by reference.
            if (referenceAction != null)
            {
                Form_ActionEditor formEditAction = new Form_ActionEditor(referenceAction);
                formEditAction.ShowDialog();
                referenceAction.keys        = formEditAction.selectedKey;
                referenceAction.type        = formEditAction.selectedType;
                referenceAction.keyModifier = formEditAction.modifier;
                referenceAction.timer       = (float)formEditAction.selectedTimer;
                // Reset the DataSource and instanciate from class member reference
                listBox_MacroList.DataSource = null;
                listBox_MacroList.DataSource = actionList;
            }
        }