Ejemplo n.º 1
0
        private void AddActionButton_Click(object sender, EventArgs e)
        {
            FormAction newActionForm = new FormAction();

            if (newActionForm.ShowDialog() == DialogResult.OK && newActionForm.Action.IsValid)
            {
                actionList.Add(newActionForm.Action);

                listBox1.DataSource = null;
                listBox1.DataSource = actionList;
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            FormAction   newActionForm    = new FormAction();
            DialogResult actionFormResult = newActionForm.ShowDialog();

            if (actionFormResult == DialogResult.OK)
            {
                Actions myNewAction = new Actions(newActionForm.selectedType, newActionForm.selectedKey, newActionForm.modifier, newActionForm.selectedTimer);

                actionList.Add(myNewAction);

                listBox1.DataSource = null;
                listBox1.DataSource = actionList;
            }
        }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            Actions a = (Actions)listBox1.SelectedItem;

            if (a != null)
            {
                FormAction formEditAction = new FormAction(a);
                formEditAction.ShowDialog();

                a.Keys        = formEditAction.SelectedKey;
                a.Type        = formEditAction.SelectedType;
                a.KeyModifier = formEditAction.Modifier;
                a.Timer       = (float)formEditAction.SelectedTimer;

                listBox1.DataSource = null;
                listBox1.DataSource = ActionList;
            }
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            FormAction newActionForm = new FormAction();

            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);

                    listBox1.DataSource = null;
                    listBox1.DataSource = ActionList;
                }
            }
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e) {
            FormAction newActionForm = new FormAction();
            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);

                    listBox1.DataSource = null;
                    listBox1.DataSource = actionList;
                }
            }


        }
Ejemplo n.º 6
0
        private void EditActionButton_Click(object sender, EventArgs e)
        {
            Actions a = (Actions)listBox1.SelectedItem;

            if (a != null)
            {
                FormAction formEditAction = new FormAction(a.Clone());
                if (formEditAction.ShowDialog() == DialogResult.OK && formEditAction.Action.IsValid)
                {
                    var index = actionList.IndexOf(a);
                    if (index >= 0)
                    {
                        actionList.RemoveAt(index);
                        actionList.Insert(index, formEditAction.Action);

                        listBox1.DataSource = null;
                        listBox1.DataSource = actionList;
                    }
                }
            }
        }
Ejemplo n.º 7
0
        private void button2_Click(object sender, EventArgs e)
        {
            Actions a = (Actions)listBox1.SelectedItem;

            if (a != null)
            {
                FormAction   formAction       = new FormAction(a);
                DialogResult formActionResult = formAction.ShowDialog();

                if (formActionResult == DialogResult.OK)
                {
                    a.keys        = formAction.selectedKey;
                    a.type        = formAction.selectedType;
                    a.keyModifier = formAction.modifier;
                    a.timer       = (float)formAction.selectedTimer;

                    listBox1.DataSource = null;
                    listBox1.DataSource = actionList;
                }
            }
        }
Ejemplo n.º 8
0
		private void ButtonAdd_Click(object sender, EventArgs e)
		{
			using (FormAction form = new FormAction())
			{				
				form.ShowDialog();

				if (form.SelectedType != "")
				{
					if (form.SelectedType == "Key press" && form.SelectedKey != Keys.None ||
						form.SelectedType == "Timer" && form.SelectedTimer != 0)
					{
						Actions myNewAction = new Actions(form.SelectedType,
							form.SelectedKey,
							form.modifier,
							form.SelectedTimer);

						actionList.Add(myNewAction);

						ListCommands.DataSource = null;
						ListCommands.DataSource = actionList;
					}
				} 
			}
		}
Ejemplo n.º 9
0
		private void ButtonEdit_Click(object sender, EventArgs e)
		{
			Actions a = (Actions)ListCommands.SelectedItem;
			if (a != null)
			{
				FormAction formEditAction = new FormAction(a);
				formEditAction.ShowDialog();

				a.keys = formEditAction.SelectedKey;
				a.type = formEditAction.SelectedType;
				a.keyModifier = formEditAction.modifier;
				a.timer = (float)formEditAction.SelectedTimer;

				ListCommands.DataSource = null;
				ListCommands.DataSource = actionList;
			}
		}
Ejemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            FormAction newActionForm = new FormAction();
            DialogResult actionFormResult = newActionForm.ShowDialog();

            if (actionFormResult == DialogResult.OK) {

                Actions myNewAction = new Actions(newActionForm.selectedType, newActionForm.selectedKey, newActionForm.modifier, newActionForm.selectedTimer);

                actionList.Add(myNewAction);

                listBox1.DataSource = null;
                listBox1.DataSource = actionList;
            }
        }
Ejemplo n.º 11
0
        private void button2_Click(object sender, EventArgs e)
        {
            Actions a = (Actions)listBox1.SelectedItem;
            if (a != null) {
                FormAction formAction = new FormAction(a);
                DialogResult formActionResult = formAction.ShowDialog();

                if (formActionResult == DialogResult.OK)
                {
                    a.keys = formAction.selectedKey;
                    a.type = formAction.selectedType;
                    a.keyModifier = formAction.modifier;
                    a.timer = (float)formAction.selectedTimer;

                    listBox1.DataSource = null;
                    listBox1.DataSource = actionList;
                }

            }
        }