private void Inbox_ItemAdd(object item) { var mail = (FollowUpItem.GetFollowUpItem(item) as FollowUpMailItem); if (mail == null) { return; } mail.ClearParentFlag(); //COMMENTED BECAUSE NOTHING BELOW HERE //if (mail.SentOn < DateTime.Now.AddHours(Settings.Default.IgnoreSentItemsBeforeHours)) // //Sent longer than X hours ago -- don't bother // return; }
public FollowUpForm(FollowUpItem item, FollowUpItem.FollowUpTrigger intent, object followUpOption = null) { InitializeComponent(); _item = item; this.Text = GreatFollowUpperAddin.Name; this.item.Text = item.Subject; //Follow Up Options GROUPBOX addReminder.Checked = item.ReminderSet; clearFlagOnReply.Checked = Settings.Default.DefaultClearFlagOnReply; if (followUpOption != null) { var optionToCheck = grpFollowUpOptions.Controls.OfType <RadioButton>().SingleOrDefault(r => r.Tag?.ToString() == (string)followUpOption); if (optionToCheck != null) { optionToCheck.Checked = true; } } var reminderTimes = Enumerable.Range(0, 48).Select(i => new TimeSpan(0, 0, i * 30, 0)).Select(ts => ts.ToString(@"hh\:mm")).ToArray(); reminderTime.Items.AddRange(reminderTimes); this.laterToday_CheckedChanged(null, null); //Categories GROUPBOX var catItem = item; if (item is FollowUpMailItem && intent == FollowUpItem.FollowUpTrigger.ItemSent) { catItem = catItem.ParentItem; } var cats = catItem?.Categories?.Split(new[] { "; " }, StringSplitOptions.None) ?? new string[] {}; foreach (var cat in Globals.GreatFollowUpperAddin.Application.Session.Categories.Cast <Outlook.Category>() .Select(a => a.Name) .Union(cats)) { var i = lstCategories.Items.Add(cat); lstCategories.SetItemChecked(i, cats.Contains(cat)); } ////Status GROUPBOX //IEnumerable<string> frs = JArray.Parse(Settings.Default.FlagRequests).ToObject<string[]>(); //if (item.FlagRequest != null) // frs = frs.Union(new string[] {item.FlagRequest}); //Auto Close Timer if (Settings.Default.AutoCloseFormAfterSeconds > 0) { _remainingSecondsBeforeOkClick = Settings.Default.AutoCloseFormAfterSeconds; UpdateOkButton(); _updateOkButtonTimer = new Timer { Interval = 1000, Enabled = true }; _updateOkButtonTimer.Tick += (sender, args) => UpdateOkButton(); } else { btnOK.Text = "&OK"; } }
//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); //} }
private void Categorize(object item) { var i = FollowUpItem.GetFollowUpItem(item); i?.Categorize(); }