Esempio n. 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            CustomAction entry = new CustomAction();

            entry.TriggerData = txtTriggerData.Text;
            entry.Trigger     = (CustomAction.ActionTriggerType)cbTriggers.SelectedIndex;
            int value = 0;

            Int32.TryParse(txtPercent.Text, out value);
            entry.Chance = value;
            CustomAction.Action action = new CustomAction.Action();
            action.ActionData = txtActionData.Text;
            action.Type       = (CustomAction.ActionType)cbActions.SelectedIndex;
            entry.Actions.Add(action);
            lstCustomActions.Items.Add(entry);
        }
Esempio n. 2
0
        private void btnAddSubaction_Click(object sender, EventArgs e)
        {
            if (lstCustomActions.SelectedIndex < 0 || lstCustomActions.SelectedIndex > (lstCustomActions.Items.Count - 1))
            {
                MessageBox.Show("Cannot add a subaction when a custom action is not selected.");
                return;
            }

            CustomAction entry = (CustomAction)lstCustomActions.Items[lstCustomActions.SelectedIndex];

            CustomAction.Action action = new CustomAction.Action();
            action.ActionData = txtActionData.Text;
            action.Type       = (CustomAction.ActionType)cbActions.SelectedIndex;
            entry.Actions.Add(action);
            lstCustomActions.Items[lstCustomActions.SelectedIndex] = entry;
            //lstCustomActions.Refresh();
        }