Added work in progress for showing week numbers

This commit is contained in:
gamosoft_cp 2014-10-16 21:22:50 +00:00
parent 7177c27b6a
commit 6d54b8a784
8 changed files with 75 additions and 10 deletions

View File

@ -46,6 +46,11 @@ namespace Outlook2013TodoAddIn
/// </summary>
public bool ShowDayNames { get; set; }
/// <summary>
/// Gets/sets whether to show week numbers
/// </summary>
public bool ShowWeekNumbers { get; set; }
/// <summary>
/// Gets/sets the selected calendar date
/// </summary>
@ -303,6 +308,7 @@ namespace Outlook2013TodoAddIn
this.lstAppointments.Items.Clear();
this.lstAppointments.Items.AddRange(lstCol.ToArray());
this.apptCalendar.ShowWeekNumbers = this.ShowWeekNumbers;
this.apptCalendar.UpdateCalendar();
}
@ -484,6 +490,7 @@ namespace Outlook2013TodoAddIn
this.Accounts = cfg.Accounts;
this.ShowFriendlyGroupHeaders = cfg.ShowFriendlyGroupHeaders;
this.ShowDayNames = cfg.ShowDayNames;
this.ShowWeekNumbers = cfg.ShowWeekNumbers;
this.ShowTasks = cfg.ShowTasks;
this.FirstDayOfWeek = cfg.FirstDayOfWeek;
this.RetrieveData();
@ -593,6 +600,11 @@ namespace Outlook2013TodoAddIn
e.Graphics.DrawString(appt.Location, this.Font, colorBrush, locationRectangle, leftFormat);
}
/// <summary>
/// The color scheme for Outlook is not the same as of Windows Forms, so this method tries to do a best effor in matching them
/// </summary>
/// <param name="col">Color of the category</param>
/// <returns>Resulting color to be displayed</returns>
private Color TranslateCategoryColor(Outlook.OlCategoryColor col)
{
Color result = Color.Black;

View File

@ -99,6 +99,11 @@ namespace Outlook2013TodoAddIn
/// </summary>
public Color HoverBackColor { get; set; }
/// <summary>
/// Gets/sets whether to show week numbers
/// </summary>
public bool ShowWeekNumbers { get; set; }
#endregion "Properties"
#region "Methods"
@ -300,6 +305,11 @@ namespace Outlook2013TodoAddIn
bool previousMonthVisible = (dayCurrent != 1);
bool nextMonthVisible = false;
if (this.ShowWeekNumbers)
{
// TODO: Show the week numbers
}
// Row 0 is for days of week
for (int row = 1; row < this.tableLayoutPanel1.RowCount; row++)
{

View File

@ -41,6 +41,7 @@
this.cboFirstDayOfWeek = new System.Windows.Forms.ComboBox();
this.lblFirstDayOfWeek = new System.Windows.Forms.Label();
this.chkShowDayNames = new System.Windows.Forms.CheckBox();
this.chkShowWeekNumbers = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).BeginInit();
this.SuspendLayout();
//
@ -88,7 +89,7 @@
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(168, 403);
this.btnCancel.Location = new System.Drawing.Point(168, 432);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(87, 37);
this.btnCancel.TabIndex = 11;
@ -98,7 +99,7 @@
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(26, 403);
this.btnOK.Location = new System.Drawing.Point(26, 432);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(87, 37);
this.btnOK.TabIndex = 10;
@ -119,7 +120,7 @@
// chkListCalendars
//
this.chkListCalendars.FormattingEnabled = true;
this.chkListCalendars.Location = new System.Drawing.Point(26, 288);
this.chkListCalendars.Location = new System.Drawing.Point(26, 317);
this.chkListCalendars.Name = "chkListCalendars";
this.chkListCalendars.Size = new System.Drawing.Size(229, 106);
this.chkListCalendars.TabIndex = 13;
@ -127,7 +128,7 @@
// lblAccounts
//
this.lblAccounts.AutoSize = true;
this.lblAccounts.Location = new System.Drawing.Point(23, 268);
this.lblAccounts.Location = new System.Drawing.Point(23, 297);
this.lblAccounts.Name = "lblAccounts";
this.lblAccounts.Size = new System.Drawing.Size(70, 17);
this.lblAccounts.TabIndex = 14;
@ -146,7 +147,7 @@
// chkShowTasks
//
this.chkShowTasks.AutoSize = true;
this.chkShowTasks.Location = new System.Drawing.Point(45, 177);
this.chkShowTasks.Location = new System.Drawing.Point(45, 206);
this.chkShowTasks.Name = "chkShowTasks";
this.chkShowTasks.Size = new System.Drawing.Size(106, 21);
this.chkShowTasks.TabIndex = 16;
@ -158,7 +159,7 @@
//
this.cboFirstDayOfWeek.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboFirstDayOfWeek.FormattingEnabled = true;
this.cboFirstDayOfWeek.Location = new System.Drawing.Point(45, 230);
this.cboFirstDayOfWeek.Location = new System.Drawing.Point(45, 259);
this.cboFirstDayOfWeek.Name = "cboFirstDayOfWeek";
this.cboFirstDayOfWeek.Size = new System.Drawing.Size(186, 24);
this.cboFirstDayOfWeek.TabIndex = 17;
@ -166,7 +167,7 @@
// lblFirstDayOfWeek
//
this.lblFirstDayOfWeek.AutoSize = true;
this.lblFirstDayOfWeek.Location = new System.Drawing.Point(42, 210);
this.lblFirstDayOfWeek.Location = new System.Drawing.Point(42, 239);
this.lblFirstDayOfWeek.Name = "lblFirstDayOfWeek";
this.lblFirstDayOfWeek.Size = new System.Drawing.Size(124, 17);
this.lblFirstDayOfWeek.TabIndex = 18;
@ -182,13 +183,24 @@
this.chkShowDayNames.Text = "Show Day Names";
this.chkShowDayNames.UseVisualStyleBackColor = true;
//
// chkShowWeekNumbers
//
this.chkShowWeekNumbers.AutoSize = true;
this.chkShowWeekNumbers.Location = new System.Drawing.Point(45, 178);
this.chkShowWeekNumbers.Name = "chkShowWeekNumbers";
this.chkShowWeekNumbers.Size = new System.Drawing.Size(165, 21);
this.chkShowWeekNumbers.TabIndex = 20;
this.chkShowWeekNumbers.Text = "Show Week Numbers";
this.chkShowWeekNumbers.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, 452);
this.ClientSize = new System.Drawing.Size(282, 482);
this.Controls.Add(this.chkShowWeekNumbers);
this.Controls.Add(this.chkShowDayNames);
this.Controls.Add(this.lblFirstDayOfWeek);
this.Controls.Add(this.cboFirstDayOfWeek);
@ -231,5 +243,6 @@
private System.Windows.Forms.ComboBox cboFirstDayOfWeek;
private System.Windows.Forms.Label lblFirstDayOfWeek;
private System.Windows.Forms.CheckBox chkShowDayNames;
private System.Windows.Forms.CheckBox chkShowWeekNumbers;
}
}

