From b5d563fb361344f21dafeec44b9d91b95260cf16 Mon Sep 17 00:00:00 2001 From: gamosoft_cp Date: Wed, 11 Sep 2013 14:52:43 +0000 Subject: [PATCH] Added optional localized day names --- Outlook2013TodoAddIn/AppointmentsControl.cs | 10 +++++++ .../Forms/FormConfiguration.Designer.cs | 27 ++++++++++++++----- .../Forms/FormConfiguration.cs | 11 ++++++++ .../Properties/Settings.Designer.cs | 12 +++++++++ .../Properties/Settings.settings | 3 +++ Outlook2013TodoAddIn/ThisAddIn.cs | 1 + Outlook2013TodoAddIn/app.config | 3 +++ 7 files changed, 60 insertions(+), 7 deletions(-) diff --git a/Outlook2013TodoAddIn/AppointmentsControl.cs b/Outlook2013TodoAddIn/AppointmentsControl.cs index 585f40a..d7a31af 100644 --- a/Outlook2013TodoAddIn/AppointmentsControl.cs +++ b/Outlook2013TodoAddIn/AppointmentsControl.cs @@ -41,6 +41,11 @@ namespace Outlook2013TodoAddIn /// public bool ShowFriendlyGroupHeaders { get; set; } + /// + /// Gets/sets whether to show localized day names next to the days + /// + public bool ShowDayNames { get; set; } + /// /// Gets/sets the selected calendar date /// @@ -236,6 +241,10 @@ namespace Outlook2013TodoAddIn break; } } + if (this.ShowDayNames) + { + groupHeaderText += " (" + i.Start.ToString("dddd") + ")"; + } grp = new ListViewGroup(groupHeaderText, HorizontalAlignment.Left); this.lstAppointments.Groups.Add(grp); // TODO: Style it? sameDay = i.Start.Day; @@ -455,6 +464,7 @@ namespace Outlook2013TodoAddIn this.ShowPastAppointments = cfg.ShowPastAppointments; this.Accounts = cfg.Accounts; this.ShowFriendlyGroupHeaders = cfg.ShowFriendlyGroupHeaders; + this.ShowDayNames = cfg.ShowDayNames; this.ShowTasks = cfg.ShowTasks; this.FirstDayOfWeek = cfg.FirstDayOfWeek; this.RetrieveData(); diff --git a/Outlook2013TodoAddIn/Forms/FormConfiguration.Designer.cs b/Outlook2013TodoAddIn/Forms/FormConfiguration.Designer.cs index 2bb92d1..05c5935 100644 --- a/Outlook2013TodoAddIn/Forms/FormConfiguration.Designer.cs +++ b/Outlook2013TodoAddIn/Forms/FormConfiguration.Designer.cs @@ -40,6 +40,7 @@ this.chkShowTasks = new System.Windows.Forms.CheckBox(); this.cboFirstDayOfWeek = new System.Windows.Forms.ComboBox(); this.lblFirstDayOfWeek = new System.Windows.Forms.Label(); + this.chkShowDayNames = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).BeginInit(); this.SuspendLayout(); // @@ -87,7 +88,7 @@ // btnCancel // this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(168, 374); + this.btnCancel.Location = new System.Drawing.Point(168, 403); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(87, 37); this.btnCancel.TabIndex = 11; @@ -97,7 +98,7 @@ // btnOK // this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.btnOK.Location = new System.Drawing.Point(26, 374); + this.btnOK.Location = new System.Drawing.Point(26, 403); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(87, 37); this.btnOK.TabIndex = 10; @@ -118,7 +119,7 @@ // chkListCalendars // this.chkListCalendars.FormattingEnabled = true; - this.chkListCalendars.Location = new System.Drawing.Point(26, 259); + this.chkListCalendars.Location = new System.Drawing.Point(26, 288); this.chkListCalendars.Name = "chkListCalendars"; this.chkListCalendars.Size = new System.Drawing.Size(229, 106); this.chkListCalendars.TabIndex = 13; @@ -126,7 +127,7 @@ // lblAccounts // this.lblAccounts.AutoSize = true; - this.lblAccounts.Location = new System.Drawing.Point(23, 239); + this.lblAccounts.Location = new System.Drawing.Point(23, 268); this.lblAccounts.Name = "lblAccounts"; this.lblAccounts.Size = new System.Drawing.Size(70, 17); this.lblAccounts.TabIndex = 14; @@ -145,7 +146,7 @@ // chkShowTasks // this.chkShowTasks.AutoSize = true; - this.chkShowTasks.Location = new System.Drawing.Point(45, 148); + this.chkShowTasks.Location = new System.Drawing.Point(45, 177); this.chkShowTasks.Name = "chkShowTasks"; this.chkShowTasks.Size = new System.Drawing.Size(106, 21); this.chkShowTasks.TabIndex = 16; @@ -157,7 +158,7 @@ // this.cboFirstDayOfWeek.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cboFirstDayOfWeek.FormattingEnabled = true; - this.cboFirstDayOfWeek.Location = new System.Drawing.Point(45, 201); + this.cboFirstDayOfWeek.Location = new System.Drawing.Point(45, 230); this.cboFirstDayOfWeek.Name = "cboFirstDayOfWeek"; this.cboFirstDayOfWeek.Size = new System.Drawing.Size(186, 24); this.cboFirstDayOfWeek.TabIndex = 17; @@ -165,12 +166,22 @@ // lblFirstDayOfWeek // this.lblFirstDayOfWeek.AutoSize = true; - this.lblFirstDayOfWeek.Location = new System.Drawing.Point(42, 181); + this.lblFirstDayOfWeek.Location = new System.Drawing.Point(42, 210); this.lblFirstDayOfWeek.Name = "lblFirstDayOfWeek"; this.lblFirstDayOfWeek.Size = new System.Drawing.Size(124, 17); this.lblFirstDayOfWeek.TabIndex = 18; this.lblFirstDayOfWeek.Text = "First Day of Week:"; // + // chkShowDayNames + // + this.chkShowDayNames.AutoSize = true; + this.chkShowDayNames.Location = new System.Drawing.Point(45, 150); + this.chkShowDayNames.Name = "chkShowDayNames"; + this.chkShowDayNames.Size = new System.Drawing.Size(141, 21); + this.chkShowDayNames.TabIndex = 19; + this.chkShowDayNames.Text = "Show Day Names"; + this.chkShowDayNames.UseVisualStyleBackColor = true; + // // FormConfiguration // this.AcceptButton = this.btnOK; @@ -178,6 +189,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnCancel; this.ClientSize = new System.Drawing.Size(282, 452); + this.Controls.Add(this.chkShowDayNames); this.Controls.Add(this.lblFirstDayOfWeek); this.Controls.Add(this.cboFirstDayOfWeek); this.Controls.Add(this.chkShowTasks); @@ -218,5 +230,6 @@ private System.Windows.Forms.CheckBox chkShowTasks; private System.Windows.Forms.ComboBox cboFirstDayOfWeek; private System.Windows.Forms.Label lblFirstDayOfWeek; + private System.Windows.Forms.CheckBox chkShowDayNames; } } \ No newline at end of file diff --git a/Outlook2013TodoAddIn/Forms/FormConfiguration.cs b/Outlook2013TodoAddIn/Forms/FormConfiguration.cs index 57e1c43..efdf208 100644 --- a/Outlook2013TodoAddIn/Forms/FormConfiguration.cs +++ b/Outlook2013TodoAddIn/Forms/FormConfiguration.cs @@ -67,6 +67,15 @@ namespace Outlook2013TodoAddIn.Forms set { this.chkFriendlyGroupHeaders.Checked = value; } } + /// + /// Gets/sets whether to show localized day names next to the days + /// + public bool ShowDayNames + { + get { return this.chkShowDayNames.Checked; } + set { this.chkShowDayNames.Checked = value; } + } + /// /// Gets/sets whether to show the tasks list /// @@ -108,6 +117,7 @@ namespace Outlook2013TodoAddIn.Forms this.chkMailAlerts.Checked = Properties.Settings.Default.MailAlertsEnabled; this.chkShowPastAppointments.Checked = Properties.Settings.Default.ShowPastAppointments; this.chkFriendlyGroupHeaders.Checked = Properties.Settings.Default.ShowFriendlyGroupHeaders; + this.chkShowDayNames.Checked = Properties.Settings.Default.ShowDayNames; this.chkShowTasks.Checked = Properties.Settings.Default.ShowTasks; this.LoadStores(); this.LoadDays(); @@ -147,6 +157,7 @@ namespace Outlook2013TodoAddIn.Forms Properties.Settings.Default.ShowPastAppointments = this.chkShowPastAppointments.Checked; Properties.Settings.Default.Accounts = this.Accounts; Properties.Settings.Default.ShowFriendlyGroupHeaders = this.chkFriendlyGroupHeaders.Checked; + Properties.Settings.Default.ShowDayNames = this.chkShowDayNames.Checked; Properties.Settings.Default.ShowTasks = this.chkShowTasks.Checked; Properties.Settings.Default.FirstDayOfWeek = (System.DayOfWeek)Enum.Parse(typeof(System.DayOfWeek), this.cboFirstDayOfWeek.SelectedValue.ToString()); } diff --git a/Outlook2013TodoAddIn/Properties/Settings.Designer.cs b/Outlook2013TodoAddIn/Properties/Settings.Designer.cs index a216cad..e279aab 100644 --- a/Outlook2013TodoAddIn/Properties/Settings.Designer.cs +++ b/Outlook2013TodoAddIn/Properties/Settings.Designer.cs @@ -153,5 +153,17 @@ namespace Outlook2013TodoAddIn.Properties { this["SplitterDistance"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool ShowDayNames { + get { + return ((bool)(this["ShowDayNames"])); + } + set { + this["ShowDayNames"] = value; + } + } } } diff --git a/Outlook2013TodoAddIn/Properties/Settings.settings b/Outlook2013TodoAddIn/Properties/Settings.settings index c5b6f2b..5076c34 100644 --- a/Outlook2013TodoAddIn/Properties/Settings.settings +++ b/Outlook2013TodoAddIn/Properties/Settings.settings @@ -35,5 +35,8 @@ 400 + + True + \ No newline at end of file diff --git a/Outlook2013TodoAddIn/ThisAddIn.cs b/Outlook2013TodoAddIn/ThisAddIn.cs index f4cf2c7..cbe3e40 100644 --- a/Outlook2013TodoAddIn/ThisAddIn.cs +++ b/Outlook2013TodoAddIn/ThisAddIn.cs @@ -44,6 +44,7 @@ namespace Outlook2013TodoAddIn this.AppControl.ShowPastAppointments = Properties.Settings.Default.ShowPastAppointments; this.AppControl.Accounts = Properties.Settings.Default.Accounts; this.AppControl.ShowFriendlyGroupHeaders = Properties.Settings.Default.ShowFriendlyGroupHeaders; + this.AppControl.ShowDayNames = Properties.Settings.Default.ShowDayNames; this.AppControl.ShowTasks = Properties.Settings.Default.ShowTasks; this.AppControl.FirstDayOfWeek = Properties.Settings.Default.FirstDayOfWeek; this.AppControl.NumDays = Properties.Settings.Default.NumDays; // Setting the value will load the appointments diff --git a/Outlook2013TodoAddIn/app.config b/Outlook2013TodoAddIn/app.config index 93a162b..ba8b03e 100644 --- a/Outlook2013TodoAddIn/app.config +++ b/Outlook2013TodoAddIn/app.config @@ -37,6 +37,9 @@ 400 + + True +