예제 #1
0
        private void Application_NewMailEx(string EntryIDCollection)
        {
            MWMailItem item = new MWMailItem(NS.GetItemFromID(EntryIDCollection) as MailItem);

            // if item received was a mail (it could be a meeting invitation of something else)
            if (item != null)
            {
                Utils.Debug($"New mail received.\n{item}");
                this.MWContoller.HandleExistingMail(item);
            }
        }
예제 #2
0
 public void RemoveItemFromView(MWMailItem item)
 {
     this.Dispatcher.Invoke(() =>
     {
         string FolderPath = item.FolderPath;
         if (Map.ContainsKey(FolderPath))
         {
             MWMailItem found = (from i in Map[FolderPath] where i.EntryID == item.EntryID select i).First();
             Map[FolderPath].Remove(found);
         }
     });
 }
예제 #3
0
 public void AddItemToView(MWMailItem item)
 {
     this.Dispatcher.Invoke(() =>
     {
         string FolderPath = item.FolderPath;
         if (Map.ContainsKey(FolderPath))
         {
             Map[FolderPath].Add(item);
         }
         else
         {
             GroupedMails group = new GroupedMails(FolderPath, new List <MWMailItem>());
             Data.Add(group);
             Map.Add(FolderPath, group.Mails);
             group.Mails.Add(item);
         }
     });
 }
예제 #4
0
        private void MailItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            MWMailItem item = ((TreeViewItem)sender).DataContext as MWMailItem;

            if (item != null)
            {
                try
                {
                    MailItem oItem = Globals.ThisAddIn.NS.GetItemFromID(item.EntryID) as MailItem;
                    // Run in thread, because new window is opened in the background
                    Task.Run(() => { oItem.Display(); });
                }
                catch (COMException ex)
                {
                    MessageBox.Show($"Message cannot be found.\n{ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }