public FormChooseTestName(FormHello formHello, int index)
        {
            InitializeComponent();



            _formHello = formHello;
            _index     = index;
            //marks = new int[3] { 0, 0, 0 };
            _marks = new List <int> {
                0, 0, 0
            };
            buttonNext.Enabled = false;

            textBoxMark5.TextChanged += buttonNext_checkNullMarks;
            textBoxMark4.TextChanged += buttonNext_checkNullMarks;
            textBoxMark3.TextChanged += buttonNext_checkNullMarks;
            textBoxUserChooseTestName.TextChanged += buttonNext_checkNullMarks;
            comboBoxCourse.SelectedIndexChanged   += buttonNext_checkNullMarks;

            comboBoxCourse.Items.AddRange(Courses.Get().ToArray());



            this.MinimumSize = this.Size;
            this.MaximumSize = this.Size;
        }
Exemple #2
0
        public FormCourse(FormHello formHello)
        {
            InitializeComponent();

            listOfCourses.AddRange(Courses.Get().ToArray());
            listBoxCourse.Items.AddRange(Courses.Get().ToArray());

            _formHello = formHello;
        }
Exemple #3
0
        private void предметыToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormCourse formCourse = formCourse = new FormCourse(this);
            var        listBox    = ((ListBox)(formCourse.Controls.Find("listBoxCourse", true)[0]));

            listBox.Items.Clear();
            listBox.Items.AddRange(Courses.Get().ToArray());
            //this.Visible = false;
            formCourse.Visible = true;
        }
Exemple #4
0
 private void buttonCourseSave_Click(object sender, EventArgs e)
 {
     Courses.Set(listOfCourses);
     labelCoursesAreSaved.Visible = true;
     ((ComboBox)(_formHello.Controls.Find("comboBoxCourseFilter", true)[0])).Items.Clear();
     ((ComboBox)(_formHello.Controls.Find("comboBoxCourseFilter", true)[0])).Items.AddRange(Courses.Get().ToArray());
     //_formHello.listOfCourses = listOfCourses;
     //this.Visible = false;
     //_formHello.Visible = true;
     //KeyValuePair<Panel, Test> keyValue in ListTests
     foreach (KeyValuePair <Panel, FormChooseTestName> formCTN in _formHello.ListMarksAndName)
     {
         ComboBox currentCB = (ComboBox)formCTN.Value.Controls.Find("comboBoxCourse", true)[0];
         if (currentCB.SelectedItem != null)
         {
             string bufItem = currentCB.SelectedItem.ToString();
             currentCB.Items.Clear();
             currentCB.Items.AddRange(Courses.Get().ToArray());
             currentCB.SelectedItem = Courses.Get().Find(x => (x == bufItem));
         }
     }
 }
