Ejemplo n.º 1
0
 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.");
         }
     }
 }
Ejemplo n.º 2
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedItem != null)
     {
         MetaTestGroup selected = (MetaTestGroup)comboBox1.SelectedItem;
         comboBox2.Items.Clear();
         comboBox2.Items.AddRange(selected.List.ToArray());
         if (comboBox2.Items.Count > 0)
         {
             comboBox2.SelectedIndex = comboBox2.Items.Count - 1;
         }
         label3.Text = "MetaTest error: " + selected.errorCount() + "\nWarnings count: " + selected.warningCount();
         metaChart1.loadMetaTest(selected);
         sparqlView1.load(selected.MetaTestName);
         label4.Text = "[" + selected.MetaTestName + "] Select execution:";
         label2.Text = "[" + selected.MetaTestName + "] Select Single test of MetaTest:";
     }
 }