void Application_ItemSend(object Item, ref bool Cancel)
        {
            var mail = Item as MailItem;
            if (mail == null) return;

            var cfg = ServiceLocator.ConfigPersister.GetConfig();
            var subject = new EnhancedSubject(mail.Subject, cfg);
            //var usedTopics = ServiceLocator.TopicPersister.GetTopics();

            var dlg = new MailModDialog(subject);
            var res = dlg.ShowDialog();

            switch (res)
            {
                case DialogResult.OK:
                    var newSub = subject.Subject;
                    if (subject.Topic != null && !string.IsNullOrWhiteSpace(subject.Topic.Title))
                        newSub = "[" + subject.Topic + "] " + subject.Subject;

                    mail.Subject = newSub;

                    // add new topic to store
                    ServiceLocator.TopicPersister.AddTopic(subject.Topic);
                    break;

                case DialogResult.Abort:
                    Cancel = true;
                    break;
            }
        }
Exemple #2
0
        void Application_ItemSend(object Item, ref bool Cancel)
        {
            var mail = Item as MailItem;

            if (mail == null)
            {
                return;
            }

            var cfg     = ServiceLocator.ConfigPersister.GetConfig();
            var subject = new EnhancedSubject(mail.Subject, cfg);
            //var usedTopics = ServiceLocator.TopicPersister.GetTopics();

            var dlg = new MailModDialog(subject);
            var res = dlg.ShowDialog();

            switch (res)
            {
            case DialogResult.OK:
                var newSub = subject.Subject;
                if (subject.Topic != null && !string.IsNullOrWhiteSpace(subject.Topic.Title))
                {
                    newSub = "[" + subject.Topic + "] " + subject.Subject;
                }

                mail.Subject = newSub;

                // add new topic to store
                ServiceLocator.TopicPersister.AddTopic(subject.Topic);
                break;

            case DialogResult.Abort:
                Cancel = true;
                break;
            }
        }
 public MailModDialog(EnhancedSubject subject)
     : this()
 {
     _subject = subject;
     _topic = ThisAddIn.ServiceLocator.TopicPersister.GetTopics();
 }
 public MailModDialog(EnhancedSubject subject)
     : this()
 {
     _subject = subject;
     _topic   = ThisAddIn.ServiceLocator.TopicPersister.GetTopics();
 }