Example #1
0
 private void onNewConfigClick(object sender, EventArgs e)
 {
     try
     {
         this._reset();
         var healthCheck         = new HealthCheck();
         var group               = healthCheck.InsertNewTestGroup();
         var testGroupDictionary = new Dictionary <string, TestGroup>();
         testGroupDictionary.Add(TestGroup.UNKNOWN_GROUP, group);
         healthCheck.TestDictionary = testGroupDictionary;
         var folder = @"C:\Temp";
         if (!Directory.Exists(folder))
         {
             Directory.CreateDirectory(folder);
         }
         var idx = 0;
         var defaultJsonFileName = HealthCheck.DEFAULT_JSON_FILE_NAME.Replace(".json", string.Empty);
         foreach (var f in Directory.GetFiles(folder, string.Format("{0}_*.json", defaultJsonFileName)))
         {
             var ns = f.Replace(string.Format(@"{0}\{1}_", folder, defaultJsonFileName), string.Empty).Replace(".json", string.Empty);
             if (string.IsNullOrEmpty(ns))
             {
                 ns = "0";
             }
             var n = int.Parse(ns);
             if (n >= idx)
             {
                 idx = n;
             }
         }
         SelectedJsonFile = Path.Combine(@"C:\Temp", string.Format("{0}_{1}.json", defaultJsonFileName, (idx + 1).ToString("d3")));
         _enableGUI(healthCheck);
         AllowToRun(_validate());
     }
     catch (Exception ex)
     {
         _parentForm.ShowMessage(ex.Message, true);
     }
 }