private void LoadSelectedTemplate() { try { toolStrip1.Enabled = false; ClearConnectionListView(); if (cmbTemplates.SelectedIndex == 0) { return; } string templateFileName = SelectedTemplateFileName; if (!File.Exists(templateFileName)) { Utils.ShowError(String.Format("Template file does not exist.\r\n{0}", templateFileName), MessageBoxButtons.OK); return; } _selectedConnections = MultiExecSpec.Load(templateFileName); RenderConnectionsInListView(_selectedConnections); } finally { toolStrip1.Enabled = true; } }
private void PrepareEdit(string templateName) { string templateFile = MultiExecSpec.TemplatesDirectory + templateName + MultiExecSpec.TemplateFileExt; try { _initializing = true; tbName.Text = templateName; _selectedConnections = MultiExecSpec.Load(templateFile); PopulateServers(); PopulateDatabases(); RenderConnectionsInListView(_selectedConnections); } finally { _initializing = false; } }
private void LoadDefaultTemplate(bool showNoDefaultInfo) { if (!File.Exists(MultiExecSpec.DefaultTemplate)) { ClearConnectionListView(); if (showNoDefaultInfo) { Utils.ShowInfo("Default connection list template not defined.\r\nPlease load a template and use Default -> Save As Default to save a default connection list template.", MessageBoxButtons.OK); } return; } _selectedConnections = MultiExecSpec.Load(MultiExecSpec.DefaultTemplate); _loadingTemplates = true; cmbTemplates.SelectedIndex = 0; _loadingTemplates = false; RenderConnectionsInListView(_selectedConnections); }