示例#1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string name;

            using (TemplateRenameForm form = new TemplateRenameForm())
            {
                form.Text            = "New Template";
                form.NameValidating += new CancelEventHandler(validateAddName);
                if (form.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                name = form.TemplateName;
            }

            using (TemplateEditorForm form = new TemplateEditorForm())
            {
                form.Text = string.Format(form.Text, name);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    form.SaveFile(NameToPath(name));
                    RefreshList();
                    lstTemplate.SelectedItem = name;
                }
            }
        }
示例#2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            string name = lstTemplate.SelectedItem as string;

            using (TemplateEditorForm form = new TemplateEditorForm())
            {
                form.Text = string.Format(form.Text, name);
                form.LoadFile(NameToPath(name));
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    form.SaveFile(NameToPath(name));
                }
            }
        }