예제 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_selectedConnections.Count == 0)
            {
                Utils.ShowWarning("Connection list is empty.", MessageBoxButtons.OK);
                return;
            }

            string templatesFolder = MultiExecSpec.TemplatesDirectory;

            if (!Directory.Exists(templatesFolder))
            {
                Directory.CreateDirectory(templatesFolder);
            }

            string templateName = tbName.Text.Trim();

            if (_isNewTemplate && String.IsNullOrEmpty(templateName))
            {
                Utils.ShowError("Template name is empty!", MessageBoxButtons.OK);
                return;
            }

            string fileName = templatesFolder + templateName + MultiExecSpec.TemplateFileExt;

            if (_isNewTemplate && File.Exists(fileName))
            {
                Utils.ShowError(String.Format("Template with name \'{0}\' already exists!", tbName.Text), MessageBoxButtons.OK);
                return;
            }

            MultiExecSpec.Save(_selectedConnections, fileName);
            DialogResult = DialogResult.OK;
        }
예제 #2
0
        private void saveAsDefaultToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_selectedConnections == null || _selectedConnections.Count == 0)
            {
                Utils.ShowWarning("Connection list is empty.", MessageBoxButtons.OK);
                return;
            }

            MultiExecSpec.Save(_selectedConnections, MultiExecSpec.DefaultTemplate);
        }