Esempio n. 1
0
 /// <summary>
 /// This action is performed when selection of mails changes in outlook
 /// </summary>
 /// <param name="mails">List of selected mailitems</param>
 /// <param name="func">
 /// function, that gets 1 argument, the original MailItem. This function should implement
 /// the actions we want to do when replying/forwarding the mail
 /// </param>
 public void NewSelectionMails(List <MailItem> mails, MWReplyAction func)
 {
     // check if mails are the same as SelectionMails
     if (mails.Count == SelectionMails.Count)
     {
         bool same = true;
         foreach (MailItem mail in mails)
         {
             if (!SelectionMails.ContainsKey(mail.EntryID))
             {
                 same = false;
             }
         }
         // Lists are the same, no need to create new objects
         if (same)
         {
             return;
         }
     }
     // first clear the current selection, and unsubscribe
     this.ClearMails(SelectionMails);
     // add each mail in selection to the monitor
     foreach (MailItem mail in mails)
     {
         if (Utils.CheckItemValid(mail))
         {
             Utils.Debug($"Add selection mail {mail.Subject}");
             SelectionMails.Add(mail.EntryID, new MonitoredMail(mail, func));
         }
     }
 }
 public MonitoredMail(MailItem item, MWReplyAction func)
 {
     this.item       = item;
     action          = func;
     ReplyHandler    = SetSendHandler;
     ReplyAllHandler = SetSendHandler;
     ForwardHandler  = SetSendHandler;
     ((ItemEvents_10_Event)this.item).Reply    += ReplyHandler;
     ((ItemEvents_10_Event)this.item).ReplyAll += ReplyAllHandler;
     ((ItemEvents_10_Event)this.item).Forward  += ForwardHandler;
     Utils.Debug("Handlers are set");
 }
Esempio n. 3
0
 public void AddInspectorMail(Inspector inspector, MailItem item, MWReplyAction func)
 {
     /* we need to add to inspector only if it's an existing mail, not a draft one
      * Even if we already have this mail in selection items, we might select other mails while
      * the inspector is still open in the background
      */
     if (item.EntryID != null)
     {
         Utils.Debug($"New Inspector mail added {item.Subject}");
         MonitoredMail m = new MonitoredMail(item, func);
         InspectorMails.Add(item.EntryID, m);
         ((InspectorEvents_10_Event)inspector).Close += () => { RemoveInspectorMail(item); };
     }
 }
 public void NewSelectionMails(List <MailItem> mails, MWReplyAction func)
 {
     RealMonitor.NewSelectionMails(mails, func);
 }
 public void AddInspectorMail(Inspector inspector, MailItem item, MWReplyAction func)
 {
     RealMonitor.AddInspectorMail(inspector, item, func);
 }