Exemplo n.º 1
0
        private void Button_Clickk(object sender, EventArgs e)
        {
            //string buttonText = ((Button)sender).Text;
            Button b = (Button)sender;
            //MessageBox.Show("" + b.Content);
            string cont = (string)b.Content;

            string[] lines     = cont.Split('\n');
            string[] tableName = lines[0].Split(' ');

            //MessageBox.Show(tableName[0].Length+" "+tableName[0]);
            chemistryController = new ChemistryElementController();
            ChemistryElement element = chemistryController.findByTableName(tableName[0]);

            chemistryController.close();

            viewController.checkedChemistryElementPage(element);
        }
Exemplo n.º 2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            switch (comboBox.SelectedIndex)
            {
            case 0:
            {
                chemistryController = new ChemistryElementController();
                ChemistryElement chemistryElement = chemistryController.findByTableName(textBox1.Text);
                chemistryController.close();

                clearScreen();

                try
                {
                    addImage(chemistryElement.GraphicModel, 0);
                    addRichTextBox(chemistryElement, 0);
                }
                catch (NullReferenceException ex)
                {
                }
                break;
            }

            case 1:
                try
                {
                    int group = int.Parse(textBox1.Text);
                } catch (Exception ex) {
                    MessageBox.Show("Only integer value can be read from this text box!!!");
                    return;
                }
                {
                    clearScreen();
                    chemistryController = new ChemistryElementController();
                    List <ChemistryElement> chemistryElements = chemistryController.findAllByGroup(textBox1.Text);


                    for (int i = 0; i < chemistryElements.Count; i++)
                    {
                        addImage(chemistryElements[i].GraphicModel, i);
                        addRichTextBox(chemistryElements[i], i);
                    }
                    chemistryController.close();
                } break;

            case 2:
            {
                if (textBox1.Text != "p" && textBox1.Text != "s" && textBox1.Text != "d")
                {
                    MessageBox.Show("Orbitals can be only like 'p' or 's' or 'd'!!!");
                    return;
                }
                clearScreen();
                chemistryController = new ChemistryElementController();
                List <ChemistryElement> chemistryElements = chemistryController.findAllByOrbital(textBox1.Text);


                for (int i = 0; i < chemistryElements.Count; i++)
                {
                    addImage(chemistryElements[i].GraphicModel, i);
                    addRichTextBox(chemistryElements[i], i);
                }
                chemistryController.close();
            } break;

            case 3:
            {
                clearScreen();
                chemistryController = new ChemistryElementController();
                List <ChemistryElement> elements = chemistryController.findAll();
                for (int i = 0; i < elements.Count; i++)
                {
                    string str = "/MyImages/Графічні моделі/Гідроген.png";
                    addImage(elements[i].GraphicModel, i);
                    addRichTextBox(elements[i], i);
                }
                chemistryController.close();
            } break;
            }
        }