Added option to show/hide completed tasks.
Added context menu to delete/complete a task.
This commit is contained in:
parent
e371703148
commit
1362a441e7
39
Outlook2013TodoAddIn/AppointmentsControl.Designer.cs
generated
39
Outlook2013TodoAddIn/AppointmentsControl.Designer.cs
generated
@ -40,15 +40,18 @@
|
||||
this.lstTasks = new System.Windows.Forms.ListView();
|
||||
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.ctxMenuTasks = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.panelCalendar = new System.Windows.Forms.Panel();
|
||||
this.apptCalendar = new Outlook2013TodoAddIn.CustomCalendar();
|
||||
this.ctxMenuTasks = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.mnuItemMarkComplete = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuItemDeleteTask = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ctxMenuAppointments.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.ctxMenuTasks.SuspendLayout();
|
||||
this.panelCalendar.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -58,20 +61,20 @@
|
||||
this.mnuItemReplyAllEmail,
|
||||
this.mnuItemDeleteAppointment});
|
||||
this.ctxMenuAppointments.Name = "ctxMenuAppointments";
|
||||
this.ctxMenuAppointments.Size = new System.Drawing.Size(225, 52);
|
||||
this.ctxMenuAppointments.Size = new System.Drawing.Size(227, 52);
|
||||
//
|
||||
// mnuItemReplyAllEmail
|
||||
//
|
||||
this.mnuItemReplyAllEmail.Name = "mnuItemReplyAllEmail";
|
||||
this.mnuItemReplyAllEmail.Size = new System.Drawing.Size(224, 24);
|
||||
this.mnuItemReplyAllEmail.Size = new System.Drawing.Size(226, 24);
|
||||
this.mnuItemReplyAllEmail.Text = "Reply All With Email";
|
||||
this.mnuItemReplyAllEmail.Click += new System.EventHandler(this.mnuItemReplyAllEmail_Click);
|
||||
//
|
||||
// mnuItemDeleteAppointment
|
||||
//
|
||||
this.mnuItemDeleteAppointment.Name = "mnuItemDeleteAppointment";
|
||||
this.mnuItemDeleteAppointment.Size = new System.Drawing.Size(224, 24);
|
||||
this.mnuItemDeleteAppointment.Text = "Delete appointment/s";
|
||||
this.mnuItemDeleteAppointment.Size = new System.Drawing.Size(226, 24);
|
||||
this.mnuItemDeleteAppointment.Text = "Delete Appointment/s";
|
||||
this.mnuItemDeleteAppointment.Click += new System.EventHandler(this.mnuItemDeleteAppointment_Click);
|
||||
//
|
||||
// panel1
|
||||
@ -169,6 +172,14 @@
|
||||
this.columnHeader4.Text = "Subject";
|
||||
this.columnHeader4.Width = 200;
|
||||
//
|
||||
// ctxMenuTasks
|
||||
//
|
||||
this.ctxMenuTasks.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mnuItemMarkComplete,
|
||||
this.mnuItemDeleteTask});
|
||||
this.ctxMenuTasks.Name = "ctxMenuTasks";
|
||||
this.ctxMenuTasks.Size = new System.Drawing.Size(181, 80);
|
||||
//
|
||||
// panelCalendar
|
||||
//
|
||||
this.panelCalendar.Controls.Add(this.apptCalendar);
|
||||
@ -202,10 +213,19 @@
|
||||
this.apptCalendar.SelectedDateChanged += new System.EventHandler(this.apptCalendar_SelectedDateChanged);
|
||||
this.apptCalendar.ConfigurationButtonClicked += new System.EventHandler(this.apptCalendar_ConfigurationButtonClicked);
|
||||
//
|
||||
// ctxMenuTasks
|
||||
// mnuItemMarkComplete
|
||||
//
|
||||
this.ctxMenuTasks.Name = "ctxMenuTasks";
|
||||
this.ctxMenuTasks.Size = new System.Drawing.Size(61, 4);
|
||||
this.mnuItemMarkComplete.Name = "mnuItemMarkComplete";
|
||||
this.mnuItemMarkComplete.Size = new System.Drawing.Size(180, 24);
|
||||
this.mnuItemMarkComplete.Text = "Mark Complete";
|
||||
this.mnuItemMarkComplete.Click += new System.EventHandler(this.mnuItemMarkComplete_Click);
|
||||
//
|
||||
// mnuItemDeleteTask
|
||||
//
|
||||
this.mnuItemDeleteTask.Name = "mnuItemDeleteTask";
|
||||
this.mnuItemDeleteTask.Size = new System.Drawing.Size(180, 24);
|
||||
this.mnuItemDeleteTask.Text = "Delete Task";
|
||||
this.mnuItemDeleteTask.Click += new System.EventHandler(this.mnuItemDeleteTask_Click);
|
||||
//
|
||||
// AppointmentsControl
|
||||
//
|
||||
@ -220,6 +240,7 @@
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ctxMenuTasks.ResumeLayout(false);
|
||||
this.panelCalendar.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@ -241,6 +262,8 @@
|
||||
private System.Windows.Forms.Panel panelCalendar;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuItemDeleteAppointment;
|
||||
private System.Windows.Forms.ContextMenuStrip ctxMenuTasks;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuItemMarkComplete;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuItemDeleteTask;
|
||||
|
||||
|
||||
}
|
||||
|
@ -65,6 +65,11 @@ namespace Outlook2013TodoAddIn
|
||||
/// </summary>
|
||||
public bool ShowTasks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets whether to show the completed tasks in the list
|
||||
/// </summary>
|
||||
public bool ShowCompletedTasks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the first day of the week for the calendar
|
||||
/// </summary>
|
||||
@ -133,6 +138,12 @@ namespace Outlook2013TodoAddIn
|
||||
// TODO: Shared calendars?
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.ShowCompletedTasks)
|
||||
{
|
||||
tasks = tasks.Where(t => !t.Completed).ToList();
|
||||
}
|
||||
|
||||
// We need to sort them because they may come from different accounts already ordered
|
||||
// Applies sorting by due date
|
||||
tasks.Sort(CompareTasks);
|
||||
@ -604,6 +615,86 @@ namespace Outlook2013TodoAddIn
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows to delete the selected task
|
||||
/// </summary>
|
||||
/// <param name="sender">Sender</param>
|
||||
/// <param name="e">EventArgs</param>
|
||||
private void mnuItemDeleteTask_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.lstTasks.SelectedIndices.Count != 0)
|
||||
{
|
||||
OLTaskItem task = this.lstTasks.SelectedItems[0].Tag as OLTaskItem;
|
||||
if (task != null)
|
||||
{
|
||||
if (MessageBox.Show("Are you sure you want to delete this task?", "Delete task", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
if (task.OriginalItem is Outlook.MailItem)
|
||||
{
|
||||
Outlook.MailItem mail = task.OriginalItem as Outlook.MailItem;
|
||||
mail.Delete();
|
||||
}
|
||||
else if (task.OriginalItem is Outlook.ContactItem)
|
||||
{
|
||||
Outlook.ContactItem contact = task.OriginalItem as Outlook.ContactItem;
|
||||
contact.Delete();
|
||||
}
|
||||
else if (task.OriginalItem is Outlook.TaskItem)
|
||||
{
|
||||
Outlook.TaskItem t = task.OriginalItem as Outlook.TaskItem;
|
||||
t.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
// At the end, synchronously "refresh" tasks in case they have changed
|
||||
this.RetrieveTasks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows to mark the selected task as completed (clear task flag for regular items)
|
||||
/// </summary>
|
||||
/// <param name="sender">Sender</param>
|
||||
/// <param name="e">EventArgs</param>
|
||||
private void mnuItemMarkComplete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.lstTasks.SelectedIndices.Count != 0)
|
||||
{
|
||||
OLTaskItem task = this.lstTasks.SelectedItems[0].Tag as OLTaskItem;
|
||||
if (task != null && !task.Completed) // Attempting to complete an already completed task throws an exception
|
||||
{
|
||||
if (MessageBox.Show("Are you sure you want to complete this task?", "Mark task as completed/Clear task flag", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
if (task.OriginalItem is Outlook.MailItem)
|
||||
{
|
||||
Outlook.MailItem mail = task.OriginalItem as Outlook.MailItem;
|
||||
mail.ClearTaskFlag();
|
||||
}
|
||||
else if (task.OriginalItem is Outlook.ContactItem)
|
||||
{
|
||||
Outlook.ContactItem contact = task.OriginalItem as Outlook.ContactItem;
|
||||
contact.ClearTaskFlag();
|
||||
}
|
||||
else if (task.OriginalItem is Outlook.TaskItem)
|
||||
{
|
||||
Outlook.TaskItem t = task.OriginalItem as Outlook.TaskItem;
|
||||
t.MarkComplete();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
// At the end, synchronously "refresh" tasks in case they have changed
|
||||
this.RetrieveTasks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Switch to the calendar view when double-clicking a date
|
||||
/// </summary>
|
||||
@ -639,6 +730,7 @@ namespace Outlook2013TodoAddIn
|
||||
this.ShowDayNames = cfg.ShowDayNames;
|
||||
this.ShowWeekNumbers = cfg.ShowWeekNumbers;
|
||||
this.ShowTasks = cfg.ShowTasks;
|
||||
this.ShowCompletedTasks = cfg.ShowCompletedTasks;
|
||||
this.FirstDayOfWeek = cfg.FirstDayOfWeek;
|
||||
this.RetrieveData();
|
||||
}
|
||||
@ -701,16 +793,23 @@ namespace Outlook2013TodoAddIn
|
||||
});
|
||||
|
||||
}
|
||||
e.Graphics.DrawString(task.TaskSubject, new Font(this.Font, FontStyle.Bold), colorBrush, subjectRectangle, leftFormat);
|
||||
Font mainFont = new Font(this.Font, FontStyle.Bold);
|
||||
Font subFont = this.Font;
|
||||
if (task.Completed)
|
||||
{
|
||||
mainFont = new Font(this.Font, FontStyle.Bold | FontStyle.Strikeout);
|
||||
subFont = new Font(this.Font, FontStyle.Strikeout);
|
||||
}
|
||||
e.Graphics.DrawString(task.TaskSubject, mainFont, colorBrush, subjectRectangle, leftFormat);
|
||||
if (task.Reminder.Year != Constants.NullYear)
|
||||
{
|
||||
e.Graphics.DrawImage(Properties.Resources.Alert_16xSM, reminderRectangle.Left, reminderRectangle.Top);
|
||||
e.Graphics.DrawString(task.Reminder.ToString(), this.Font, colorBrush, reminderRectangle.Left + Properties.Resources.Alert_16xSM.Width + horizontalSpacing, reminderRectangle.Top, leftFormat);
|
||||
e.Graphics.DrawString(task.Reminder.ToString(), subFont, colorBrush, reminderRectangle.Left + Properties.Resources.Alert_16xSM.Width + horizontalSpacing, reminderRectangle.Top, leftFormat);
|
||||
}
|
||||
else if (task.StartDate.Year != Constants.NullYear)
|
||||
{
|
||||
e.Graphics.DrawImage(Properties.Resources.CurrentRow_15x14, reminderRectangle.Left, reminderRectangle.Top);
|
||||
e.Graphics.DrawString(task.StartDate.ToShortDateString(), this.Font, colorBrush, reminderRectangle.Left + Properties.Resources.CurrentRow_15x14.Width + horizontalSpacing, reminderRectangle.Top, leftFormat);
|
||||
e.Graphics.DrawString(task.StartDate.ToShortDateString(), subFont, colorBrush, reminderRectangle.Left + Properties.Resources.CurrentRow_15x14.Width + horizontalSpacing, reminderRectangle.Top, leftFormat);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.numRangeEmailAlertsTimeOut = new System.Windows.Forms.NumericUpDown();
|
||||
this.lblSeconds = new System.Windows.Forms.Label();
|
||||
this.chkShowCompletedTasks = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pctBoxPayPal)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numRangeEmailAlertsTimeOut)).BeginInit();
|
||||
@ -244,6 +245,16 @@
|
||||
this.lblSeconds.TabIndex = 23;
|
||||
this.lblSeconds.Text = "seconds";
|
||||
//
|
||||
// chkShowCompletedTasks
|
||||
//
|
||||
this.chkShowCompletedTasks.AutoSize = true;
|
||||
this.chkShowCompletedTasks.Location = new System.Drawing.Point(157, 206);
|
||||
this.chkShowCompletedTasks.Name = "chkShowCompletedTasks";
|
||||
this.chkShowCompletedTasks.Size = new System.Drawing.Size(105, 21);
|
||||
this.chkShowCompletedTasks.TabIndex = 24;
|
||||
this.chkShowCompletedTasks.Text = "Completed?";
|
||||
this.chkShowCompletedTasks.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormConfiguration
|
||||
//
|
||||
this.AcceptButton = this.btnOK;
|
||||
@ -251,6 +262,7 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(282, 482);
|
||||
this.Controls.Add(this.chkShowCompletedTasks);
|
||||
this.Controls.Add(this.lblSeconds);
|
||||
this.Controls.Add(this.numRangeEmailAlertsTimeOut);
|
||||
this.Controls.Add(this.pctBoxPayPal);
|
||||
@ -305,5 +317,6 @@
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
private System.Windows.Forms.NumericUpDown numRangeEmailAlertsTimeOut;
|
||||
private System.Windows.Forms.Label lblSeconds;
|
||||
private System.Windows.Forms.CheckBox chkShowCompletedTasks;
|
||||
}
|
||||
}
|
@ -95,6 +95,15 @@ namespace Outlook2013TodoAddIn.Forms
|
||||
set { this.chkShowTasks.Checked = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets whether to show the completed tasks in the list
|
||||
/// </summary>
|
||||
public bool ShowCompletedTasks
|
||||
{
|
||||
get { return this.chkShowCompletedTasks.Checked; }
|
||||
set { this.chkShowCompletedTasks.Checked = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the first day of the week for the calendar
|
||||
/// </summary>
|
||||
@ -131,6 +140,7 @@ namespace Outlook2013TodoAddIn.Forms
|
||||
this.chkShowDayNames.Checked = Properties.Settings.Default.ShowDayNames;
|
||||
this.chkShowWeekNumbers.Checked = Properties.Settings.Default.ShowWeekNumbers;
|
||||
this.chkShowTasks.Checked = Properties.Settings.Default.ShowTasks;
|
||||
this.chkShowCompletedTasks.Checked = Properties.Settings.Default.ShowCompletedTasks;
|
||||
this.LoadStores();
|
||||
this.LoadDays();
|
||||
}
|
||||
@ -172,7 +182,7 @@ namespace Outlook2013TodoAddIn.Forms
|
||||
Properties.Settings.Default.ShowFriendlyGroupHeaders = this.chkFriendlyGroupHeaders.Checked;
|
||||
Properties.Settings.Default.ShowDayNames = this.chkShowDayNames.Checked;
|
||||
Properties.Settings.Default.ShowWeekNumbers = this.chkShowWeekNumbers.Checked;
|
||||
Properties.Settings.Default.ShowTasks = this.chkShowTasks.Checked;
|
||||
Properties.Settings.Default.ShowCompletedTasks = this.chkShowCompletedTasks.Checked;
|
||||
Properties.Settings.Default.FirstDayOfWeek = (System.DayOfWeek)Enum.Parse(typeof(System.DayOfWeek), this.cboFirstDayOfWeek.SelectedValue.ToString());
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@ namespace Outlook2013TodoAddIn
|
||||
public object OriginalItem { get; set; }
|
||||
public List<string> Categories { get; set; }
|
||||
|
||||
public bool Completed { get; set; }
|
||||
|
||||
#endregion "Properties"
|
||||
|
||||
#region "Methods"
|
||||
@ -46,6 +48,7 @@ namespace Outlook2013TodoAddIn
|
||||
MAPIFolder f = (MAPIFolder)mail.Parent;
|
||||
this.FolderName = f.Name;
|
||||
if (!String.IsNullOrEmpty(mail.Categories)) this.Categories.AddRange(mail.Categories.Split(new char[] { ',' }));
|
||||
this.Completed = (mail.TaskCompletedDate.Year != Constants.NullYear);
|
||||
}
|
||||
else if (item is Outlook.ContactItem)
|
||||
{
|
||||
@ -58,6 +61,7 @@ namespace Outlook2013TodoAddIn
|
||||
MAPIFolder f = (MAPIFolder)contact.Parent;
|
||||
this.FolderName = f.Name;
|
||||
if (!String.IsNullOrEmpty(contact.Categories)) this.Categories.AddRange(contact.Categories.Split(new char[] { ',' }));
|
||||
this.Completed = (contact.TaskCompletedDate.Year != Constants.NullYear);
|
||||
}
|
||||
else if (item is Outlook.TaskItem)
|
||||
{
|
||||
@ -70,6 +74,7 @@ namespace Outlook2013TodoAddIn
|
||||
MAPIFolder f = (MAPIFolder)task.Parent;
|
||||
this.FolderName = f.Name;
|
||||
if (!String.IsNullOrEmpty(task.Categories)) this.Categories.AddRange(task.Categories.Split(new char[] { ',' }));
|
||||
this.Completed = task.Complete;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
12
Outlook2013TodoAddIn/Properties/Settings.Designer.cs
generated
12
Outlook2013TodoAddIn/Properties/Settings.Designer.cs
generated
@ -177,5 +177,17 @@ namespace Outlook2013TodoAddIn.Properties {
|
||||
this["ShowWeekNumbers"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool ShowCompletedTasks {
|
||||
get {
|
||||
return ((bool)(this["ShowCompletedTasks"]));
|
||||
}
|
||||
set {
|
||||
this["ShowCompletedTasks"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,5 +41,8 @@
|
||||
<Setting Name="ShowWeekNumbers" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="ShowCompletedTasks" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
@ -49,6 +49,7 @@ namespace Outlook2013TodoAddIn
|
||||
this.AppControl.ShowDayNames = Properties.Settings.Default.ShowDayNames;
|
||||
this.AppControl.ShowWeekNumbers = Properties.Settings.Default.ShowWeekNumbers;
|
||||
this.AppControl.ShowTasks = Properties.Settings.Default.ShowTasks;
|
||||
this.AppControl.ShowCompletedTasks = Properties.Settings.Default.ShowCompletedTasks;
|
||||
this.AppControl.FirstDayOfWeek = Properties.Settings.Default.FirstDayOfWeek;
|
||||
this.AppControl.NumDays = Properties.Settings.Default.NumDays; // Setting the value will load the appointments
|
||||
|
||||
|
@ -43,6 +43,9 @@
|
||||
<setting name="ShowWeekNumbers" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="ShowCompletedTasks" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
</Outlook2013TodoAddIn.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
|
Loading…
Reference in New Issue
Block a user