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 0000000..d7e2187 Binary files /dev/null and b/Outlook2013TodoAddIn/Images/gear.png differ 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 +