Example #1
0
        private void button_DeleteElement_Click(object sender, EventArgs e)
        {
            Items removed_item = new Items();
            bool  nasiel_sa    = false;

            foreach (Items Item in ItemColection)
            {
                if (Item.name == textBox_name.Text)
                {
                    removed_item = Item;
                    nasiel_sa    = true;
                }
            }
            if (!nasiel_sa)
            {
                MessageBox.Show("Item not found!");
            }
            else
            {
                textBox_name.Text          = "";
                textBox_formula.Text       = "";
                textBox_shortname.Text     = "";
                textBox_concentration.Text = "";
                textBox_mobility.Text      = "Select a new function";
                item_mobility            = null;
                textBox_mass.Text        = "";
                textBox_difusion.Text    = "";
                textBox_difusion.Enabled = true;
                button3.Enabled          = true;
                button4.Enabled          = true;
                ItemColection.Remove(removed_item);
                listBox1.Items.Remove(removed_item);
            }
        }
Example #2
0
 private void button_ClearElement_Click(object sender, EventArgs e)
 {
     textBox_name.Text          = "";
     textBox_formula.Text       = "";
     textBox_shortname.Text     = "";
     textBox_concentration.Text = "";
     textBox_mobility.Text      = "Select a new function";
     textBox_mass.Text          = "";
     textBox_difusion.Text      = "";
     item_mobility            = null;
     textBox_difusion.Enabled = true;
     button3.Enabled          = true;
     button4.Enabled          = true;
     j = 0;
 }
Example #3
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            item_is_selected = true;
            int i = 0;

            foreach (Items Item in ItemColection)
            {
                if (Item.name == listBox1.GetItemText(listBox1.SelectedItem))
                {
                    textBox_name.Text      = Item.name;
                    textBox_formula.Text   = Item.formula;
                    textBox_shortname.Text = Item.s_name;
                    if (Item.concentration > 100)
                    {
                        textBox_concentration.Text = Item.concentration.ToString("0.00E0#", CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        textBox_concentration.Text = Item.concentration.ToString();
                    }
                    textBox_mobility.Text = Item.mobility.representation;
                    item_mobility         = Item.mobility;
                    textBox_mass.Text     = Item.mass.ToString();
                    textBox_difusion.Text = Item.diffusion.ToString();
                    if (Item.cation)
                    {
                        radioButton_cation.Checked  = true;
                        radioButton_neutral.Checked = false;
                        textBox_difusion.Enabled    = true;
                        button3.Enabled             = true;
                        button4.Enabled             = true;
                    }
                    else
                    {
                        radioButton_cation.Checked  = false;
                        radioButton_neutral.Checked = true;
                        textBox_difusion.Enabled    = false;
                        button3.Enabled             = false;
                        button4.Enabled             = false;
                    }
                    i++;
                }
            }
            item_is_selected = false;
        }
