Ejemplo n.º 1
0
 //load file and import data from file
 private void load_file_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         string array_file = openFileDialog1.FileName;
         string json       = File.ReadAllText(array_file);
         _label_file_name.Text = array_file;
         test = new AlgorithmTests();
         test = JsonConvert.DeserializeObject <AlgorithmTests>(json);
         test.GetMainReference(this);
         FillUIElements();
         test.DisplayDataFromFile();
     }
 }
Ejemplo n.º 2
0
        //"start test" button funcitonality
        public void btnStartAlgorithmTests_Click(object sender, EventArgs e)
        {
            if (dropdownTestType.SelectedItem == null)
            {
                MessageBox.Show(
                    "Niste odabrali vrstu testa!",
                    "Greška",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                Console.WriteLine(this);
            }

            else if (lbAlgs.Items.Count == 0 && dropdownTestType.SelectedIndex == 0)
            {
                MessageBox.Show(
                    "Niste odabrali nijedan algoritam!",
                    "Greška",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
            }

            else if (!CheckTestCount() && dropdownTestType.SelectedIndex == 0)
            {
                MessageBox.Show(
                    "Niste odabrali broj testova!",
                    "Greška",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
            }

            else if (!CheckTextBoxes() && dropdownTestType.SelectedIndex == 0)
            {
                MessageBox.Show("Niste unijeli veličinu polja!", "Greška",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else if (tbMinValue.Value > tbMaxValue.Value)
            {
                MessageBox.Show("Minimalna vrijednost u polju mora biti manja od maksimalne!",
                                "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else if (tbMinValue.Value == tbMaxValue.Value)
            {
                MessageBox.Show("Minimalna i maksimalna vrijednost ne smiju biti iste!",
                                "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                if (dropdownTestType.SelectedIndex == 0)
                {
                    GetDataFromUI();
                    test = new AlgorithmTests(algorithms, testRepetitions, array_size, min, max);
                    test.GetMainReference(this);
                    newJsonFileName = "test_" + DateTime.Now.ToString("ddMMyy_HHmmss") + ".json";
                }
                btnStartAlgorithmTests.Enabled = false;
                btnStopTesting.Enabled         = true;
                InitializeGraphForm();
                graphForm.EnableChartSeries();
                SetTimer();
                RunAlgorithmTests();
            }
        }