Tasks pseudo-logic
This commit is contained in:
parent
69a47f6652
commit
554677e21f
@ -50,6 +50,11 @@ namespace Outlook2013TodoAddIn
|
|||||||
set { this.apptCalendar.SelectedDate = value; }
|
set { this.apptCalendar.SelectedDate = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets whether to show the tasks list
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowTasks { get; set; }
|
||||||
|
|
||||||
#endregion "Properties"
|
#endregion "Properties"
|
||||||
|
|
||||||
#region "Methods"
|
#region "Methods"
|
||||||
@ -69,33 +74,53 @@ namespace Outlook2013TodoAddIn
|
|||||||
/// <param name="e">DateRangeEventArgs</param>
|
/// <param name="e">DateRangeEventArgs</param>
|
||||||
private void apptCalendar_SelectedDateChanged(object sender, EventArgs e)
|
private void apptCalendar_SelectedDateChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.RetrieveAppointments();
|
this.RetrieveData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves tasks for all stores
|
/// Retrieves appointments and tasks if configured
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void RetrieveTasks()
|
public void RetrieveData()
|
||||||
{
|
{
|
||||||
// We want tasks for all the accounts
|
this.RetrieveAppointments();
|
||||||
//foreach (Outlook.Store store in Globals.ThisAddIn.Application.Session.Stores)
|
if (this.ShowTasks)
|
||||||
//{
|
{
|
||||||
// // Get the Outlook to-do folder to retrieve the items
|
// this.RetrieveTasks();
|
||||||
// MessageBox.Show("Store: " + store.DisplayName);
|
}
|
||||||
// // TODO: try..catch (public folders times out)
|
}
|
||||||
Outlook.Folder todoFolder =
|
|
||||||
Globals.ThisAddIn.Application.Session.GetDefaultFolder(
|
/// <summary>
|
||||||
Outlook.OlDefaultFolders.olFolderToDo)
|
/// Retrieves tasks for all selected stores
|
||||||
as Outlook.Folder;
|
/// </summary>
|
||||||
this.RetrieveTasksForFolder(todoFolder);
|
private void RetrieveTasks()
|
||||||
|
{
|
||||||
|
List<Outlook.TaskItem> tasks = new List<Outlook.TaskItem>();
|
||||||
|
foreach (Outlook.Store store in Globals.ThisAddIn.Application.Session.Stores)
|
||||||
|
{
|
||||||
|
if (Properties.Settings.Default.Accounts != null && Properties.Settings.Default.Accounts.Contains(store.DisplayName))
|
||||||
|
{
|
||||||
|
Outlook.Folder todoFolder = store.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderToDo) as Outlook.Folder;
|
||||||
|
tasks.AddRange(this.RetrieveTasksForFolder(todoFolder));
|
||||||
|
// TODO: Shared calendars?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// We need to sort them because they may come from different accounts already ordered
|
||||||
|
// tasks.Sort(CompareTasks);
|
||||||
|
|
||||||
|
//Outlook.Folder todoFolder =
|
||||||
|
// Globals.ThisAddIn.Application.Session.GetDefaultFolder(
|
||||||
|
// Outlook.OlDefaultFolders.olFolderToDo)
|
||||||
|
// as Outlook.Folder;
|
||||||
|
//this.RetrieveTasksForFolder(todoFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves to-do tasks for the folder on the specified store
|
/// Retrieves to-do tasks for the folder on the specified store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="todoFolder">Outlook folder</param>
|
/// <param name="todoFolder">Outlook folder</param>
|
||||||
private void RetrieveTasksForFolder(Outlook.Folder todoFolder)
|
private List<Outlook.TaskItem> RetrieveTasksForFolder(Outlook.Folder todoFolder)
|
||||||
{
|
{
|
||||||
|
List<Outlook.TaskItem> tasks = new List<Outlook.TaskItem>();
|
||||||
foreach (object item in todoFolder.Items)
|
foreach (object item in todoFolder.Items)
|
||||||
{
|
{
|
||||||
if (item is Outlook.MailItem)
|
if (item is Outlook.MailItem)
|
||||||
@ -124,12 +149,13 @@ namespace Outlook2013TodoAddIn
|
|||||||
MessageBox.Show("Unknown type");
|
MessageBox.Show("Unknown type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return tasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve all appointments for the current configurations for all selected stores
|
/// Retrieve all appointments for the current configurations for all selected stores
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void RetrieveAppointments()
|
private void RetrieveAppointments()
|
||||||
{
|
{
|
||||||
List<Outlook.AppointmentItem> appts = new List<Outlook.AppointmentItem>();
|
List<Outlook.AppointmentItem> appts = new List<Outlook.AppointmentItem>();
|
||||||
foreach (Outlook.Store store in Globals.ThisAddIn.Application.Session.Stores)
|
foreach (Outlook.Store store in Globals.ThisAddIn.Application.Session.Stores)
|
||||||
@ -344,7 +370,7 @@ namespace Outlook2013TodoAddIn
|
|||||||
// Open up the appointment in a new window
|
// Open up the appointment in a new window
|
||||||
appt.Display(true); // Modal yes/no
|
appt.Display(true); // Modal yes/no
|
||||||
}
|
}
|
||||||
// At the end, synchronously "refresh" items in case they have changed
|
// At the end, synchronously "refresh" appointments in case they have changed
|
||||||
this.RetrieveAppointments();
|
this.RetrieveAppointments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -411,7 +437,8 @@ namespace Outlook2013TodoAddIn
|
|||||||
this.ShowPastAppointments = cfg.ShowPastAppointments;
|
this.ShowPastAppointments = cfg.ShowPastAppointments;
|
||||||
this.Accounts = cfg.Accounts;
|
this.Accounts = cfg.Accounts;
|
||||||
this.ShowFriendlyGroupHeaders = cfg.ShowFriendlyGroupHeaders;
|
this.ShowFriendlyGroupHeaders = cfg.ShowFriendlyGroupHeaders;
|
||||||
this.RetrieveAppointments();
|
this.ShowTasks = cfg.ShowTasks;
|
||||||
|
this.RetrieveData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
this.chkListCalendars = new System.Windows.Forms.CheckedListBox();
|
this.chkListCalendars = new System.Windows.Forms.CheckedListBox();
|
||||||
this.lblAccounts = new System.Windows.Forms.Label();
|
this.lblAccounts = new System.Windows.Forms.Label();
|
||||||
this.chkFriendlyGroupHeaders = new System.Windows.Forms.CheckBox();
|
this.chkFriendlyGroupHeaders = new System.Windows.Forms.CheckBox();
|
||||||
|
this.chkShowTasks = new System.Windows.Forms.CheckBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -84,7 +85,7 @@
|
|||||||
// btnCancel
|
// btnCancel
|
||||||
//
|
//
|
||||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
this.btnCancel.Location = new System.Drawing.Point(168, 291);
|
this.btnCancel.Location = new System.Drawing.Point(168, 314);
|
||||||
this.btnCancel.Name = "btnCancel";
|
this.btnCancel.Name = "btnCancel";
|
||||||
this.btnCancel.Size = new System.Drawing.Size(87, 37);
|
this.btnCancel.Size = new System.Drawing.Size(87, 37);
|
||||||
this.btnCancel.TabIndex = 11;
|
this.btnCancel.TabIndex = 11;
|
||||||
@ -94,7 +95,7 @@
|
|||||||
// btnOK
|
// btnOK
|
||||||
//
|
//
|
||||||
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||||
this.btnOK.Location = new System.Drawing.Point(26, 291);
|
this.btnOK.Location = new System.Drawing.Point(26, 314);
|
||||||
this.btnOK.Name = "btnOK";
|
this.btnOK.Name = "btnOK";
|
||||||
this.btnOK.Size = new System.Drawing.Size(87, 37);
|
this.btnOK.Size = new System.Drawing.Size(87, 37);
|
||||||
this.btnOK.TabIndex = 10;
|
this.btnOK.TabIndex = 10;
|
||||||
@ -115,7 +116,7 @@
|
|||||||
// chkListCalendars
|
// chkListCalendars
|
||||||
//
|
//
|
||||||
this.chkListCalendars.FormattingEnabled = true;
|
this.chkListCalendars.FormattingEnabled = true;
|
||||||
this.chkListCalendars.Location = new System.Drawing.Point(26, 176);
|
this.chkListCalendars.Location = new System.Drawing.Point(26, 199);
|
||||||
this.chkListCalendars.Name = "chkListCalendars";
|
this.chkListCalendars.Name = "chkListCalendars";
|
||||||
this.chkListCalendars.Size = new System.Drawing.Size(229, 106);
|
this.chkListCalendars.Size = new System.Drawing.Size(229, 106);
|
||||||
this.chkListCalendars.TabIndex = 13;
|
this.chkListCalendars.TabIndex = 13;
|
||||||
@ -123,7 +124,7 @@
|
|||||||
// lblAccounts
|
// lblAccounts
|
||||||
//
|
//
|
||||||
this.lblAccounts.AutoSize = true;
|
this.lblAccounts.AutoSize = true;
|
||||||
this.lblAccounts.Location = new System.Drawing.Point(23, 156);
|
this.lblAccounts.Location = new System.Drawing.Point(23, 179);
|
||||||
this.lblAccounts.Name = "lblAccounts";
|
this.lblAccounts.Name = "lblAccounts";
|
||||||
this.lblAccounts.Size = new System.Drawing.Size(70, 17);
|
this.lblAccounts.Size = new System.Drawing.Size(70, 17);
|
||||||
this.lblAccounts.TabIndex = 14;
|
this.lblAccounts.TabIndex = 14;
|
||||||
@ -139,13 +140,24 @@
|
|||||||
this.chkFriendlyGroupHeaders.Text = "Show Friendly Headers";
|
this.chkFriendlyGroupHeaders.Text = "Show Friendly Headers";
|
||||||
this.chkFriendlyGroupHeaders.UseVisualStyleBackColor = true;
|
this.chkFriendlyGroupHeaders.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// chkShowTasks
|
||||||
|
//
|
||||||
|
this.chkShowTasks.AutoSize = true;
|
||||||
|
this.chkShowTasks.Location = new System.Drawing.Point(45, 148);
|
||||||
|
this.chkShowTasks.Name = "chkShowTasks";
|
||||||
|
this.chkShowTasks.Size = new System.Drawing.Size(106, 21);
|
||||||
|
this.chkShowTasks.TabIndex = 16;
|
||||||
|
this.chkShowTasks.Text = "Show Tasks";
|
||||||
|
this.chkShowTasks.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// FormConfiguration
|
// FormConfiguration
|
||||||
//
|
//
|
||||||
this.AcceptButton = this.btnOK;
|
this.AcceptButton = this.btnOK;
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.CancelButton = this.btnCancel;
|
this.CancelButton = this.btnCancel;
|
||||||
this.ClientSize = new System.Drawing.Size(282, 343);
|
this.ClientSize = new System.Drawing.Size(282, 383);
|
||||||
|
this.Controls.Add(this.chkShowTasks);
|
||||||
this.Controls.Add(this.chkFriendlyGroupHeaders);
|
this.Controls.Add(this.chkFriendlyGroupHeaders);
|
||||||
this.Controls.Add(this.lblAccounts);
|
this.Controls.Add(this.lblAccounts);
|
||||||
this.Controls.Add(this.chkListCalendars);
|
this.Controls.Add(this.chkListCalendars);
|
||||||
@ -180,5 +192,6 @@
|
|||||||
private System.Windows.Forms.CheckedListBox chkListCalendars;
|
private System.Windows.Forms.CheckedListBox chkListCalendars;
|
||||||
private System.Windows.Forms.Label lblAccounts;
|
private System.Windows.Forms.Label lblAccounts;
|
||||||
private System.Windows.Forms.CheckBox chkFriendlyGroupHeaders;
|
private System.Windows.Forms.CheckBox chkFriendlyGroupHeaders;
|
||||||
|
private System.Windows.Forms.CheckBox chkShowTasks;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -67,6 +67,15 @@ namespace Outlook2013TodoAddIn.Forms
|
|||||||
set { this.chkFriendlyGroupHeaders.Checked = value; }
|
set { this.chkFriendlyGroupHeaders.Checked = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets whether to show the tasks list
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowTasks
|
||||||
|
{
|
||||||
|
get { return this.chkShowTasks.Checked; }
|
||||||
|
set { this.chkShowTasks.Checked = value; }
|
||||||
|
}
|
||||||
|
|
||||||
#endregion "Properties"
|
#endregion "Properties"
|
||||||
|
|
||||||
#region "Methods"
|
#region "Methods"
|
||||||
@ -90,6 +99,7 @@ namespace Outlook2013TodoAddIn.Forms
|
|||||||
this.chkMailAlerts.Checked = Properties.Settings.Default.MailAlertsEnabled;
|
this.chkMailAlerts.Checked = Properties.Settings.Default.MailAlertsEnabled;
|
||||||
this.chkShowPastAppointments.Checked = Properties.Settings.Default.ShowPastAppointments;
|
this.chkShowPastAppointments.Checked = Properties.Settings.Default.ShowPastAppointments;
|
||||||
this.chkFriendlyGroupHeaders.Checked = Properties.Settings.Default.ShowFriendlyGroupHeaders;
|
this.chkFriendlyGroupHeaders.Checked = Properties.Settings.Default.ShowFriendlyGroupHeaders;
|
||||||
|
this.chkShowTasks.Checked = Properties.Settings.Default.ShowTasks;
|
||||||
this.LoadStores();
|
this.LoadStores();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +128,7 @@ namespace Outlook2013TodoAddIn.Forms
|
|||||||
Properties.Settings.Default.ShowPastAppointments = this.chkShowPastAppointments.Checked;
|
Properties.Settings.Default.ShowPastAppointments = this.chkShowPastAppointments.Checked;
|
||||||
Properties.Settings.Default.Accounts = this.Accounts;
|
Properties.Settings.Default.Accounts = this.Accounts;
|
||||||
Properties.Settings.Default.ShowFriendlyGroupHeaders = this.chkFriendlyGroupHeaders.Checked;
|
Properties.Settings.Default.ShowFriendlyGroupHeaders = this.chkFriendlyGroupHeaders.Checked;
|
||||||
|
Properties.Settings.Default.ShowTasks = this.chkShowTasks.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion "Methods"
|
#endregion "Methods"
|
||||||
|
12
Outlook2013TodoAddIn/Properties/Settings.Designer.cs
generated
12
Outlook2013TodoAddIn/Properties/Settings.Designer.cs
generated
@ -117,5 +117,17 @@ namespace Outlook2013TodoAddIn.Properties {
|
|||||||
this["ShowFriendlyGroupHeaders"] = value;
|
this["ShowFriendlyGroupHeaders"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
public bool ShowTasks {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["ShowTasks"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["ShowTasks"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,5 +26,8 @@
|
|||||||
<Setting Name="ShowFriendlyGroupHeaders" Type="System.Boolean" Scope="User">
|
<Setting Name="ShowFriendlyGroupHeaders" Type="System.Boolean" Scope="User">
|
||||||
<Value Profile="(Default)">True</Value>
|
<Value Profile="(Default)">True</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="ShowTasks" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
@ -44,6 +44,7 @@ namespace Outlook2013TodoAddIn
|
|||||||
this.AppControl.ShowPastAppointments = Properties.Settings.Default.ShowPastAppointments;
|
this.AppControl.ShowPastAppointments = Properties.Settings.Default.ShowPastAppointments;
|
||||||
this.AppControl.Accounts = Properties.Settings.Default.Accounts;
|
this.AppControl.Accounts = Properties.Settings.Default.Accounts;
|
||||||
this.AppControl.ShowFriendlyGroupHeaders = Properties.Settings.Default.ShowFriendlyGroupHeaders;
|
this.AppControl.ShowFriendlyGroupHeaders = Properties.Settings.Default.ShowFriendlyGroupHeaders;
|
||||||
|
this.AppControl.ShowTasks = Properties.Settings.Default.ShowTasks;
|
||||||
this.AppControl.NumDays = Properties.Settings.Default.NumDays; // Setting the value will load the appointments
|
this.AppControl.NumDays = Properties.Settings.Default.NumDays; // Setting the value will load the appointments
|
||||||
|
|
||||||
ToDoTaskPane = this.CustomTaskPanes.Add(this.AppControl, "Appointments");
|
ToDoTaskPane = this.CustomTaskPanes.Add(this.AppControl, "Appointments");
|
||||||
@ -57,7 +58,7 @@ namespace Outlook2013TodoAddIn
|
|||||||
// Selecting the date will retrieve the appointments
|
// Selecting the date will retrieve the appointments
|
||||||
// Otherwise it'll take the one used when the designer changed!
|
// Otherwise it'll take the one used when the designer changed!
|
||||||
this.AppControl.SelectedDate = DateTime.Today;
|
this.AppControl.SelectedDate = DateTime.Today;
|
||||||
// this.AppControl.RetrieveAppointments();
|
// this.AppControl.RetrieveData();
|
||||||
|
|
||||||
Globals.ThisAddIn.Application.ActiveExplorer().Deactivate += ThisAddIn_Deactivate;
|
Globals.ThisAddIn.Application.ActiveExplorer().Deactivate += ThisAddIn_Deactivate;
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
<setting name="ShowFriendlyGroupHeaders" serializeAs="String">
|
<setting name="ShowFriendlyGroupHeaders" serializeAs="String">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="ShowTasks" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
</Outlook2013TodoAddIn.Properties.Settings>
|
</Outlook2013TodoAddIn.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||||
|
Loading…
Reference in New Issue
Block a user