Exemple #1
0
        public View_Form(string path)
        {
            InitializeComponent();
            this.Show();
            this.BackgroundImage = Design.Background;
            Design.Design_for_button(button1);

            CheckBox_Header.ForeColor = Design.Font_color;
            CheckBox_Header.Font      = Design.Font_text;

            CheckBox_Result_tests.ForeColor = Design.Font_color;
            CheckBox_Result_tests.Font      = Design.Font_text;

            CheckBox_Auto_Resume.ForeColor = Design.Font_color;
            CheckBox_Auto_Resume.Font      = Design.Font_text;

            CheckBox_Expression.ForeColor = Design.Font_color;
            CheckBox_Expression.Font      = Design.Font_text;

            CheckBox_Scales.ForeColor = Design.Font_color;
            CheckBox_Scales.Font      = Design.Font_text;

            CheckBox_Answers.ForeColor = Design.Font_color;
            CheckBox_Answers.Font      = Design.Font_text;

            if (!Upload_data_from_file(path))
            {
                MessageBox.Show("Ошибка: при считывани файла.");
                return;
            }
            Add_Text_on_form();
        }
        private void Design_for_Form_Scales()
        {
            BackgroundImage = Design.Background;

            Design.Design_for_button(button_create);
            Design.Design_for_button(button_back);
            Design.Design_for_button(button_next);
            Design.Design_for_button(button_left);
            Design.Design_for_button(button_right);

            Design.Design_for_label(CoScale_label);
            Design.Design_for_label(Scale_label);

            Design.Design_for_label(if_label);
            Design.Design_for_label(name_Scale_label);
            Design.Design_for_label(description_label);

            Design.Design_for_textbox(CoScale_textbox);
            Design.Design_for_textbox(if_textBox);
            Design.Design_for_textbox(name_Scale_textBox);
            Design.Design_for_textbox(description_textBox);

            Scale_label.Font         = new Font("Arial", 24F);
            CoScale_textbox.Location = new Point(CoScale_label.Location.X + 15 + CoScale_label.Width, CoScale_label.Location.Y);
            button_create.Width      = CoScale_textbox.Location.X + CoScale_textbox.Width - CoScale_label.Location.X;
            Hide_Scale();
        }
        private void Design_for_Form_Questions()
        {
            BackgroundImage = Design.Background;

            Design.Design_for_button(button_create);
            Design.Design_for_button(button_back);
            Design.Design_for_button(button_next);
            Design.Design_for_button(button_left);
            Design.Design_for_button(button_right);

            button_add_answer.BackgroundImage    = Design.Background_button_add;
            button_remove_answer.BackgroundImage = Design.Background_button_remove;

            Design.Design_for_label(CoQ_label);
            Design.Design_for_label(CA_label);
            Design.Design_for_label(Q_label);

            Design.Design_for_textbox(CoQ_textbox);


            Q_label.Font         = new Font("Arial", 24F);
            CoQ_textbox.Location = new Point(CoQ_label.Location.X + 15 + CoQ_label.Width, CoQ_label.Location.Y);
            button_create.Width  = CoQ_textbox.Location.X + CoQ_textbox.Width - CoQ_label.Location.X;
            Hide_O();
        }
Exemple #4
0
        private void Design_for_Form_Fuzzy_sets()
        {
            BackgroundImage = Design.Background;

            Design.Design_for_button(button_create);
            Design.Design_for_button(button_back);
            Design.Design_for_button(button_next);
            Design.Design_for_button(button_left);
            Design.Design_for_button(button_right);
            Design.Design_for_button(button_Show);

            Design.Design_for_label(CoFuzzy_sets_label);
            Design.Design_for_label(Fuzzy_sets_label);
            Design.Design_for_label(C_Function_label);
            Design.Design_for_label(label_left_line);
            Design.Design_for_label(label_right_line);
            Design.Design_for_label(label_Fuzzy_set_name);

            button_add_function.BackgroundImage    = Design.Background_button_add;
            button_remove_function.BackgroundImage = Design.Background_button_remove;

            Design.Design_for_textbox(CoFuzzy_sets_textBox);
            Design.Design_for_textbox(textBox_fuzzy_set_name);

            Fuzzy_sets_label.Font         = new Font("Arial", 24F);
            CoFuzzy_sets_textBox.Location = new Point(CoFuzzy_sets_label.Location.X + 15 + CoFuzzy_sets_label.Width, CoFuzzy_sets_label.Location.Y);
            button_create.Width           = CoFuzzy_sets_textBox.Location.X + CoFuzzy_sets_textBox.Width - CoFuzzy_sets_label.Location.X;
            Hide_O();
        }
        public Test_selection()
        {
            InitializeComponent();

            const int Width_Button = 550, Height_Button = 45;

            BackgroundImage = Design.Background;
            Design.Design_for_label(label_SName);
            Design.Design_for_label(label_Name);
            Design.Design_for_label(label_PName);
            Design.Design_for_label(label_day);
            Design.Design_for_label(label_month);
            Design.Design_for_label(label_year);

            this.SuspendLayout(); //Временно приостанавливает логику компоновки для элемента управления.
            List <string> test_names = new List <string>(Additional_functions.Get_filenames(Setting.tests_path));

            Button[] Test_add_button = new Button[test_names.Count];
            Test_add_button[0] = new Button
            {
                Text   = test_names[0],
                Width  = Width_Button,
                Height = Height_Button,
                BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch,
                Font     = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))),
                Location = new Point(50, textBox4.Location.Y + textBox4.Height + 45)
            };
            Design.Design_for_button(Test_add_button[0]);
            Test_add_button[0].Click += new EventHandler(Button_add_test_Click);
            this.Controls.Add(Test_add_button[0]);
            for (int i = 1; i < test_names.Count; i++)
            {
                Test_add_button[i] = new Button
                {
                    Width = Width_Button, Height = Height_Button, Text = test_names[i],
                    BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch,
                    Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)))
                };
                Test_add_button[i].Location = new Point(50, Test_add_button[i - 1].Location.Y + Test_add_button[i - 1].Height + 5);
                this.Controls.Add(Test_add_button[i]);
                Test_add_button[i].Click += new EventHandler(Button_add_test_Click);
                Design.Design_for_button(Test_add_button[i]);
            }
            Button StatTest = new Button {
                Width = Width_Button - 100, Height = Height_Button, Text = "Начать тестирование"
            };

            StatTest.Click += new EventHandler(StatTest_Click);
            Design.Design_for_button(StatTest);
            StatTest.Location = new Point(150, Test_add_button[Test_add_button.Length - 1].Location.Y + Test_add_button[Test_add_button.Length - 1].Height + 35);
            this.Controls.Add(StatTest);

            this.AutoScrollMargin = new System.Drawing.Size(0, 20);
            this.ResumeLayout(false);//
            this.Show();
        }
 public ASPD()
 {
     InitializeComponent();
     Design.Design_for_button(button_update);
     Design.Design_for_button(button_testing);
     Design.Design_for_button(button_new_test);
     Design.Design_for_button(button_Test_change);
     BackgroundImage = Design.Background;
     Button_update_Click(null, null);
 }
 private void Design_for_Form_header()
 {
     BackgroundImage = Design.Background;
     Design.Design_for_label(test_name_label);
     Design.Design_for_label(description_label);
     Design.Design_for_label(limitation_label);
     Design.Design_for_button(button_create);
     Design.Design_for_checkbox(NL_checkBox);
     Design.Design_for_checkbox(OO_checkBox);
     Design.Design_for_checkbox(AO_checkBox);
 }
