Пример #1
0
        // click on dynamic added Buttons
        private void btnComment_Click(object sender, EventArgs e)
        {
            // add sender to vector steps
            Button          obj  = (Button)sender;
            ButttonInfoStep step = new ButttonInfoStep((FormMain.ButtonInfo)obj.Tag);

            vButtonSteps.Add(step);
            bIsLastStep = true;
            int i = 0;

            // show extended info - combobox(es)
            if (step.m_vGroups.Count > 0)
            {
                foreach (FormMain.GroupsInfo cmb in step.m_vGroups)
                {
                    ShowCombobox(step, cmb, i++);
                    bIsLastStep = false;
                }
            }
            // show next buttons (with pid == current button id)
            else
            {
                List <FormMain.ButtonInfo> results = _Owner._Owner.m_vButtons.FindAll(
                    delegate(FormMain.ButtonInfo item)
                {
                    return(item.m_pid == step.m_id);
                }
                    );
                foreach (FormMain.ButtonInfo button in results)
                {
                    ShowButton(button, i++);
                    bIsLastStep = false;
                }
            }

            // if last step
            if (bIsLastStep)
            {
                panelButtons.Controls.Clear();
                btnSave.Enabled   = true;
                textbox           = new System.Windows.Forms.TextBox();
                textbox.Multiline = true;
                textbox.Location  = new Point(5, 5);
                textbox.Size      = new Size(panelButtons.Size.Width - 10, panelButtons.Size.Height - 10);
                textbox.Visible   = true;
                panelButtons.Controls.Add(textbox);
            }
        }
Пример #2
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            // if first step
            if (vButtonSteps.Count == 0)
            {
                bIsComentFill = false;
                setCommentState(false);
                return;
            }

            // other steps
            ButttonInfoStep last_step = vButtonSteps[vButtonSteps.Count - 1];

            // if showed comboboxes
            if (last_step.m_vSelectedGroups.Count > 0)
            {
                if (last_step.m_vGroups.Count > 0)
                {
                    int i = 0;
                    foreach (FormMain.GroupsInfo cmb in last_step.m_vGroups)
                    {
                        ShowCombobox(last_step, cmb, i++);
                    }
                    last_step.m_vSelectedGroups.Clear();
                }
            }
            // if showed buttons
            else
            {
                // show prev element:buttons
                int i = 0;
                List <FormMain.ButtonInfo> results = _Owner._Owner.m_vButtons.FindAll(
                    delegate(FormMain.ButtonInfo item)
                {
                    return(item.m_pid == last_step.m_pid);
                }
                    );
                foreach (FormMain.ButtonInfo button in results)
                {
                    ShowButton(button, i++);
                }
                // delete last element
                vButtonSteps.RemoveAt(vButtonSteps.Count - 1);
            }
        }