From cbb4618c7e0acadd1ce945f76ca5fdc76c7d8fb6 Mon Sep 17 00:00:00 2001 From: gamosoft_cp Date: Fri, 3 May 2013 14:27:19 +0000 Subject: [PATCH] Fixed initial selected date issue and improved startup time. --- Outlook2013TodoAddIn/AppointmentsControl.cs | 9 +++++++++ Outlook2013TodoAddIn/CustomCalendar.cs | 3 +-- Outlook2013TodoAddIn/ThisAddIn.cs | 8 ++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Outlook2013TodoAddIn/AppointmentsControl.cs b/Outlook2013TodoAddIn/AppointmentsControl.cs index c83b7b3..172b77a 100644 --- a/Outlook2013TodoAddIn/AppointmentsControl.cs +++ b/Outlook2013TodoAddIn/AppointmentsControl.cs @@ -40,6 +40,15 @@ namespace Outlook2013TodoAddIn set { this.chkMailAlerts.Checked = value; } } + /// + /// Gets/sets the selected calendar date + /// + public DateTime SelectedDate + { + get { return this.apptCalendar.SelectedDate; } + set { this.apptCalendar.SelectedDate = value; } + } + #endregion "Properties" #region "Methods" diff --git a/Outlook2013TodoAddIn/CustomCalendar.cs b/Outlook2013TodoAddIn/CustomCalendar.cs index 7c99b74..4c6fc42 100644 --- a/Outlook2013TodoAddIn/CustomCalendar.cs +++ b/Outlook2013TodoAddIn/CustomCalendar.cs @@ -106,7 +106,6 @@ namespace Outlook2013TodoAddIn public CustomCalendar() { InitializeComponent(); - //this.SelectedDate = DateTime.Today; this.FirstDayOfWeek = DayOfWeek.Sunday; //TODO: Thread.CurrentThread.CurrentCulture.DateTimeFormat.FirstDayOfWeek this.CurrentMonthForeColor = Color.Black; @@ -131,7 +130,7 @@ namespace Outlook2013TodoAddIn { // TODO: check initial double firing // TODO: Mark dates with colors from outlook - this.UpdateCalendar(); + // this.UpdateCalendar(); } /// diff --git a/Outlook2013TodoAddIn/ThisAddIn.cs b/Outlook2013TodoAddIn/ThisAddIn.cs index 312aace..d888498 100644 --- a/Outlook2013TodoAddIn/ThisAddIn.cs +++ b/Outlook2013TodoAddIn/ThisAddIn.cs @@ -41,8 +41,7 @@ namespace Outlook2013TodoAddIn this.AppControl = new AppointmentsControl(); this.AppControl.MailAlertsEnabled = Properties.Settings.Default.MailAlertsEnabled; this.AppControl.NumDays = Properties.Settings.Default.NumDays; // Setting the value will load the appointments - this.AppControl.RetrieveAppointments(); - + ToDoTaskPane = this.CustomTaskPanes.Add(this.AppControl, "Appointments"); ToDoTaskPane.Visible = Properties.Settings.Default.Visible; ToDoTaskPane.Width = Properties.Settings.Default.Width; @@ -51,6 +50,11 @@ namespace Outlook2013TodoAddIn ToDoTaskPane.VisibleChanged += ToDoTaskPane_VisibleChanged; this.AppControl.SizeChanged += appControl_SizeChanged; + // Selecting the date will retrieve the appointments + // Otherwise it'll take the one used when the designer changed! + this.AppControl.SelectedDate = DateTime.Today; + // this.AppControl.RetrieveAppointments(); + Globals.ThisAddIn.Application.ActiveExplorer().Deactivate += ThisAddIn_Deactivate; // TODO: Make sure there are no memory leaks (dispose COM objects)