void LoadConfig() { try { string fileName = Path.Combine(Program.MainForm.UserDir, "sru\\sru.xml"); _config = SruConfig.From(fileName); var servers = _config.ListTargets("*"); this.Invoke((Action)(() => { this.comboBox_server.Items.Clear(); foreach (var server in servers) { this.comboBox_server.Items.Add(server.Name); } })); } catch (Exception ex) { this.Invoke((Action)(() => { MessageBox.Show(this, $"装载 sru.xml 出现异常: {ex.Message}"); })); } }
public static SruConfig From(string fileName) { SruConfig result = new SruConfig(fileName); return(result); }