public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { string listId = String.Empty; string taskData = (items.First() as ITextItem).Text; if (string.IsNullOrEmpty(taskData)) { Services.Notifications.Notify("Remember The Milk", AddinManager.CurrentLocalizer.GetString("No title provided for new task.")); yield break; } if (modifierItems.FirstOrDefault() != null) { listId = (modifierItems.FirstOrDefault() as RTMListItem).Id; } if (RTMPreferences.ReturnNewTask) { yield return(RTM.NewTask(listId, taskData)); } else { Services.Application.RunOnThread(() => { RTM.NewTask(listId, taskData); }); yield break; } }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { RTMTaskItem task = null; List <string> temp_tags = new List <string> (); if (items.Any()) { if (items.First() is RTMTaskItem) { task = (items.First() as RTMTaskItem); } else if (items.First() is RTMTaskAttributeItem) { task = (items.First() as RTMTaskAttributeItem).Parent; } } if (modifierItems.Any() && task != null) { foreach (Item item in modifierItems) { temp_tags.Add((item as RTMTagItem).Name); } Services.Application.RunOnThread(() => { RTM.DeleteTags(task.ListId, task.TaskSeriesId, task.Id, String.Join(",", temp_tags.ToArray())); }); } yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { RTMTaskItem task = null; string due = String.Empty; if (items.Any()) { if (items.First() is RTMTaskItem) { task = (items.First() as RTMTaskItem); } else if (items.First() is RTMTaskAttributeItem) { task = (items.First() as RTMTaskAttributeItem).Parent; } } if (modifierItems.Any()) { due = (modifierItems.First() as ITextItem).Text; } if (task != null) { Services.Application.RunOnThread(() => { RTM.SetDueDateTime(task.ListId, task.TaskSeriesId, task.Id, due); }); } yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { Services.Application.RunOnThread(() => { RTM.UncompleteTask((items.First() as RTMTaskItem).ListId, (items.First() as RTMTaskItem).TaskSeriesId, (items.First() as RTMTaskItem).Id); }); yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { Services.Application.RunOnThread(() => { RTM.SetRecurrence((items.First() as RTMTaskItem).ListId, (items.First() as RTMTaskItem).TaskSeriesId, (items.First() as RTMTaskItem).Id, (modifierItems.FirstOrDefault() as ITextItem).Text); }); yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { Services.Application.RunOnThread(() => { RTM.SetTaskPriority((items.First() as RTMTaskItem).ListId, (items.First() as RTMTaskItem).TaskSeriesId, (items.First() as RTMTaskItem).Id, (modifierItems.First() as RTMPriorityItem).Priority); }); yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { string listname = (items.First() as RTMListItem).Id; Services.Application.RunOnThread(() => { RTM.DeleteList(listname); }); yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { if (items.Any()) { Services.Application.RunOnThread(() => { RTM.DeleteNote((items.First() as RTMNoteItem).Id); }); } yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { RTMTaskItem task = null; string url = String.Empty; if (items.Any()) { if (items.First() is RTMTaskItem) { task = (items.First() as RTMTaskItem); } else if (items.First() is RTMTaskAttributeItem) { task = (items.First() as RTMTaskAttributeItem).Parent; } } if (modifierItems.FirstOrDefault() != null) { url = ((modifierItems.FirstOrDefault() as ITextItem).Text); } // User may have entered explicit mode and entered a blank line. // To be safe; strip out all new line characters from input // for URL resetting. url = url.Replace("\n", ""); // The URL set to the task may be reset if the entered text is empty. // Check if it's not empty. if (!string.IsNullOrEmpty(url)) { // Check if the entered text is a valid URL. if (!CheckValidURL(url)) { // Error in entered URL. Services.Notifications.Notify("Remember The Milk", AddinManager.CurrentLocalizer.GetString("Invalid URL provided.")); yield break; } } if (task != null) { Services.Application.RunOnThread(() => { RTM.SetURL(task.ListId, task.TaskSeriesId, task.Id, url); }); } yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { string note = String.Empty; if (modifierItems.FirstOrDefault() != null) { note = ((modifierItems.FirstOrDefault() as ITextItem).Text); } Services.Application.RunOnThread(() => { RTM.NewNote((items.First() as RTMTaskItem).ListId, (items.First() as RTMTaskItem).TaskSeriesId, (items.First() as RTMTaskItem).Id, note); }); yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { string locationId = String.Empty; if (modifierItems.Any()) { locationId = (modifierItems.First() as RTMLocationItem).Id; } Services.Application.RunOnThread(() => { RTM.SetLocation((items.First() as RTMTaskItem).ListId, (items.First() as RTMTaskItem).TaskSeriesId, (items.First() as RTMTaskItem).Id, locationId); }); yield break; }
/// <summary> /// Called when the "Authorize" button is clicked. Initializes the authentication. /// </summary> /// <param name="sender"> /// Ignored /// </param> /// <param name="e"> /// Ignored /// </param> protected virtual void OnAuthBtnClicked(object sender, System.EventArgs e) { frob = RTM.AuthInit(); authinfo_lbl.Text = AddinManager.CurrentLocalizer.GetString("A webpage from Remember The Milk should be opened" + " in your web browser now. Please follow the instructions there and come back to complete" + " the authrozation by clicking the button below."); RTMPreferences.Token = ""; RTMPreferences.Username = ""; notification_frm.Sensitive = false; filter_frm.Sensitive = false; Widget image = auth_btn.Image; auth_btn.Label = AddinManager.CurrentLocalizer.GetString("Complete authorization"); auth_btn.Image = image; auth_btn.Clicked -= new EventHandler(OnAuthBtnClicked); auth_btn.Clicked += new EventHandler(OnCompleteBtnClicked); }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { if (modifierItems.Any()) { string newListName = (modifierItems.First() as ITextItem).Text; if (String.IsNullOrEmpty(newListName)) { Log <RTM> .Debug("No list name provided for RTMRenameList action"); yield break; } Services.Application.RunOnThread(() => { RTM.RenameList((items.First() as RTMListItem).Id, newListName); }); } yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { RTMTaskItem task = null; string est = String.Empty; if (items.Any()) { if (items.First() is RTMTaskItem) { task = (items.First() as RTMTaskItem); } else if (items.First() is RTMTaskAttributeItem) { task = (items.First() as RTMTaskAttributeItem).Parent; } } if (modifierItems.Any()) { est = ((modifierItems.First() as ITextItem).Text); } if (!string.IsNullOrEmpty(est)) { if (!CheckValidTime(est)) { Services.Notifications.Notify(AddinManager.CurrentLocalizer.GetString("Invalid Time format"), AddinManager.CurrentLocalizer.GetString("The estimated time entered cannot be understood."), "rtm.png@" + GetType().Assembly.FullName); yield break; } } if (task != null) { Services.Application.RunOnThread(() => { RTM.SetEstimateTime(task.ListId, task.TaskSeriesId, task.Id, est); }); } yield break; }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { if (items.Any()) { string newListName = (items.First() as ITextItem).Text; if (String.IsNullOrEmpty(newListName)) { Log <RTM> .Debug(AddinManager.CurrentLocalizer.GetString("No list name provided for RTMNewList action")); yield break; } else { Services.Application.RunOnThread(() => { RTM.NewList(newListName); }); } } yield break; }
/// <summary> /// Called when user returns from the authentication webpage and clicks the "Complete" button. /// </summary> /// <param name="sender"> /// Ignored /// </param> /// <param name="e"> /// Ignored /// </param> protected virtual void OnCompleteBtnClicked(object sender, EventArgs e) { Auth auth; auth = RTM.AuthComplete(frob); if (auth != null) { RTMPreferences.Token = auth.Token; RTMPreferences.Username = auth.User.Username; auth_btn.Clicked -= new EventHandler(OnCompleteBtnClicked); auth_btn.Clicked += new EventHandler(OnAuthBtnClicked); SetStateComplete(); } else { authinfo_lbl.Text = AddinManager.CurrentLocalizer.GetString("Fail to complete authorization."); auth_btn.Clicked -= new EventHandler(OnCompleteBtnClicked); auth_btn.Clicked += new EventHandler(OnAuthBtnClicked); auth_btn.Label = AddinManager.CurrentLocalizer.GetString("Authorize again"); } }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modifierItems) { RTMTaskItem task = null; List <string> temp_tags = new List <string> (); string s = null; if (items.Any()) { if (items.First() is RTMTaskItem) { task = (items.First() as RTMTaskItem); } else if (items.First() is RTMTaskAttributeItem) { task = (items.First() as RTMTaskAttributeItem).Parent; } } if (modifierItems.Any() && task != null) { foreach (Item item in modifierItems) { s = GetText(item); if (!String.IsNullOrEmpty(s)) { temp_tags.Add(s); } } Services.Application.RunOnThread(() => { RTM.AddTags((items.First() as RTMTaskItem).ListId, (items.First() as RTMTaskItem).TaskSeriesId, (items.First() as RTMTaskItem).Id, String.Join(",", temp_tags.ToArray())); }); } yield break; }
public override IEnumerable <Item> ChildrenOfItem(Item parent) { return(RTM.AttributesForTask((parent as RTMTaskItem))); }
public override IEnumerable <Item> ChildrenOfItem(Item parent) { return(RTM.TasksForList((parent as RTMListItem).Id)); }
public override IEnumerable <Item> ChildrenOfItem(Item parent) { return(RTM.TasksForTag((parent as RTMTagItem).Name)); }