From ef0f86d79d8c42054d6df08983848c191b4e25eb Mon Sep 17 00:00:00 2001 From: gamosoft_cp Date: Thu, 27 Jun 2013 18:30:15 +0000 Subject: [PATCH] Refactored code a bit. Moved configuration to separate form. Added option to show past appointments from the selected day (previous in time, that is). Added some tooltips. --- .../AppointmentsControl.Designer.cs | 89 +--------- Outlook2013TodoAddIn/AppointmentsControl.cs | 168 ++++++++++++------ .../CustomCalendar.Designer.cs | 26 ++- Outlook2013TodoAddIn/CustomCalendar.cs | 15 ++ Outlook2013TodoAddIn/CustomCalendar.resx | 3 + .../Forms/FormConfiguration.Designer.cs | 148 +++++++++++++++ .../Forms/FormConfiguration.cs | 81 +++++++++ .../FormConfiguration.resx} | 0 .../{ => Forms}/FormRecurringOpen.Designer.cs | 2 +- .../{ => Forms}/FormRecurringOpen.cs | 2 +- .../FormRecurringOpen.resx} | 0 .../{ => Forms}/NewMailAlert.Designer.cs | 2 +- .../{ => Forms}/NewMailAlert.cs | 2 +- Outlook2013TodoAddIn/Forms/NewMailAlert.resx | 120 +++++++++++++ Outlook2013TodoAddIn/Images/gear.png | Bin 0 -> 3205 bytes .../Outlook2013TodoAddIn.csproj | 24 ++- .../Properties/Resources.Designer.cs | 12 +- .../Properties/Resources.resx | 3 + .../Properties/Settings.Designer.cs | 14 +- .../Properties/Settings.settings | 3 + Outlook2013TodoAddIn/ThisAddIn.cs | 2 + Outlook2013TodoAddIn/app.config | 3 + 22 files changed, 562 insertions(+), 157 deletions(-) create mode 100644 Outlook2013TodoAddIn/Forms/FormConfiguration.Designer.cs create mode 100644 Outlook2013TodoAddIn/Forms/FormConfiguration.cs rename Outlook2013TodoAddIn/{FormRecurringOpen.resx => Forms/FormConfiguration.resx} (100%) rename Outlook2013TodoAddIn/{ => Forms}/FormRecurringOpen.Designer.cs (96%) rename Outlook2013TodoAddIn/{ => Forms}/FormRecurringOpen.cs (90%) rename Outlook2013TodoAddIn/{NewMailAlert.resx => Forms/FormRecurringOpen.resx} (100%) rename Outlook2013TodoAddIn/{ => Forms}/NewMailAlert.Designer.cs (97%) rename Outlook2013TodoAddIn/{ => Forms}/NewMailAlert.cs (96%) create mode 100644 Outlook2013TodoAddIn/Forms/NewMailAlert.resx create mode 100644 Outlook2013TodoAddIn/Images/gear.png diff --git a/Outlook2013TodoAddIn/AppointmentsControl.Designer.cs b/Outlook2013TodoAddIn/AppointmentsControl.Designer.cs index 364e435..b0c6110 100644 --- a/Outlook2013TodoAddIn/AppointmentsControl.Designer.cs +++ b/Outlook2013TodoAddIn/AppointmentsControl.Designer.cs @@ -29,56 +29,17 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.numRangeDays = new System.Windows.Forms.NumericUpDown(); - this.lblRangeDays = new System.Windows.Forms.Label(); this.ctxMenuAppointments = new System.Windows.Forms.ContextMenuStrip(this.components); this.mnuItemReplyAllEmail = new System.Windows.Forms.ToolStripMenuItem(); - this.btnRefresh = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); this.listView1 = new System.Windows.Forms.ListView(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.grpRefresh = new System.Windows.Forms.GroupBox(); - this.chkMailAlerts = new System.Windows.Forms.CheckBox(); this.apptCalendar = new Outlook2013TodoAddIn.CustomCalendar(); - ((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).BeginInit(); this.ctxMenuAppointments.SuspendLayout(); this.panel1.SuspendLayout(); - this.grpRefresh.SuspendLayout(); this.SuspendLayout(); // - // numRangeDays - // - this.numRangeDays.Location = new System.Drawing.Point(61, 26); - this.numRangeDays.Maximum = new decimal(new int[] { - 30, - 0, - 0, - 0}); - this.numRangeDays.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numRangeDays.Name = "numRangeDays"; - this.numRangeDays.Size = new System.Drawing.Size(55, 22); - this.numRangeDays.TabIndex = 2; - this.numRangeDays.Value = new decimal(new int[] { - 3, - 0, - 0, - 0}); - this.numRangeDays.ValueChanged += new System.EventHandler(this.numRangeDays_ValueChanged); - // - // lblRangeDays - // - this.lblRangeDays.AutoSize = true; - this.lblRangeDays.Location = new System.Drawing.Point(11, 28); - this.lblRangeDays.Name = "lblRangeDays"; - this.lblRangeDays.Size = new System.Drawing.Size(44, 17); - this.lblRangeDays.TabIndex = 3; - this.lblRangeDays.Text = "Days:"; - // // ctxMenuAppointments // this.ctxMenuAppointments.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -93,21 +54,9 @@ this.mnuItemReplyAllEmail.Text = "Reply All With Email"; this.mnuItemReplyAllEmail.Click += new System.EventHandler(this.mnuItemReplyAllEmail_Click); // - // btnRefresh - // - this.btnRefresh.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnRefresh.Location = new System.Drawing.Point(122, 23); - this.btnRefresh.Name = "btnRefresh"; - this.btnRefresh.Size = new System.Drawing.Size(77, 27); - this.btnRefresh.TabIndex = 4; - this.btnRefresh.Text = "Refresh"; - this.btnRefresh.UseVisualStyleBackColor = true; - this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); - // // panel1 // this.panel1.Controls.Add(this.listView1); - this.panel1.Controls.Add(this.grpRefresh); this.panel1.Controls.Add(this.apptCalendar); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); @@ -125,11 +74,11 @@ this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; this.listView1.FullRowSelect = true; this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.listView1.Location = new System.Drawing.Point(0, 315); + this.listView1.Location = new System.Drawing.Point(0, 228); this.listView1.MultiSelect = false; this.listView1.Name = "listView1"; this.listView1.ShowItemToolTips = true; - this.listView1.Size = new System.Drawing.Size(258, 452); + this.listView1.Size = new System.Drawing.Size(258, 539); this.listView1.TabIndex = 4; this.listView1.TileSize = new System.Drawing.Size(300, 38); this.listView1.UseCompatibleStateImageBehavior = false; @@ -146,31 +95,6 @@ this.columnHeader2.Text = "Subject"; this.columnHeader2.Width = 200; // - // grpRefresh - // - this.grpRefresh.Controls.Add(this.chkMailAlerts); - this.grpRefresh.Controls.Add(this.btnRefresh); - this.grpRefresh.Controls.Add(this.lblRangeDays); - this.grpRefresh.Controls.Add(this.numRangeDays); - this.grpRefresh.Dock = System.Windows.Forms.DockStyle.Top; - this.grpRefresh.Location = new System.Drawing.Point(0, 228); - this.grpRefresh.Name = "grpRefresh"; - this.grpRefresh.Size = new System.Drawing.Size(258, 87); - this.grpRefresh.TabIndex = 3; - this.grpRefresh.TabStop = false; - this.grpRefresh.Text = "Configuration:"; - // - // chkMailAlerts - // - this.chkMailAlerts.AutoSize = true; - this.chkMailAlerts.Location = new System.Drawing.Point(41, 59); - this.chkMailAlerts.Name = "chkMailAlerts"; - this.chkMailAlerts.Size = new System.Drawing.Size(143, 21); - this.chkMailAlerts.TabIndex = 5; - this.chkMailAlerts.Text = "Enable Mail Alerts"; - this.chkMailAlerts.UseVisualStyleBackColor = true; - this.chkMailAlerts.CheckedChanged += new System.EventHandler(this.chkMailAlerts_CheckedChanged); - // // apptCalendar // this.apptCalendar.BoldedDates = null; @@ -192,6 +116,7 @@ this.apptCalendar.TodayForeColor = System.Drawing.Color.White; this.apptCalendar.CellDoubleClick += new System.EventHandler(this.apptCalendar_CellDoubleClick); this.apptCalendar.SelectedDateChanged += new System.EventHandler(this.apptCalendar_SelectedDateChanged); + this.apptCalendar.ConfigurationButtonClicked += new System.EventHandler(this.apptCalendar_ConfigurationButtonClicked); // // AppointmentsControl // @@ -200,29 +125,21 @@ this.Controls.Add(this.panel1); this.Name = "AppointmentsControl"; this.Size = new System.Drawing.Size(258, 767); - ((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).EndInit(); this.ctxMenuAppointments.ResumeLayout(false); this.panel1.ResumeLayout(false); - this.grpRefresh.ResumeLayout(false); - this.grpRefresh.PerformLayout(); this.ResumeLayout(false); } #endregion - private System.Windows.Forms.NumericUpDown numRangeDays; - private System.Windows.Forms.Label lblRangeDays; private System.Windows.Forms.ContextMenuStrip ctxMenuAppointments; private System.Windows.Forms.ToolStripMenuItem mnuItemReplyAllEmail; private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Button btnRefresh; private CustomCalendar apptCalendar; private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; - private System.Windows.Forms.GroupBox grpRefresh; - private System.Windows.Forms.CheckBox chkMailAlerts; } diff --git a/Outlook2013TodoAddIn/AppointmentsControl.cs b/Outlook2013TodoAddIn/AppointmentsControl.cs index 58d42a3..b24628b 100644 --- a/Outlook2013TodoAddIn/AppointmentsControl.cs +++ b/Outlook2013TodoAddIn/AppointmentsControl.cs @@ -1,4 +1,5 @@ -using System; +using Outlook2013TodoAddIn.Forms; +using System; using System.Collections.Generic; using System.Drawing; using System.Linq; @@ -12,24 +13,21 @@ namespace Outlook2013TodoAddIn public partial class AppointmentsControl : UserControl { #region "Properties" - + /// /// Number of days (including today) to retrieve appointments from in the future /// - public decimal NumDays - { - get { return this.numRangeDays.Value; } - set { this.numRangeDays.Value = value; } - } + public decimal NumDays { get; set; } /// /// Gets/sets whether mail notifications are enabled or not /// - public bool MailAlertsEnabled - { - get { return this.chkMailAlerts.Checked; } - set { this.chkMailAlerts.Checked = value; } - } + public bool MailAlertsEnabled { get; set; } + + /// + /// Gets/sets whether to show past appointments in the current day or not + /// + public bool ShowPastAppointments { get; set; } /// /// Gets/sets the selected calendar date @@ -50,7 +48,6 @@ namespace Outlook2013TodoAddIn public AppointmentsControl() { InitializeComponent(); - this.btnRefresh.FlatAppearance.MouseOverBackColor = this.apptCalendar.HoverBackColor; } /// @@ -64,74 +61,82 @@ namespace Outlook2013TodoAddIn } /// - /// Change days to retrieve appointments in the future + /// Retrieves tasks for all stores /// - /// Sender - /// EventArgs - private void numRangeDays_ValueChanged(object sender, EventArgs e) + public void RetrieveTasks() { - Properties.Settings.Default.NumDays = this.numRangeDays.Value; - this.RetrieveAppointments(); + // We want tasks for all the accounts + //foreach (Outlook.Store store in Globals.ThisAddIn.Application.Session.Stores) + //{ + // // Get the Outlook to-do folder to retrieve the items + // MessageBox.Show("Store: " + store.DisplayName); + // // TODO: try..catch (public folders times out) + Outlook.Folder todoFolder = + Globals.ThisAddIn.Application.Session.GetDefaultFolder( + Outlook.OlDefaultFolders.olFolderToDo) + as Outlook.Folder; + this.RetrieveTasksForFolder(todoFolder); } /// - /// Manual refresh + /// Retrieves to-do tasks for the folder on the specified store /// - /// Sender - /// EventArgs - private void btnRefresh_Click(object sender, EventArgs e) + /// Outlook folder + private void RetrieveTasksForFolder(Outlook.Folder todoFolder) { - this.RetrieveAppointments(); + foreach (object item in todoFolder.Items) + { + if (item is Outlook.MailItem) + { + Outlook.MailItem mail = item as Outlook.MailItem; + //mail.Categories + //mail.TaskCompletedDate; + MessageBox.Show(String.Format("Mail Task: {0}, Due: {1}", mail.TaskSubject, mail.TaskDueDate.ToShortDateString())); + } + else if (item is Outlook.ContactItem) + { + Outlook.ContactItem contact = item as Outlook.ContactItem; + //contact.Categories + //contact.TaskCompletedDate + MessageBox.Show(String.Format("Contact Task: {0}, Due: {1}", contact.TaskSubject, contact.TaskDueDate.ToShortDateString())); + } + else if (item is Outlook.TaskItem) + { + Outlook.TaskItem task = item as Outlook.TaskItem; + //task.Categories + //task.DateCompleted + MessageBox.Show(String.Format("Task Task: {0}, Due: {1}", task.Subject, task.DueDate.ToShortDateString())); + } + else + { + MessageBox.Show("Unknown type"); + } + } } /// - /// Enables/disables email notifications - /// - /// Sender - /// EventArgs - private void chkMailAlerts_CheckedChanged(object sender, EventArgs e) - { - Properties.Settings.Default.MailAlertsEnabled = this.chkMailAlerts.Checked; - } - - /// - /// Retrieve all appointments for the current configurations + /// Retrieve all appointments for the current configurations for all stores /// public void RetrieveAppointments() { + //foreach (Outlook.Store store in Globals.ThisAddIn.Application.Session.Stores) // Get the Outlook folder for the calendar to retrieve the appointments Outlook.Folder calFolder = Globals.ThisAddIn.Application.Session.GetDefaultFolder( Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder; - - int selectedMonth = this.apptCalendar.SelectedDate.Month; - int selectedYear = this.apptCalendar.SelectedDate.Year; - - // To get all the appointments for the current month (so it displays nicely bolded even for past events) - DateTime start = new DateTime(selectedYear, selectedMonth, 1); // MM-01-YYYY - DateTime end = start.AddMonths(1).AddDays(-1); // Last day of the month - end = end.AddDays((int)this.numRangeDays.Value); // So we get appointments for the "possible" first days of the next month - - // Get all the appointments - Outlook.Items rangeAppts = GetAppointmentsInRange(calFolder, start, end); - - // Get a more manageable list - List appts = new List(); - if (rangeAppts != null) - { - foreach (Outlook.AppointmentItem appt in rangeAppts) - { - appts.Add(appt); - } - } + List appts = this.RetrieveAppointmentsForFolder(calFolder); // Highlight dates with appointments in the current calendar this.apptCalendar.BoldedDates = appts.Select(a => a.Start.Date).Distinct().ToArray(); // Now display the actual appointments below the calendar DateTime startRange = this.apptCalendar.SelectedDate; - DateTime endRange = startRange.AddDays((int)this.numRangeDays.Value); + if (!this.ShowPastAppointments) + { + startRange = startRange.Add(DateTime.Now.TimeOfDay); + } + DateTime endRange = startRange.AddDays((int)this.NumDays); // Get items in range var lstItems = appts.Where(a => a.Start >= startRange && a.Start <= endRange); @@ -186,6 +191,36 @@ namespace Outlook2013TodoAddIn this.apptCalendar.UpdateCalendar(); } + /// + /// Retrieve all appointments for the current configurations for a specific folder + /// + /// Outlook folder + /// List of appointments + private List RetrieveAppointmentsForFolder(Outlook.Folder calFolder) + { + int selectedMonth = this.apptCalendar.SelectedDate.Month; + int selectedYear = this.apptCalendar.SelectedDate.Year; + + // To get all the appointments for the current month (so it displays nicely bolded even for past events) + DateTime start = new DateTime(selectedYear, selectedMonth, 1); // MM-01-YYYY + DateTime end = start.AddMonths(1).AddDays(-1); // Last day of the month + end = end.AddDays((int)this.NumDays); // So we get appointments for the "possible" first days of the next month + + // Get all the appointments + Outlook.Items rangeAppts = GetAppointmentsInRange(calFolder, start, end); + + // Get a more manageable list + List appts = new List(); + if (rangeAppts != null) + { + foreach (Outlook.AppointmentItem appt in rangeAppts) + { + appts.Add(appt); + } + } + return appts; + } + /// /// Get recurring appointments in a date range. /// @@ -306,6 +341,25 @@ namespace Outlook2013TodoAddIn cv.GoToDate(this.apptCalendar.SelectedDate); } + /// + /// New method to show the configuration form + /// + /// Sender + /// EventArgs + private void apptCalendar_ConfigurationButtonClicked(object sender, EventArgs e) + { + using (FormConfiguration cfg = new FormConfiguration()) + { + if (cfg.ShowDialog() == DialogResult.OK) + { + this.NumDays = cfg.NumDays; + this.MailAlertsEnabled = cfg.MailAlertsEnabled; + this.ShowPastAppointments = cfg.ShowPastAppointments; + this.RetrieveAppointments(); + } + } + } + #endregion "Methods" } } \ No newline at end of file diff --git a/Outlook2013TodoAddIn/CustomCalendar.Designer.cs b/Outlook2013TodoAddIn/CustomCalendar.Designer.cs index 89e74ce..c0219ba 100644 --- a/Outlook2013TodoAddIn/CustomCalendar.Designer.cs +++ b/Outlook2013TodoAddIn/CustomCalendar.Designer.cs @@ -28,11 +28,14 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.btnPrevious = new System.Windows.Forms.Button(); this.btnNext = new System.Windows.Forms.Button(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.lnkCurrentRange = new System.Windows.Forms.LinkLabel(); this.lnkToday = new System.Windows.Forms.LinkLabel(); + this.btnConfig = new System.Windows.Forms.Button(); + this.toolTipCalendar = new System.Windows.Forms.ToolTip(this.components); this.SuspendLayout(); // // btnPrevious @@ -44,6 +47,7 @@ this.btnPrevious.Size = new System.Drawing.Size(31, 23); this.btnPrevious.TabIndex = 0; this.btnPrevious.Text = "<"; + this.toolTipCalendar.SetToolTip(this.btnPrevious, "Previous month"); this.btnPrevious.UseVisualStyleBackColor = true; this.btnPrevious.Click += new System.EventHandler(this.btnPrevious_Click); // @@ -56,6 +60,7 @@ this.btnNext.Size = new System.Drawing.Size(31, 23); this.btnNext.TabIndex = 2; this.btnNext.Text = ">"; + this.toolTipCalendar.SetToolTip(this.btnNext, "Next month"); this.btnNext.UseVisualStyleBackColor = true; this.btnNext.Click += new System.EventHandler(this.btnNext_Click); // @@ -97,19 +102,34 @@ // lnkToday // this.lnkToday.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; - this.lnkToday.Location = new System.Drawing.Point(9, 196); + this.lnkToday.Location = new System.Drawing.Point(40, 196); this.lnkToday.Name = "lnkToday"; - this.lnkToday.Size = new System.Drawing.Size(234, 23); + this.lnkToday.Size = new System.Drawing.Size(166, 23); this.lnkToday.TabIndex = 4; this.lnkToday.TabStop = true; this.lnkToday.Text = "lnkToday"; this.lnkToday.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.toolTipCalendar.SetToolTip(this.lnkToday, "Refresh today\'s appointments"); this.lnkToday.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkToday_LinkClicked); // + // btnConfig + // + this.btnConfig.BackgroundImage = global::Outlook2013TodoAddIn.Properties.Resources.gear; + this.btnConfig.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.btnConfig.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnConfig.Location = new System.Drawing.Point(219, 198); + this.btnConfig.Name = "btnConfig"; + this.btnConfig.Size = new System.Drawing.Size(24, 24); + this.btnConfig.TabIndex = 5; + this.toolTipCalendar.SetToolTip(this.btnConfig, "Configuration"); + this.btnConfig.UseVisualStyleBackColor = true; + this.btnConfig.Click += new System.EventHandler(this.btnConfig_Click); + // // CustomCalendar // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.btnConfig); this.Controls.Add(this.lnkToday); this.Controls.Add(this.lnkCurrentRange); this.Controls.Add(this.tableLayoutPanel1); @@ -130,5 +150,7 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.LinkLabel lnkCurrentRange; private System.Windows.Forms.LinkLabel lnkToday; + private System.Windows.Forms.Button btnConfig; + private System.Windows.Forms.ToolTip toolTipCalendar; } } diff --git a/Outlook2013TodoAddIn/CustomCalendar.cs b/Outlook2013TodoAddIn/CustomCalendar.cs index ed4d7dc..4180105 100644 --- a/Outlook2013TodoAddIn/CustomCalendar.cs +++ b/Outlook2013TodoAddIn/CustomCalendar.cs @@ -168,6 +168,7 @@ namespace Outlook2013TodoAddIn this.btnPrevious.FlatAppearance.MouseOverBackColor = this.HoverBackColor; this.btnNext.FlatAppearance.MouseOverBackColor = this.HoverBackColor; + this.btnConfig.FlatAppearance.MouseOverBackColor = this.HoverBackColor; } /// @@ -504,6 +505,20 @@ namespace Outlook2013TodoAddIn } } + /// + /// Event handler to subscribe to + /// + public event EventHandler ConfigurationButtonClicked; + + private void btnConfig_Click(object sender, EventArgs e) + { + EventHandler handler = ConfigurationButtonClicked; + if (handler != null) + { + handler(this, e); + } + } + /// /// Select today's date in the calendar /// diff --git a/Outlook2013TodoAddIn/CustomCalendar.resx b/Outlook2013TodoAddIn/CustomCalendar.resx index 29dcb1b..2a51f90 100644 --- a/Outlook2013TodoAddIn/CustomCalendar.resx +++ b/Outlook2013TodoAddIn/CustomCalendar.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/Outlook2013TodoAddIn/Forms/FormConfiguration.Designer.cs b/Outlook2013TodoAddIn/Forms/FormConfiguration.Designer.cs new file mode 100644 index 0000000..63d8271 --- /dev/null +++ b/Outlook2013TodoAddIn/Forms/FormConfiguration.Designer.cs @@ -0,0 +1,148 @@ +namespace Outlook2013TodoAddIn.Forms +{ + partial class FormConfiguration + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.chkMailAlerts = new System.Windows.Forms.CheckBox(); + this.lblRangeDays = new System.Windows.Forms.Label(); + this.numRangeDays = new System.Windows.Forms.NumericUpDown(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.chkShowPastAppointments = new System.Windows.Forms.CheckBox(); + ((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).BeginInit(); + this.SuspendLayout(); + // + // chkMailAlerts + // + this.chkMailAlerts.AutoSize = true; + this.chkMailAlerts.Location = new System.Drawing.Point(59, 134); + this.chkMailAlerts.Name = "chkMailAlerts"; + this.chkMailAlerts.Size = new System.Drawing.Size(143, 21); + this.chkMailAlerts.TabIndex = 8; + this.chkMailAlerts.Text = "Enable Mail Alerts"; + this.chkMailAlerts.UseVisualStyleBackColor = true; + // + // lblRangeDays + // + this.lblRangeDays.AutoSize = true; + this.lblRangeDays.Location = new System.Drawing.Point(55, 60); + this.lblRangeDays.Name = "lblRangeDays"; + this.lblRangeDays.Size = new System.Drawing.Size(44, 17); + this.lblRangeDays.TabIndex = 7; + this.lblRangeDays.Text = "Days:"; + // + // numRangeDays + // + this.numRangeDays.Location = new System.Drawing.Point(115, 58); + this.numRangeDays.Maximum = new decimal(new int[] { + 30, + 0, + 0, + 0}); + this.numRangeDays.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numRangeDays.Name = "numRangeDays"; + this.numRangeDays.Size = new System.Drawing.Size(55, 22); + this.numRangeDays.TabIndex = 6; + this.numRangeDays.Value = new decimal(new int[] { + 3, + 0, + 0, + 0}); + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(169, 181); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(87, 37); + this.btnCancel.TabIndex = 11; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // btnOK + // + this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnOK.Location = new System.Drawing.Point(27, 181); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(87, 37); + this.btnOK.TabIndex = 10; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // chkShowPastAppointments + // + this.chkShowPastAppointments.AutoSize = true; + this.chkShowPastAppointments.Location = new System.Drawing.Point(59, 98); + this.chkShowPastAppointments.Name = "chkShowPastAppointments"; + this.chkShowPastAppointments.Size = new System.Drawing.Size(186, 21); + this.chkShowPastAppointments.TabIndex = 12; + this.chkShowPastAppointments.Text = "Show Past Appointments"; + this.chkShowPastAppointments.UseVisualStyleBackColor = true; + // + // FormConfiguration + // + this.AcceptButton = this.btnOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(282, 253); + this.Controls.Add(this.chkShowPastAppointments); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.chkMailAlerts); + this.Controls.Add(this.lblRangeDays); + this.Controls.Add(this.numRangeDays); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormConfiguration"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Configuration"; + this.Load += new System.EventHandler(this.FormConfiguration_Load); + ((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.CheckBox chkMailAlerts; + private System.Windows.Forms.Label lblRangeDays; + private System.Windows.Forms.NumericUpDown numRangeDays; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.CheckBox chkShowPastAppointments; + } +} \ No newline at end of file diff --git a/Outlook2013TodoAddIn/Forms/FormConfiguration.cs b/Outlook2013TodoAddIn/Forms/FormConfiguration.cs new file mode 100644 index 0000000..4745796 --- /dev/null +++ b/Outlook2013TodoAddIn/Forms/FormConfiguration.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace Outlook2013TodoAddIn.Forms +{ + public partial class FormConfiguration : Form + { + #region "Properties" + + /// + /// Number of days (including today) to retrieve appointments from in the future + /// + public decimal NumDays + { + get { return this.numRangeDays.Value; } + set { this.numRangeDays.Value = value; } + } + + /// + /// Gets/sets whether mail notifications are enabled or not + /// + public bool MailAlertsEnabled + { + get { return this.chkMailAlerts.Checked; } + set { this.chkMailAlerts.Checked = value; } + } + + /// + /// Gets/sets whether to show past appointments in the current day or not + /// + public bool ShowPastAppointments + { + get { return this.chkShowPastAppointments.Checked; } + set { this.chkShowPastAppointments.Checked = value; } + } + + #endregion "Properties" + + #region "Methods" + + /// + /// Default constructor + /// + public FormConfiguration() + { + InitializeComponent(); + } + + /// + /// On load, display saved configuration + /// + /// Sender + /// EventArgs + private void FormConfiguration_Load(object sender, EventArgs e) + { + this.numRangeDays.Value = Properties.Settings.Default.NumDays; + this.chkMailAlerts.Checked = Properties.Settings.Default.MailAlertsEnabled; + this.chkShowPastAppointments.Checked = Properties.Settings.Default.ShowPastAppointments; + } + + /// + /// Clicking the OK button + /// + /// Sender + /// EventArgs + private void btnOK_Click(object sender, EventArgs e) + { + Properties.Settings.Default.NumDays = this.numRangeDays.Value; + Properties.Settings.Default.MailAlertsEnabled = this.chkMailAlerts.Checked; + Properties.Settings.Default.ShowPastAppointments = this.chkShowPastAppointments.Checked; + } + + #endregion "Methods" + } +} \ No newline at end of file diff --git a/Outlook2013TodoAddIn/FormRecurringOpen.resx b/Outlook2013TodoAddIn/Forms/FormConfiguration.resx similarity index 100% rename from Outlook2013TodoAddIn/FormRecurringOpen.resx rename to Outlook2013TodoAddIn/Forms/FormConfiguration.resx diff --git a/Outlook2013TodoAddIn/FormRecurringOpen.Designer.cs b/Outlook2013TodoAddIn/Forms/FormRecurringOpen.Designer.cs similarity index 96% rename from Outlook2013TodoAddIn/FormRecurringOpen.Designer.cs rename to Outlook2013TodoAddIn/Forms/FormRecurringOpen.Designer.cs index c7640df..db3893d 100644 --- a/Outlook2013TodoAddIn/FormRecurringOpen.Designer.cs +++ b/Outlook2013TodoAddIn/Forms/FormRecurringOpen.Designer.cs @@ -1,4 +1,4 @@ -namespace Outlook2013TodoAddIn +namespace Outlook2013TodoAddIn.Forms { partial class FormRecurringOpen { diff --git a/Outlook2013TodoAddIn/FormRecurringOpen.cs b/Outlook2013TodoAddIn/Forms/FormRecurringOpen.cs similarity index 90% rename from Outlook2013TodoAddIn/FormRecurringOpen.cs rename to Outlook2013TodoAddIn/Forms/FormRecurringOpen.cs index 61d6de6..707f61a 100644 --- a/Outlook2013TodoAddIn/FormRecurringOpen.cs +++ b/Outlook2013TodoAddIn/Forms/FormRecurringOpen.cs @@ -1,6 +1,6 @@ using System.Windows.Forms; -namespace Outlook2013TodoAddIn +namespace Outlook2013TodoAddIn.Forms { /// /// Mimic Outlook's popup to open one instance or the whole series diff --git a/Outlook2013TodoAddIn/NewMailAlert.resx b/Outlook2013TodoAddIn/Forms/FormRecurringOpen.resx similarity index 100% rename from Outlook2013TodoAddIn/NewMailAlert.resx rename to Outlook2013TodoAddIn/Forms/FormRecurringOpen.resx diff --git a/Outlook2013TodoAddIn/NewMailAlert.Designer.cs b/Outlook2013TodoAddIn/Forms/NewMailAlert.Designer.cs similarity index 97% rename from Outlook2013TodoAddIn/NewMailAlert.Designer.cs rename to Outlook2013TodoAddIn/Forms/NewMailAlert.Designer.cs index 6b12515..5c23079 100644 --- a/Outlook2013TodoAddIn/NewMailAlert.Designer.cs +++ b/Outlook2013TodoAddIn/Forms/NewMailAlert.Designer.cs @@ -1,4 +1,4 @@ -namespace Outlook2013TodoAddIn +namespace Outlook2013TodoAddIn.Forms { partial class NewMailAlert { diff --git a/Outlook2013TodoAddIn/NewMailAlert.cs b/Outlook2013TodoAddIn/Forms/NewMailAlert.cs similarity index 96% rename from Outlook2013TodoAddIn/NewMailAlert.cs rename to Outlook2013TodoAddIn/Forms/NewMailAlert.cs index 65f2461..131075e 100644 --- a/Outlook2013TodoAddIn/NewMailAlert.cs +++ b/Outlook2013TodoAddIn/Forms/NewMailAlert.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace Outlook2013TodoAddIn +namespace Outlook2013TodoAddIn.Forms { /// /// New form to display new emai lnotifications diff --git a/Outlook2013TodoAddIn/Forms/NewMailAlert.resx b/Outlook2013TodoAddIn/Forms/NewMailAlert.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/Outlook2013TodoAddIn/Forms/NewMailAlert.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Outlook2013TodoAddIn/Images/gear.png b/Outlook2013TodoAddIn/Images/gear.png new file mode 100644 index 0000000000000000000000000000000000000000..d7e2187cb5deaab9471d3a71de6b9e0b84bfea42 GIT binary patch literal 3205 zcmV;040`j4P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb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004mL004C`008P>0026e000+nl3&F} z00057Nkl9P7Q`lkOV=}q$E3f%>97j2cTGsK({*<)!_%ACgIfB z6a0WRXh2qixu8d^p>3bIoe2wKliPc)Q?Fk4t5?Ri93$ z)A5$~aMLu+^E_H>M?fb{Q=D_8X$sJ>){frm(>noc?NmfI^ZA@C%MK#)`rb&IrVIvy zjffoP^Eo22sYOhT5n~K_p2x{#Lcibt)c5&(rYuVUb8W$tWl2?40E7@I%M$NBWmytJ z0HCTWR;$$!FpULk?E;9cR_m?X?Gi%3d(VEqM?~1~_jvCKA<*r1>GgUeAgb!Z#26Wm z$I&^*)x`1MvtF-Bl7tWfv)K&i93s;2y!Rhd_!pQMBg5fvAtFBjoO6wZ5CU12vD@uP zk_6`*Ns{2buV4D|03ad@Reh|7RFl&*MOCTyAxV;E$g27%B8&eQqpCjFaTP_ua=H9n z-&R!>-g}CoXyR4X=i5a>Ri`4dQPn4)BOUZF+-ERN7TrMvn^7DfLK%VE< rQQmzf5jk$R+lIH@ZvP5=1%Czrqpj%nW{MMg00000NkvXXu0mjfav}ds literal 0 HcmV?d00001 diff --git a/Outlook2013TodoAddIn/Outlook2013TodoAddIn.csproj b/Outlook2013TodoAddIn/Outlook2013TodoAddIn.csproj index 78f66aa..bf1c50d 100644 --- a/Outlook2013TodoAddIn/Outlook2013TodoAddIn.csproj +++ b/Outlook2013TodoAddIn/Outlook2013TodoAddIn.csproj @@ -189,16 +189,22 @@ CustomCalendar.cs - + Form - + + FormConfiguration.cs + + + Form + + FormRecurringOpen.cs - + Form - + NewMailAlert.cs @@ -221,10 +227,13 @@ CustomCalendar.cs - + + FormConfiguration.cs + + FormRecurringOpen.cs - + NewMailAlert.cs @@ -277,6 +286,9 @@ + + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) diff --git a/Outlook2013TodoAddIn/Properties/Resources.Designer.cs b/Outlook2013TodoAddIn/Properties/Resources.Designer.cs index 96756e2..3722d3c 100644 --- a/Outlook2013TodoAddIn/Properties/Resources.Designer.cs +++ b/Outlook2013TodoAddIn/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18033 +// Runtime Version:4.0.30319.18046 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -90,6 +90,16 @@ namespace Outlook2013TodoAddIn.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap gear { + get { + object obj = ResourceManager.GetObject("gear", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/Outlook2013TodoAddIn/Properties/Resources.resx b/Outlook2013TodoAddIn/Properties/Resources.resx index 8969b27..383bc7f 100644 --- a/Outlook2013TodoAddIn/Properties/Resources.resx +++ b/Outlook2013TodoAddIn/Properties/Resources.resx @@ -127,6 +127,9 @@ ..\Images\Flag.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\images\gear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Images\2012-11-20_1546.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/Outlook2013TodoAddIn/Properties/Settings.Designer.cs b/Outlook2013TodoAddIn/Properties/Settings.Designer.cs index f3e62de..6101d15 100644 --- a/Outlook2013TodoAddIn/Properties/Settings.Designer.cs +++ b/Outlook2013TodoAddIn/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18033 +// Runtime Version:4.0.30319.18046 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -82,5 +82,17 @@ namespace Outlook2013TodoAddIn.Properties { this["MailAlertsEnabled"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool ShowPastAppointments { + get { + return ((bool)(this["ShowPastAppointments"])); + } + set { + this["ShowPastAppointments"] = value; + } + } } } diff --git a/Outlook2013TodoAddIn/Properties/Settings.settings b/Outlook2013TodoAddIn/Properties/Settings.settings index 318b188..181a83b 100644 --- a/Outlook2013TodoAddIn/Properties/Settings.settings +++ b/Outlook2013TodoAddIn/Properties/Settings.settings @@ -17,5 +17,8 @@ True + + True + \ No newline at end of file diff --git a/Outlook2013TodoAddIn/ThisAddIn.cs b/Outlook2013TodoAddIn/ThisAddIn.cs index d888498..93da445 100644 --- a/Outlook2013TodoAddIn/ThisAddIn.cs +++ b/Outlook2013TodoAddIn/ThisAddIn.cs @@ -1,4 +1,5 @@ using Microsoft.Win32; +using Outlook2013TodoAddIn.Forms; using System; using System.Drawing; using System.Linq; @@ -40,6 +41,7 @@ namespace Outlook2013TodoAddIn this.AppControl = new AppointmentsControl(); this.AppControl.MailAlertsEnabled = Properties.Settings.Default.MailAlertsEnabled; + this.AppControl.ShowPastAppointments = Properties.Settings.Default.ShowPastAppointments; this.AppControl.NumDays = Properties.Settings.Default.NumDays; // Setting the value will load the appointments ToDoTaskPane = this.CustomTaskPanes.Add(this.AppControl, "Appointments"); diff --git a/Outlook2013TodoAddIn/app.config b/Outlook2013TodoAddIn/app.config index 0b513ed..db38990 100644 --- a/Outlook2013TodoAddIn/app.config +++ b/Outlook2013TodoAddIn/app.config @@ -22,6 +22,9 @@ True + + True +