Example #4
0
        public void proceed(rate_functions Rate_function, bool invert, bool mobility, bool Cal_control)
        {
            Constant       constant       = new Constant();
            Linear         linear         = new Linear();
            Quadratic      quadratic      = new Quadratic();
            Cubic          cubic          = new Cubic();
            Exponencional  exponencional  = new Exponencional();
            Exponencional2 exponencional2 = new Exponencional2();
            Exponencional3 exponencional3 = new Exponencional3();
            Exponencional4 exponencional4 = new Exponencional4();
            Exponencional5 exponencional5 = new Exponencional5();
            Association    acoss          = new Association();

            if (mobility) // functions for a mobility
            {
                comboBox1.Items.Add(constant);
                comboBox1.Items.Add(linear);
                comboBox1.Items.Add(quadratic);
                comboBox1.Items.Add(cubic);
                comboBox1.Items.Add(exponencional);
                comboBox1.Items.Add(exponencional3);
                comboBox1.Items.Add(exponencional4);
                comboBox1.Items.Add(exponencional5);
            }
            else // functions for a rate konstant
            {
                comboBox1.Items.Add(constant);
                comboBox1.Items.Add(exponencional2);
                comboBox1.Items.Add(exponencional3);
                comboBox1.Items.Add(acoss);
            }
            if (Rate_function != null)
            {
                if (Rate_function.ToString() == constant.ToString())
                {
                    comboBox1.Items.Remove(constant);
                    comboBox1.Items.Add(Rate_function);
                    textBox2.Text     = Rate_function.A.ToString();
                    checkBox2.Checked = Rate_function.A_lock;
                    textBox2.Enabled  = true;
                    checkBox2.Enabled = true;
                    textBox3.Enabled  = false;
                    checkBox3.Enabled = false;
                    textBox4.Enabled  = false;
                    checkBox4.Enabled = false;
                    textBox5.Enabled  = false;
                    checkBox5.Enabled = false;
                    textBox3.Text     = "";
                    textBox4.Text     = "";
                    textBox5.Text     = "";
                }
                if (Rate_function.ToString() == linear.ToString())
                {
                    comboBox1.Items.Remove(linear);
                    comboBox1.Items.Add(Rate_function);
                    textBox2.Text     = Rate_function.A.ToString();
                    checkBox2.Checked = Rate_function.A_lock;
                    textBox3.Text     = Rate_function.B.ToString();
                    checkBox3.Checked = Rate_function.B_lock;
                    textBox2.Enabled  = true;
                    checkBox2.Enabled = true;
                    textBox3.Enabled  = true;
                    checkBox3.Enabled = true;
                    textBox4.Enabled  = false;
                    checkBox4.Enabled = false;
                    textBox5.Enabled  = false;
                    checkBox5.Enabled = false;
                    textBox4.Text     = "";
                    textBox5.Text     = "";
                }
                if (Rate_function.ToString() == quadratic.ToString())
                {
                    comboBox1.Items.Remove(quadratic);
                    comboBox1.Items.Add(Rate_function);
                    textBox2.Text     = Rate_function.A.ToString();
                    checkBox2.Checked = Rate_function.A_lock;
                    textBox3.Text     = Rate_function.B.ToString();
                    checkBox3.Checked = Rate_function.B_lock;
                    textBox4.Text     = Rate_function.C.ToString();
                    checkBox4.Checked = Rate_function.C_lock;
                    textBox2.Enabled  = true;
                    checkBox2.Enabled = true;
                    textBox3.Enabled  = true;
                    checkBox3.Enabled = true;
                    textBox4.Enabled  = true;
                    checkBox4.Enabled = true;
                    textBox5.Enabled  = false;
                    checkBox5.Enabled = false;
                    textBox5.Text     = "";
                }
                if (Rate_function.ToString() == cubic.ToString())
                {
                    comboBox1.Items.Remove(cubic);
                    comboBox1.Items.Add(Rate_function);
                    textBox2.Text     = Rate_function.A.ToString();
                    checkBox2.Checked = Rate_function.A_lock;
                    textBox3.Text     = Rate_function.B.ToString();
                    checkBox3.Checked = Rate_function.B_lock;
                    textBox4.Text     = Rate_function.C.ToString();
                    checkBox4.Checked = Rate_function.C_lock;
                    textBox5.Text     = Rate_function.D.ToString();
                    checkBox5.Checked = Rate_function.D_lock;
                    textBox2.Enabled  = true;
                    checkBox2.Enabled = true;
                    textBox3.Enabled  = true;
                    checkBox3.Enabled = true;
                    textBox4.Enabled  = true;
                    checkBox4.Enabled = true;
                    textBox5.Enabled  = true;
                    checkBox5.Enabled = true;
                }
                if (Rate_function.ToString() == exponencional.ToString())
                {
                    comboBox1.Items.Remove(exponencional);
                    comboBox1.Items.Add(Rate_function);
                    textBox2.Text     = Rate_function.A.ToString();
                    checkBox2.Checked = Rate_function.A_lock;
                    textBox3.Text     = Rate_function.B.ToString();
                    checkBox3.Checked = Rate_function.B_lock;
                    textBox2.Enabled  = true;
                    checkBox2.Enabled = true;
                    textBox3.Enabled  = true;
                    checkBox3.Enabled = true;
                    textBox4.Enabled  = false;
                    checkBox4.Enabled = false;
                    textBox5.Enabled  = false;
                    checkBox5.Enabled = false;
                    textBox4.Text     = "";
                    textBox5.Text     = "";
                }
                if (Rate_function.ToString() == exponencional2.ToString())
                {
                    comboBox1.Items.Remove(exponencional2);
                    comboBox1.Items.Add(Rate_function);
                    textBox2.Text     = Rate_function.A.ToString();
                    checkBox2.Checked = Rate_function.A_lock;
                    textBox3.Text     = Rate_function.B.ToString();
                    checkBox3.Checked = Rate_function.B_lock;
                    textBox2.Enabled  = true;
                    checkBox2.Enabled = true;
                    textBox3.Enabled  = true;
                    checkBox3.Enabled = true;
                    textBox4.Enabled  = false;
                    checkBox4.Enabled = false;
                    textBox5.Enabled  = false;
                    checkBox5.Enabled = false;
                    textBox4.Text     = "";
                    textBox5.Text     = "";
                }
                if (Rate_function.ToString() == exponencional3.ToString())
                {
                    comboBox1.Items.Remove(exponencional3);
                    comboBox1.Items.Add(Rate_function);
                    textBox2.Text     = Rate_function.A.ToString();
                    checkBox2.Checked = Rate_function.A_lock;
                    textBox3.Text     = Rate_function.B.ToString();
                    checkBox3.Checked = Rate_function.B_lock;
                    textBox4.Text     = Rate_function.C.ToString();
                    checkBox4.Checked = Rate_function.C_lock;
                    textBox2.Enabled  = true;
                    checkBox2.Enabled = true;
                    textBox3.Enabled  = true;
                    checkBox3.Enabled = true;
                    textBox4.Enabled  = true;
                    checkBox4.Enabled = true;
                    textBox5.Enabled  = false;
                    checkBox5.Enabled = false;
                    textBox4.Text     = "";
                    textBox5.Text     = "";
                }
                if (Rate_function.ToString() == exponencional4.ToString())
                {
                    comboBox1.Items.Remove(exponencional4);
                    comboBox1.Items.Add(Rate_function);
                    textBox2.Text     = Rate_function.A.ToString();
                    checkBox2.Checked = Rate_function.A_lock;
                    textBox3.Text     = Rate_function.B.ToString();
                    checkBox3.Checked = Rate_function.B_lock;
                    textBox2.Enabled  = true;
                    checkBox2.Enabled = true;
                    textBox3.Enabled  = true;
                    checkBox3.Enabled = true;
                    textBox4.Enabled  = false;
                    checkBox4.Enabled = false;
                    textBox5.Enabled  = false;
                    checkBox5.Enabled = false;
                    textBox4.Text     = "";
                    textBox5.Text     = "";
                }
                if (Rate_function.ToString() == exponencional5.ToString())
                {
                    comboBox1.Items.Remove(exponencional5);
                    comboBox1.Items.Add(Rate_function);
                    textBox2.Text     = Rate_function.A.ToString();
                    checkBox2.Checked = Rate_function.A_lock;
                    textBox3.Text     = Rate_function.B.ToString();
                    checkBox3.Checked = Rate_function.B_lock;
                    textBox2.Enabled  = true;
                    checkBox2.Enabled = true;
                    textBox3.Enabled  = true;
                    checkBox3.Enabled = true;
                    textBox4.Enabled  = false;
                    checkBox4.Enabled = false;
                    textBox5.Enabled  = false;
                    checkBox5.Enabled = false;
                    textBox4.Text     = "";
                    textBox5.Text     = "";
                }
                if (Rate_function.ToString() == acoss.ToString())
                {
                    comboBox1.Items.Remove(acoss);
                    comboBox1.Items.Add(Rate_function);
                    textBox2.Text     = Rate_function.A.ToString();
                    checkBox2.Checked = Rate_function.A_lock;
                    textBox3.Text     = Rate_function.B.ToString();
                    checkBox3.Checked = Rate_function.B_lock;
                    textBox2.Enabled  = true;
                    checkBox2.Enabled = true;
                    textBox3.Enabled  = true;
                    checkBox3.Enabled = true;
                    textBox4.Enabled  = false;
                    checkBox4.Enabled = false;
                    textBox5.Enabled  = false;
                    checkBox5.Enabled = false;
                    textBox4.Text     = "";
                    textBox5.Text     = "";
                }
                comboBox1.SelectedItem = Rate_function;
                comboBox1.Text         = Rate_function.ToString();
            }
            _invert      = invert;
            _mobility    = mobility;
            _cal_control = Cal_control;
        }