private void LoadDefaultConfig() { string defaultConfig = ConfigurationSettings.AppSettings["DefaultConfigFile"]; if (defaultConfig != null) { if (File.Exists(defaultConfig)) { FileInfo info = new FileInfo(defaultConfig); try { this.bindingSource.Clear(); this.bindingSource.Add(BenchMarkConfiguration.Load(info.FullName)); // Set the second TAB as the active this.tabBenchmark.SelectedTab = this.tabRun; } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error loading config file"); } } } }
private void cmdLoad_Click(object sender, System.EventArgs e) { OpenFileDialog openDlg = new OpenFileDialog(); openDlg.Filter = "Archivos Config (*.config)|*.config|" + "All files (*.*)|*.*"; openDlg.ShowDialog(); this.Refresh(); string fileName = openDlg.FileName; if (fileName != null && fileName.Length > 0) { try { FileInfo info = new FileInfo(fileName); this.bindingSource.Clear(); this.bindingSource.Add(BenchMarkConfiguration.Load(info.FullName)); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error loading config file"); } } }