View File

@ -76,6 +76,15 @@ namespace Outlook2013TodoAddIn.Forms
set { this.chkShowDayNames.Checked = value; }
}
/// <summary>
/// Gets/sets whether to show week numbers
/// </summary>
public bool ShowWeekNumbers
{
get { return this.chkShowWeekNumbers.Checked; }
set { this.chkShowWeekNumbers.Checked = value; }
}
/// <summary>
/// Gets/sets whether to show the tasks list
/// </summary>
@ -118,6 +127,7 @@ namespace Outlook2013TodoAddIn.Forms
this.chkShowPastAppointments.Checked = Properties.Settings.Default.ShowPastAppointments;
this.chkFriendlyGroupHeaders.Checked = Properties.Settings.Default.ShowFriendlyGroupHeaders;
this.chkShowDayNames.Checked = Properties.Settings.Default.ShowDayNames;
this.chkShowWeekNumbers.Checked = Properties.Settings.Default.ShowWeekNumbers;
this.chkShowTasks.Checked = Properties.Settings.Default.ShowTasks;
this.LoadStores();
this.LoadDays();
@ -158,6 +168,7 @@ namespace Outlook2013TodoAddIn.Forms
Properties.Settings.Default.Accounts = this.Accounts;
Properties.Settings.Default.ShowFriendlyGroupHeaders = this.chkFriendlyGroupHeaders.Checked;
Properties.Settings.Default.ShowDayNames = this.chkShowDayNames.Checked;
Properties.Settings.Default.ShowWeekNumbers = this.chkShowWeekNumbers.Checked;
Properties.Settings.Default.ShowTasks = this.chkShowTasks.Checked;
Properties.Settings.Default.FirstDayOfWeek = (System.DayOfWeek)Enum.Parse(typeof(System.DayOfWeek), this.cboFirstDayOfWeek.SelectedValue.ToString());
}

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -12,7 +12,7 @@ namespace Outlook2013TodoAddIn.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -165,5 +165,17 @@ namespace Outlook2013TodoAddIn.Properties {
this["ShowDayNames"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool ShowWeekNumbers {
get {
return ((bool)(this["ShowWeekNumbers"]));
}
set {
this["ShowWeekNumbers"] = value;
}
}
}
}

View File

@ -38,5 +38,8 @@
<Setting Name="ShowDayNames" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="ShowWeekNumbers" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -45,6 +45,7 @@ namespace Outlook2013TodoAddIn
this.AppControl.Accounts = Properties.Settings.Default.Accounts;
this.AppControl.ShowFriendlyGroupHeaders = Properties.Settings.Default.ShowFriendlyGroupHeaders;
this.AppControl.ShowDayNames = Properties.Settings.Default.ShowDayNames;
this.AppControl.ShowWeekNumbers = Properties.Settings.Default.ShowWeekNumbers;
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

View File

@ -40,6 +40,9 @@
<setting name="ShowDayNames" serializeAs="String">
<value>True</value>
</setting>
<setting name="ShowWeekNumbers" serializeAs="String">
<value>False</value>
</setting>
</Outlook2013TodoAddIn.Properties.Settings>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>