コード例 #1
0
        private void btnEditMessageTemplate_Click(object sender, EventArgs e)
        {
            if (lvMessageTemplates.SelectedItems.Count == 0)
            {
                return;
            }
            MessageTemplate messageTemplate = (MessageTemplate)lvMessageTemplates.SelectedItems[0].Tag;

            Debug.Assert(messageTemplate != null, "Message template not selected!");
            AddMessageTemplateForm frm = new AddMessageTemplateForm(messageTemplate);

            if (DialogResult.OK != frm.ShowDialog())
            {
                return;
            }
            try
            {
                ServicesProvider.GetInstance().GetMessageTemplateServices().Update(frm.MessageTemplate);
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            LoadMessageTemplates();
        }
コード例 #2
0
        private void btnAddMessageTemplate_Click(object sender, EventArgs e)
        {
            AddMessageTemplateForm frm = new AddMessageTemplateForm();

            if (DialogResult.OK != frm.ShowDialog())
            {
                return;
            }
            try
            {
                ServicesProvider.GetInstance().GetMessageTemplateServices().Add(frm.MessageTemplate);
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            LoadMessageTemplates();
        }