Example #1
0
        /// <summary>
        /// function that opens Condition Form with selected Condition Information.
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">event arguments</param>
        private void buttonChangeCon_Click(object sender, EventArgs e)
        {
            int index_c = this.listBoxCells.SelectedIndex;
            int index_m = this.listBoxMutations.SelectedIndex;
            int index   = this.listBoxConditions.SelectedIndex;

            if (index != -1 && index_c != -1 && index_m != -1)
            {
                ConditionForm form = new ConditionForm(this.list_cells[index_c].mutations[index_m].conditons[index]);
                form.ShowDialog();

                if (form.DialogResult == DialogResult.OK)
                {
                    Condition myCon = form.my_condition;
                    if (myCon != null)
                    {
                        this.list_cells[index_c].mutations[index_m].conditons.RemoveAt(index);
                        this.list_cells[index_c].mutations[index_m].conditons.Add(myCon);
                        this.listBoxMutations_SelectedIndexChanged(null, null);
                    }
                    else
                    {
                        this.errorMessages("Somehow the condition object was empty, try again.");
                    }
                }
            }
            else
            {
                this.errorMessages("You need to select a cell, mutation and condition!");
            }
        }
Example #2
0
        /// <summary>
        /// function reacts on add condition button click, creates a condition and form and on sucess
        /// saves condition in the selected mutation of the selected cell.
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">event arguments</param>
        private void buttonAddCon_Click(object sender, EventArgs e)
        {
            int indexCell = this.listBoxCells.SelectedIndex;
            int indexMut  = this.listBoxMutations.SelectedIndex;

            if (indexCell != -1 && indexMut != -1)
            {
                //create form
                ConditionForm form = new ConditionForm();
                form.ShowDialog();

                //check for sucess
                if (form.DialogResult == DialogResult.OK)
                {
                    Condition myCon = form.my_condition;
                    if (myCon != null)
                    {
                        this.list_cells[indexCell].mutations[indexMut].conditons.Add(myCon);
                    }
                    else
                    {
                        this.errorMessages("Somehow the condition object was empty, try again.");
                    }
                }
            }
            else
            {
                errorMessages("You need to select a cell and mutation!");
            }
            //update listbox
            this.listBoxMutations_SelectedIndexChanged(null, null);
        }