Added initial support for multiple calendars. Added friendly group header names (yesterday, today and tomorrow).
Some minor refactoring.
This commit is contained in:
+43
-7
@@ -34,13 +34,16 @@
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.btnOK = new System.Windows.Forms.Button();
|
||||
this.chkShowPastAppointments = new System.Windows.Forms.CheckBox();
|
||||
this.chkListCalendars = new System.Windows.Forms.CheckedListBox();
|
||||
this.lblAccounts = new System.Windows.Forms.Label();
|
||||
this.chkFriendlyGroupHeaders = 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.Location = new System.Drawing.Point(45, 94);
|
||||
this.chkMailAlerts.Name = "chkMailAlerts";
|
||||
this.chkMailAlerts.Size = new System.Drawing.Size(143, 21);
|
||||
this.chkMailAlerts.TabIndex = 8;
|
||||
@@ -50,7 +53,7 @@
|
||||
// lblRangeDays
|
||||
//
|
||||
this.lblRangeDays.AutoSize = true;
|
||||
this.lblRangeDays.Location = new System.Drawing.Point(55, 60);
|
||||
this.lblRangeDays.Location = new System.Drawing.Point(55, 29);
|
||||
this.lblRangeDays.Name = "lblRangeDays";
|
||||
this.lblRangeDays.Size = new System.Drawing.Size(44, 17);
|
||||
this.lblRangeDays.TabIndex = 7;
|
||||
@@ -58,7 +61,7 @@
|
||||
//
|
||||
// numRangeDays
|
||||
//
|
||||
this.numRangeDays.Location = new System.Drawing.Point(115, 58);
|
||||
this.numRangeDays.Location = new System.Drawing.Point(115, 27);
|
||||
this.numRangeDays.Maximum = new decimal(new int[] {
|
||||
30,
|
||||
0,
|
||||
@@ -81,7 +84,7 @@
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(169, 181);
|
||||
this.btnCancel.Location = new System.Drawing.Point(168, 291);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(87, 37);
|
||||
this.btnCancel.TabIndex = 11;
|
||||
@@ -91,7 +94,7 @@
|
||||
// btnOK
|
||||
//
|
||||
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.btnOK.Location = new System.Drawing.Point(27, 181);
|
||||
this.btnOK.Location = new System.Drawing.Point(26, 291);
|
||||
this.btnOK.Name = "btnOK";
|
||||
this.btnOK.Size = new System.Drawing.Size(87, 37);
|
||||
this.btnOK.TabIndex = 10;
|
||||
@@ -102,20 +105,50 @@
|
||||
// chkShowPastAppointments
|
||||
//
|
||||
this.chkShowPastAppointments.AutoSize = true;
|
||||
this.chkShowPastAppointments.Location = new System.Drawing.Point(59, 98);
|
||||
this.chkShowPastAppointments.Location = new System.Drawing.Point(45, 67);
|
||||
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;
|
||||
//
|
||||
// chkListCalendars
|
||||
//
|
||||
this.chkListCalendars.FormattingEnabled = true;
|
||||
this.chkListCalendars.Location = new System.Drawing.Point(26, 176);
|
||||
this.chkListCalendars.Name = "chkListCalendars";
|
||||
this.chkListCalendars.Size = new System.Drawing.Size(229, 106);
|
||||
this.chkListCalendars.TabIndex = 13;
|
||||
//
|
||||
// lblAccounts
|
||||
//
|
||||
this.lblAccounts.AutoSize = true;
|
||||
this.lblAccounts.Location = new System.Drawing.Point(23, 156);
|
||||
this.lblAccounts.Name = "lblAccounts";
|
||||
this.lblAccounts.Size = new System.Drawing.Size(70, 17);
|
||||
this.lblAccounts.TabIndex = 14;
|
||||
this.lblAccounts.Text = "Accounts:";
|
||||
//
|
||||
// chkFriendlyGroupHeaders
|
||||
//
|
||||
this.chkFriendlyGroupHeaders.AutoSize = true;
|
||||
this.chkFriendlyGroupHeaders.Location = new System.Drawing.Point(45, 121);
|
||||
this.chkFriendlyGroupHeaders.Name = "chkFriendlyGroupHeaders";
|
||||
this.chkFriendlyGroupHeaders.Size = new System.Drawing.Size(176, 21);
|
||||
this.chkFriendlyGroupHeaders.TabIndex = 15;
|
||||
this.chkFriendlyGroupHeaders.Text = "Show Friendly Headers";
|
||||
this.chkFriendlyGroupHeaders.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.ClientSize = new System.Drawing.Size(282, 343);
|
||||
this.Controls.Add(this.chkFriendlyGroupHeaders);
|
||||
this.Controls.Add(this.lblAccounts);
|
||||
this.Controls.Add(this.chkListCalendars);
|
||||
this.Controls.Add(this.chkShowPastAppointments);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnOK);
|
||||
@@ -144,5 +177,8 @@
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Button btnOK;
|
||||
private System.Windows.Forms.CheckBox chkShowPastAppointments;
|
||||
private System.Windows.Forms.CheckedListBox chkListCalendars;
|
||||
private System.Windows.Forms.Label lblAccounts;
|
||||
private System.Windows.Forms.CheckBox chkFriendlyGroupHeaders;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Outlook = Microsoft.Office.Interop.Outlook;
|
||||
|
||||
namespace Outlook2013TodoAddIn.Forms
|
||||
{
|
||||
@@ -40,6 +42,31 @@ namespace Outlook2013TodoAddIn.Forms
|
||||
set { this.chkShowPastAppointments.Checked = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets a list of all stores/accounts to retrieve information from
|
||||
/// </summary>
|
||||
public StringCollection Accounts
|
||||
{
|
||||
get
|
||||
{
|
||||
StringCollection col = new StringCollection();
|
||||
foreach (object item in this.chkListCalendars.CheckedItems)
|
||||
{
|
||||
col.Add(item.ToString());
|
||||
}
|
||||
return col;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets whether to show friendly group headers (yesterday, today, tomorrow)
|
||||
/// </summary>
|
||||
public bool ShowFriendlyGroupHeaders
|
||||
{
|
||||
get { return this.chkFriendlyGroupHeaders.Checked; }
|
||||
set { this.chkFriendlyGroupHeaders.Checked = value; }
|
||||
}
|
||||
|
||||
#endregion "Properties"
|
||||
|
||||
#region "Methods"
|
||||
@@ -62,6 +89,21 @@ namespace Outlook2013TodoAddIn.Forms
|
||||
this.numRangeDays.Value = Properties.Settings.Default.NumDays;
|
||||
this.chkMailAlerts.Checked = Properties.Settings.Default.MailAlertsEnabled;
|
||||
this.chkShowPastAppointments.Checked = Properties.Settings.Default.ShowPastAppointments;
|
||||
this.chkFriendlyGroupHeaders.Checked = Properties.Settings.Default.ShowFriendlyGroupHeaders;
|
||||
this.LoadStores();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads all the stores (accounts) in the current session
|
||||
/// </summary>
|
||||
private void LoadStores()
|
||||
{
|
||||
foreach (Outlook.Store store in Globals.ThisAddIn.Application.Session.Stores)
|
||||
{
|
||||
bool itemChecked = Properties.Settings.Default.Accounts != null && Properties.Settings.Default.Accounts.Contains(store.DisplayName);
|
||||
int index = this.chkListCalendars.Items.Add(store.DisplayName, itemChecked);
|
||||
// TODO: Use StoreID instead?
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -74,6 +116,8 @@ namespace Outlook2013TodoAddIn.Forms
|
||||
Properties.Settings.Default.NumDays = this.numRangeDays.Value;
|
||||
Properties.Settings.Default.MailAlertsEnabled = this.chkMailAlerts.Checked;
|
||||
Properties.Settings.Default.ShowPastAppointments = this.chkShowPastAppointments.Checked;
|
||||
Properties.Settings.Default.Accounts = this.Accounts;
|
||||
Properties.Settings.Default.ShowFriendlyGroupHeaders = this.chkFriendlyGroupHeaders.Checked;
|
||||
}
|
||||
|
||||
#endregion "Methods"
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Outlook2013TodoAddIn.Forms
|
||||
private void btnFlag_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Microsoft.Office.Interop.Outlook.OlFlagIcon.olYellowFlagIcon
|
||||
this.Email.FlagRequest = "Follow up";
|
||||
this.Email.FlagRequest = Constants.FollowUp;
|
||||
this.Email.Save();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user