private void button1_Click(object sender, EventArgs e)
 {
     openFileDialog1.Filter = "json files (*.json)|*.json|All files (*.*)|*.*";
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         try {
             thereAreAllMetricsNeeded = true;
             var     myJsonString = File.ReadAllText(openFileDialog1.FileName);
             JObject myJObject    = JObject.Parse(myJsonString);
             comboBox1.Items.Clear();
             dictionary = new Dictionary <String, MetaTestGroup>();
             foreach (JProperty item in myJObject.Children())
             {
                 MetaTestResult mtr = new MetaTestResult((JObject)myJObject[item.Name]);
                 MetaTestGroup  mtg;
                 if (dictionary.TryGetValue(mtr.Name, out mtg))
                 {
                     mtg.List.Add(mtr);
                     dictionary.Remove(mtr.Name);
                 }
                 else
                 {
                     mtg = new MetaTestGroup(mtr.Name);
                     mtg.List.Add(mtr);
                 }
                 dictionary.Add(mtr.Name, mtg);
             }
             int count    = 0;
             int warnings = 0;
             foreach (String name in dictionary.Keys)
             {
                 MetaTestGroup mtg;
                 if (dictionary.TryGetValue(name, out mtg))
                 {
                     count    += mtg.errorCount();
                     warnings += mtg.warningCount();
                     comboBox1.Items.Add(mtg);
                 }
             }
             if (comboBox1.Items.Count > 0)
             {
                 comboBox1.SelectedIndex = 0;
             }
             labelInfo.Text = "Number of MetaTest: " + comboBox1.Items.Count
                              + "\nError count: " + count + "\nWarnings count: " + warnings;
             labelLoadedTest.Text = "Loaded: " + openFileDialog1.SafeFileName;
             allMetricChart1.loadMetaTest(dictionary.Values.ToList <MetaTestGroup>());
             popolateDataGrid(dictionary);
         }
         catch (Exception ex) {
             Console.WriteLine("Not valid json file: " + ex.Message);
             MessageBox.Show("Not valid json file.");
         }
     }
 }
 private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedItem != null)
     {
         MetaTestResult selected = (MetaTestResult)comboBox2.SelectedItem;
         singleTestView1.loadSingleTest(selected);
         comboBox3.Items.Clear();
         comboBox3.Items.AddRange(selected.Tests.ToArray());
         if (comboBox3.Items.Count > 0)
         {
             comboBox3.SelectedIndex = comboBox3.Items.Count - 1;
         }
     }
 }
        public void loadSingleTest(MetaTestResult mt)
        {
            labelInfo.Text = "Error count: " + mt.errorCount() + "\nWarnings count: " + mt.warningCount() + "\nPrepare Insert: " + mt.PercentagePreInsert + "%";

            metricsTable1.loadPhases(mt.Avarages);
        }