Exemple #5
0
        public FormHello()
        {
            InitializeComponent();

            new TestInizializator().Initialize(this);

            if (!Courses.Get().Contains("<Без предмета>"))
            {
                Courses.Get().Add("<Без предмета>");
            }

            comboBoxCourseFilter.Items.AddRange(Courses.Get().ToArray());

            ListPanelsTestsOnPanel = new List <Panel>();

            try
            {
                //Подгрузка тестов
                var testLoader = new TestLoader();

                var listOfLoadTests = testLoader.LoadTestsFromFolder(new DynamicParams().GetPath());

                foreach (Wrappers.Test test in listOfLoadTests.TestList)
                {
                    ListTestsRef.Add(test);

                    TestOperations = new Panel();

                    _linkLabelTestNew      = new Label();
                    _buttonTestDeleteNew   = new Button();
                    _buttonTestOpenNew     = new Button();
                    _buttonTestMarksNew    = new Button();
                    _buttonTestDownloadDoc = new Button();

                    TestOperations.BackColor = SystemColors.ControlLight;
                    TestOperations.Controls.Add(_linkLabelTestNew);
                    TestOperations.Controls.Add(_buttonTestOpenNew);
                    TestOperations.Controls.Add(_buttonTestMarksNew);
                    TestOperations.Controls.Add(_buttonTestDownloadDoc);
                    TestOperations.Controls.Add(_buttonTestDeleteNew);
                    TestOperations.Name = "panelTestInTestsList" + ListTestsRef.Count;
                    TestOperations.Size = new Size(1100, 51);
                    TestOperations.Tag  = "panelTestInTests";


                    FormChooseTestName formChooseTestName =
                        new FormChooseTestName(this, ListPanelsTestsOnPanel.Count)
                    {
                        startName = test.Name
                    };
                    formChooseTestName.Controls.Find("textBoxUserChooseTestName", true)[0].Text = test.Name;
                    formChooseTestName.Controls.Find("comboBoxCourse", true)[0].Text            = test.Course;
                    formChooseTestName.Controls.Find("textBoxMark5", true)[0].Text = test.Marks.Excellent.ToString();
                    formChooseTestName.Controls.Find("textBoxMark4", true)[0].Text = test.Marks.Good.ToString();
                    formChooseTestName.Controls.Find("textBoxMark3", true)[0].Text = test.Marks.Satisfactory.ToString();
                    formChooseTestName.Tag           = ListPanelsTestsOnPanel.Count;
                    ListMarksAndName[TestOperations] = formChooseTestName;

                    _linkLabelTestNew.AutoSize  = true;
                    _linkLabelTestNew.Font      = new Font("Century Gothic", 11.25F);
                    _linkLabelTestNew.Location  = new Point(3, 15);
                    _linkLabelTestNew.Name      = "linkLabelTest" + ListPanelsTestsOnPanel.Count;
                    _linkLabelTestNew.Size      = new Size(146, 20);
                    _linkLabelTestNew.Text      = test.Name;
                    _linkLabelTestNew.TabStop   = true;
                    _linkLabelTestNew.Tag       = ListPanelsTestsOnPanel.Count;
                    _linkLabelTestNew.TextAlign = ContentAlignment.MiddleCenter;

                    _buttonTestOpenNew.FlatStyle = FlatStyle.Flat;
                    _buttonTestOpenNew.Font      = new Font("Century Gothic", 11.25F);
                    _buttonTestOpenNew.Location  = new Point(485, 5);
                    _buttonTestOpenNew.Name      = "buttonTestOpen" + ListPanelsTestsOnPanel.Count;
                    _buttonTestOpenNew.Size      = new Size(150, 40);
                    _buttonTestOpenNew.Text      = "Открыть тест";
                    _buttonTestOpenNew.UseVisualStyleBackColor = true;
                    _buttonTestOpenNew.Tag       = ListPanelsTestsOnPanel.Count;
                    _buttonTestOpenNew.TextAlign = ContentAlignment.MiddleCenter;

                    _buttonTestMarksNew.FlatStyle = FlatStyle.Flat;
                    _buttonTestMarksNew.Font      = new Font("Century Gothic", 11.25F);
                    _buttonTestMarksNew.Location  = new Point(640, 5);
                    _buttonTestMarksNew.Name      = "buttonTestMarks" + ListPanelsTestsOnPanel.Count;
                    _buttonTestMarksNew.Size      = new Size(140, 40);
                    _buttonTestMarksNew.Text      = "Параметры";
                    _buttonTestMarksNew.UseVisualStyleBackColor = true;
                    _buttonTestMarksNew.Tag       = ListPanelsTestsOnPanel.Count;
                    _buttonTestMarksNew.TextAlign = ContentAlignment.MiddleCenter;

                    _buttonTestDownloadDoc.FlatStyle = FlatStyle.Flat;
                    _buttonTestDownloadDoc.Font      = new Font("Century Gothic", 11.25F);
                    _buttonTestDownloadDoc.Location  = new Point(785, 5);
                    _buttonTestDownloadDoc.Name      = "buttonTestDownloadDoc" + ListPanelsTestsOnPanel.Count;
                    _buttonTestDownloadDoc.Size      = new Size(150, 40);
                    _buttonTestDownloadDoc.Text      = "Скачать в Word";
                    _buttonTestDownloadDoc.UseVisualStyleBackColor = true;
                    _buttonTestDownloadDoc.Enabled   = true;
                    _buttonTestDownloadDoc.Tag       = ListPanelsTestsOnPanel.Count;
                    _buttonTestDownloadDoc.TextAlign = ContentAlignment.MiddleCenter;

                    _buttonTestDeleteNew.FlatStyle = FlatStyle.Flat;
                    _buttonTestDeleteNew.Font      = new Font("Century Gothic", 11.25F);
                    _buttonTestDeleteNew.Location  = new Point(940, 5);
                    _buttonTestDeleteNew.Name      = "buttonTestDelete" + ListPanelsTestsOnPanel.Count;
                    _buttonTestDeleteNew.Size      = new Size(150, 40);
                    _buttonTestDeleteNew.Text      = "Удалить";
                    _buttonTestDeleteNew.UseVisualStyleBackColor = true;
                    _buttonTestDeleteNew.Enabled = true;
                    _buttonTestDeleteNew.Tag     = ListPanelsTestsOnPanel.Count;


                    TestNameAndMarks.Add(test.Name,
                                         new List <int> {
                        test.Marks.Excellent, test.Marks.Good, test.Marks.Satisfactory
                    });

                    var peremTest = new Test(this, test.Name, TestNameAndMarks[test.Name], test.Course);
                    ListTests[TestOperations] = peremTest;


                    ListPanelsTestsOnPanel.Add(TestOperations);
                    panelMain.Controls.Add(TestOperations);


                    _buttonTestOpenNew.Click     += OpenCurrentTest;
                    _buttonTestMarksNew.Click    += TestCurrentMarks;
                    _buttonTestDownloadDoc.Click += TestCurrentDownloadDoc;
                    _buttonTestDeleteNew.Click   += TestCurrentDelete;

                    if (ListPanelsTestsOnPanel.Count > 0)
                    {
                        ListTests[TestOperations].Controls.Find("panelMiddle", true)[0].Controls
                        .Remove(
                            ListTests[TestOperations].Controls.Find("Задание №1", true)[0]);
                    }
                    //Добавление элементов в тест
                    InitTest(ListTestsRef[ListPanelsTestsOnPanel.Count - 1],
                             ListTests[TestOperations]);
                }
                Redistribution(ListPanelsTestsOnPanel);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            _formChooseVzvod = new FormChooseVzvod(this);
            _formSettings    = new FormSettings();


            MinimumSize = Size;
            MaximumSize = Size;
        }