Exemple #8
0
        void ShowTest(List <string> Tests, int Test_number, string FileName)
        {
            Test TEST = new Test();

            if (!TEST.Creat_test(Tests[Test_number]))
            {
                MessageBox.Show($"Ошибка: Файл - \"{Tests[Test_number]}\" содержит ошибку.");
                this.Close();
                throw new Exception($"Ошибка: Файл - \"{Tests[Test_number]}\" содержит ошибку.");
            }
            TESTS.Add(TEST);                                                                   // add test in list
            this.Text                   = TEST._Header.Name;
            LABEL_TEST_NAME.Text        = TEST._Header.Name;                                   // test name
            LABEL_TEST_DESCRIPTION.Text = TEST._Header.Description;                            // test description
            List <Questions_Form> LIST_OF_LABELS_TEST_QUESTIONS = new List <Questions_Form>(); // список вопросов

            for (int i = 0; i < TEST._Questions.Count; i++)
            {
                Questions_Form temp = new Questions_Form();
                Form_FQ(TEST._Questions[i], temp, i);
                LIST_OF_LABELS_TEST_QUESTIONS.Add(temp);
            }
            Button BUTTON_TEST_FINISH = new Button
            {
                Size = new System.Drawing.Size(200, 45),
                Text = "Завершить тестирование",
                UseVisualStyleBackColor = true
            };

            Design.Design_for_button(BUTTON_TEST_FINISH);

            BUTTON_TEST_FINISH.Click += new System.EventHandler(BUTTON_TEST_FINISH_Click);

            Auto_Size(LABEL_TEST_NAME, LABEL_TEST_DESCRIPTION, LIST_OF_LABELS_TEST_QUESTIONS, BUTTON_TEST_FINISH);

            void BUTTON_TEST_FINISH_Click(object sender, EventArgs e) // Кновка закончить тест.
            {
                Answers_to_Test answers_to_the_Test = new Answers_to_Test();

                Create_Answer_list(LIST_OF_LABELS_TEST_QUESTIONS, answers_to_the_Test);//формируем список вопросов и ответов на эти вопросы.

                if (TEST._Header.Verifier == VerificationDescriptors._ONLY_ONE)
                {
                    for (int i = 0; i < answers_to_the_Test.Count; i++)
                    {
                        if (answers_to_the_Test[i].Count != 1)
                        {
                            string Err = "Ошибка: на вопрос: ";
                            for (; i < answers_to_the_Test.Count; i++)
                            {
                                if (answers_to_the_Test[i].Count != 1)
                                {
                                    Err += $" {Convert.ToString(i + 1)}";
                                }
                            }
                            MessageBox.Show($"{Err} должен быть один.");
                            return;
                        }
                    }
                }

                if (TEST._Header.Verifier == VerificationDescriptors._AT_LEAST_ONE)
                {
                    for (int i = 0; i < answers_to_the_Test.Count; i++)
                    {
                        if (answers_to_the_Test[i].Count == 0)
                        {
                            string Err = "Ошибка: вы не ответили на вопрос: ";
                            for (; i < answers_to_the_Test.Count; i++)
                            {
                                if (answers_to_the_Test[i].Count == 0)
                                {
                                    Err += $" {Convert.ToString(i + 1)}";
                                }
                            }
                            MessageBox.Show(Err);
                            return;
                        }
                    }
                }

                Answer_to_all_tests.Add(answers_to_the_Test);
                if (Test_number < Tests.Count - 1)
                {
                    this.Controls.Clear();
                    ShowTest(Tests, Test_number + 1, FileName);
                }
                else
                {
                    Test_parser.Create_an_automatic_resume(TESTS, Answer_to_all_tests, FileName);
                    this.Close();
                }
            }
        }