Issue with split container race condition in progress

This commit is contained in:
gamosoft_cp 2013-07-24 17:09:24 +00:00
parent 477f757e3d
commit 0c2d21ee0a
2 changed files with 48 additions and 43 deletions

View File

@ -32,13 +32,13 @@
this.ctxMenuAppointments = new System.Windows.Forms.ContextMenuStrip(this.components); this.ctxMenuAppointments = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnuItemReplyAllEmail = new System.Windows.Forms.ToolStripMenuItem(); this.mnuItemReplyAllEmail = new System.Windows.Forms.ToolStripMenuItem();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.lstTasks = new System.Windows.Forms.ListView(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lstAppointments = new System.Windows.Forms.ListView(); this.lstAppointments = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.lstTasks = new System.Windows.Forms.ListView();
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.apptCalendar = new Outlook2013TodoAddIn.CustomCalendar(); this.apptCalendar = new Outlook2013TodoAddIn.CustomCalendar();
this.ctxMenuAppointments.SuspendLayout(); this.ctxMenuAppointments.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
@ -72,36 +72,24 @@
this.panel1.Size = new System.Drawing.Size(258, 767); this.panel1.Size = new System.Drawing.Size(258, 767);
this.panel1.TabIndex = 8; this.panel1.TabIndex = 8;
// //
// lstTasks // splitContainer1
// //
this.lstTasks.Activation = System.Windows.Forms.ItemActivation.OneClick; this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.lstTasks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.splitContainer1.Location = new System.Drawing.Point(0, 228);
this.columnHeader3, this.splitContainer1.Name = "splitContainer1";
this.columnHeader4}); this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
this.lstTasks.ContextMenuStrip = this.ctxMenuAppointments;
this.lstTasks.Dock = System.Windows.Forms.DockStyle.Fill;
this.lstTasks.FullRowSelect = true;
this.lstTasks.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.lstTasks.Location = new System.Drawing.Point(0, 0);
this.lstTasks.MultiSelect = false;
this.lstTasks.Name = "lstTasks";
this.lstTasks.OwnerDraw = true;
this.lstTasks.ShowItemToolTips = true;
this.lstTasks.Size = new System.Drawing.Size(258, 266);
this.lstTasks.TabIndex = 5;
this.lstTasks.TileSize = new System.Drawing.Size(300, 38);
this.lstTasks.UseCompatibleStateImageBehavior = false;
this.lstTasks.View = System.Windows.Forms.View.Tile;
// //
// columnHeader3 // splitContainer1.Panel1
// //
this.columnHeader3.Text = "Date"; this.splitContainer1.Panel1.Controls.Add(this.lstAppointments);
this.columnHeader3.Width = 200;
// //
// columnHeader4 // splitContainer1.Panel2
// //
this.columnHeader4.Text = "Subject"; this.splitContainer1.Panel2.Controls.Add(this.lstTasks);
this.columnHeader4.Width = 200; this.splitContainer1.Size = new System.Drawing.Size(258, 539);
this.splitContainer1.SplitterDistance = 269;
this.splitContainer1.TabIndex = 6;
this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitContainer1_SplitterMoved);
// //
// lstAppointments // lstAppointments
// //
@ -136,24 +124,36 @@
this.columnHeader2.Text = "Subject"; this.columnHeader2.Text = "Subject";
this.columnHeader2.Width = 200; this.columnHeader2.Width = 200;
// //
// splitContainer1 // lstTasks
// //
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.lstTasks.Activation = System.Windows.Forms.ItemActivation.OneClick;
this.splitContainer1.Location = new System.Drawing.Point(0, 228); this.lstTasks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.splitContainer1.Name = "splitContainer1"; this.columnHeader3,
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; this.columnHeader4});
this.lstTasks.ContextMenuStrip = this.ctxMenuAppointments;
this.lstTasks.Dock = System.Windows.Forms.DockStyle.Fill;
this.lstTasks.FullRowSelect = true;
this.lstTasks.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.lstTasks.Location = new System.Drawing.Point(0, 0);
this.lstTasks.MultiSelect = false;
this.lstTasks.Name = "lstTasks";
this.lstTasks.OwnerDraw = true;
this.lstTasks.ShowItemToolTips = true;
this.lstTasks.Size = new System.Drawing.Size(258, 266);
this.lstTasks.TabIndex = 5;
this.lstTasks.TileSize = new System.Drawing.Size(300, 38);
this.lstTasks.UseCompatibleStateImageBehavior = false;
this.lstTasks.View = System.Windows.Forms.View.Tile;
// //
// splitContainer1.Panel1 // columnHeader3
// //
this.splitContainer1.Panel1.Controls.Add(this.lstAppointments); this.columnHeader3.Text = "Date";
this.columnHeader3.Width = 200;
// //
// splitContainer1.Panel2 // columnHeader4
// //
this.splitContainer1.Panel2.Controls.Add(this.lstTasks); this.columnHeader4.Text = "Subject";
this.splitContainer1.Size = new System.Drawing.Size(258, 539); this.columnHeader4.Width = 200;
this.splitContainer1.SplitterDistance = 269;
this.splitContainer1.TabIndex = 6;
this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitContainer1_SplitterMoved);
// //
// apptCalendar // apptCalendar
// //

View File

@ -92,7 +92,12 @@ namespace Outlook2013TodoAddIn
if (this.ShowTasks) if (this.ShowTasks)
{ {
this.splitContainer1.Panel2Collapsed = false; this.splitContainer1.Panel2Collapsed = false;
if (Properties.Settings.Default.SplitterDistance >= this.splitContainer1.Panel1MinSize && Properties.Settings.Default.SplitterDistance <= this.splitContainer1.Height - this.splitContainer1.Panel2MinSize)
{
// This is to avoid the bug "SplitterDistance must be between Panel1MinSize and Width - Panel2MinSize."
this.splitContainer1.SplitterDistance = Properties.Settings.Default.SplitterDistance; this.splitContainer1.SplitterDistance = Properties.Settings.Default.SplitterDistance;
// TODO: This doesn't work, need to fix (race condition?)
}
// this.RetrieveTasks(); // this.RetrieveTasks();
} }
else else