Example #1
0
        public void InsertTemplate(string textTemplate)
        {
            AlterTemplate alterTemplate = new AlterTemplate {
                Insert = true
            };
            DialogResult result = alterTemplate.ShowDialog();

            if (!result.Equals(System.Windows.Forms.DialogResult.OK))
            {
                return;
            }

            try
            {
                Template template = new Template
                {
                    Parent = trvTemplates.SelectedNode.Text,
                    Text   = alterTemplate.TextTemplate
                };
                ListTemplates.Instance().Insert(template);
                Telerik.WinControls.RadMessageBox.Show(Program.LanguageDefault.DictionaryMessage["msgTemplateAdded"]);
            }
            catch (Exception ex)
            {
                Telerik.WinControls.RadMessageBox.Show(ex.Message);
                InsertTemplate(alterTemplate.TextTemplate);
            }
        }
Example #2
0
        private void BtnApplyClick(object sender, EventArgs e)
        {
            AlterTemplate alterTemplate = new AlterTemplate
            {
                ParentTemplate = (trvTemplates.SelectedNode.Parent != null) ? trvTemplates.SelectedNode.Parent.Text : null,
                TextTemplate   = trvTemplates.SelectedNode.Text,
                Insert         = false
            };

            alterTemplate.SetTextTemplate();
            alterTemplate.ShowDialog();
            trvTemplates.SelectedNode.Text = alterTemplate.TextTemplate;
        }