//private Outlook.Explorer _e; //public static void GetAllFlagRequests() //{ // //var kk = // // GreatFollowUpperAddin.ToDoFolder.Items.Cast<dynamic>().Where(t => IsActiveToDo(t)).Select(k => k.FlagRequest).Distinct().ToList(); // //return; // var l = new List<string>(); // var x = GreatFollowUpperAddin.ToDoFolder.Items.Cast<dynamic>() // .Where(t => IsActiveToDo(t)) // .Select(t => (FollowUpItem) FollowUpItem.GetFollowUpItem(t)) // .Select(t => t.FlagRequest) // .Distinct().ToList(); //} /// <summary> /// Invoked when a new item is added to the Sent Items folder /// </summary>B /// <param name="item"></param> private void SentItems_ItemAdd(object item) { var mail = item as Outlook.MailItem; if (mail == null) { return; } if (mail.SentOn < DateTime.Now.AddHours(Settings.Default.IgnoreSentItemsBeforeHours)) { //Sent longer than X hours ago -- don't bother return; } var fupf = new FollowUpForm(new FollowUpMailItem(mail), FollowUpItem.FollowUpTrigger.ItemSent); fupf.Show(); }
//Create callback methods here. For more information about adding callback methods, visit http://go.microsoft.com/fwlink/?LinkID=271226 //public void Ribbon_Load(Office.IRibbonUI ribbonUI) //{ // this.ribbon = ribbonUI; //} public void TaskContext_Click(dynamic sender) { var explorer = Globals.GreatFollowUpperAddin.Application.ActiveExplorer(); if (explorer?.Selection == null) { return; } if (explorer.Selection.Count > 1 && Control.ModifierKeys == Keys.Shift) //Do not support multi selection and pop up dialog box { return; } foreach (object i in explorer.Selection) { FollowUpItem item; try { item = FollowUpItem.GetFollowUpItem(i); } catch (RuntimeBinderException) { MessageBox.Show("Type of a selected item not supported", GreatFollowUpperAddin.Name, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); break; } if (Control.ModifierKeys == Keys.Shift) { var fupf = new FollowUpForm(item, FollowUpItem.FollowUpTrigger.Ribbon, sender.Tag); fupf.Show(); } else { DateTime?followUpDate = Utils.ParseFollowUpDate(sender.Tag); item.DoFollowUp(true, followUpDate, false, item.ReminderSet, false, false); } } //if (!License.IsLicenseValid()) // return; //var explorer = Globals.GreatFollowUpperAddin.Application.ActiveExplorer(); //if (explorer?.Selection == null || explorer.Selection.Count != 1) // return; //FollowUpItem item; //try //{ // item = FollowUpItem.GetFollowUpItem(explorer.Selection[1]); //} //catch (RuntimeBinderException) //{ // MessageBox.Show("Type of selected item not supported", GreatFollowUpperAddin.Name, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // return; //} ////var mail = (Outlook.MailItem)item; //if (Control.ModifierKeys == Keys.Shift) //{ // var fupf = new FollowUpForm(item, FollowUpItem.FollowUpTrigger.Ribbon, sender.Tag); // fupf.Show(); //} //else //{ // DateTime? followUpDate = Utils.ParseFollowUpDate(sender.Tag); // item.DoFollowUp(true, followUpDate, false, item.ReminderSet, false, false); //} }