Improving layout change workflow efficiency.
authorStephaneLenclud
Sat, 26 Dec 2015 17:43:41 +0100
changeset 175391bce3c8368
parent 174 f5a6cec31e81
child 176 01c72c29cfaf
Improving layout change workflow efficiency.
Client/MainForm.cs
Server/ClientData.cs
Server/MainForm.Designer.cs
Server/MainForm.cs
Server/MainForm.resx
Server/SharpDisplayManager.csproj
     1.1 --- a/Client/MainForm.cs	Wed Dec 23 18:54:38 2015 +0100
     1.2 +++ b/Client/MainForm.cs	Sat Dec 26 17:43:41 2015 +0100
     1.3 @@ -238,7 +238,7 @@
     1.4                  new TextField(1, textBoxBottom.Text, Alignment),
     1.5                  new TextField(2, "Third text field", Alignment),
     1.6                  new TextField(3, "Forth text field", Alignment),
     1.7 -                //recording
     1.8 +                recording
     1.9              });
    1.10  
    1.11          }
    1.12 @@ -363,9 +363,9 @@
    1.13              iClient.CreateFields(new DataField[]
    1.14              {
    1.15                  textFieldTop,
    1.16 +                textFieldBottom,
    1.17                  indicator1,
    1.18 -                indicator2,
    1.19 -                textFieldBottom,
    1.20 +                indicator2,                
    1.21                  indicator3,
    1.22                  indicator4
    1.23              });
     2.1 --- a/Server/ClientData.cs	Wed Dec 23 18:54:38 2015 +0100
     2.2 +++ b/Server/ClientData.cs	Sat Dec 26 17:43:41 2015 +0100
     2.3 @@ -21,6 +21,7 @@
     2.4              Fields = new List<DataField>();
     2.5              Layout = new TableLayout(1, 2); //Default to one column and two rows
     2.6              Callback = aCallback;
     2.7 +            HasNewLayout = true;            
     2.8          }
     2.9  
    2.10          public string SessionId { get; set; }
    2.11 @@ -29,6 +30,8 @@
    2.12          public TableLayout Layout { get; set; }
    2.13          public ICallback Callback { get; set; }
    2.14  
    2.15 +        public bool HasNewLayout { get; set; }
    2.16 +
    2.17          //Client management
    2.18          public DateTime LastSwitchTime { get; set; }
    2.19      }
     3.1 --- a/Server/MainForm.Designer.cs	Wed Dec 23 18:54:38 2015 +0100
     3.2 +++ b/Server/MainForm.Designer.cs	Sat Dec 26 17:43:41 2015 +0100
     3.3 @@ -40,7 +40,7 @@
     3.4              this.components = new System.ComponentModel.Container();
     3.5              System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
     3.6              this.panelDisplay = new System.Windows.Forms.Panel();
     3.7 -            this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
     3.8 +            this.iTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
     3.9              this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel();
    3.10              this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel();
    3.11              this.fontDialog = new System.Windows.Forms.FontDialog();
    3.12 @@ -112,7 +112,7 @@
    3.13              this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    3.14              this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    3.15              this.panelDisplay.SuspendLayout();
    3.16 -            this.tableLayoutPanel.SuspendLayout();
    3.17 +            this.iTableLayoutPanel.SuspendLayout();
    3.18              this.statusStrip.SuspendLayout();
    3.19              this.tabPageClients.SuspendLayout();
    3.20              this.tabPageDisplay.SuspendLayout();
    3.21 @@ -130,35 +130,35 @@
    3.22              // panelDisplay
    3.23              // 
    3.24              this.panelDisplay.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    3.25 -            this.panelDisplay.Controls.Add(this.tableLayoutPanel);
    3.26 +            this.panelDisplay.Controls.Add(this.iTableLayoutPanel);
    3.27              this.panelDisplay.Location = new System.Drawing.Point(173, 40);
    3.28              this.panelDisplay.Margin = new System.Windows.Forms.Padding(0);
    3.29              this.panelDisplay.Name = "panelDisplay";
    3.30              this.panelDisplay.Size = new System.Drawing.Size(258, 66);
    3.31              this.panelDisplay.TabIndex = 12;
    3.32              // 
    3.33 -            // tableLayoutPanel
    3.34 +            // iTableLayoutPanel
    3.35              // 
    3.36 -            this.tableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    3.37 +            this.iTableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    3.38              | System.Windows.Forms.AnchorStyles.Left) 
    3.39              | System.Windows.Forms.AnchorStyles.Right)));
    3.40 -            this.tableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
    3.41 -            this.tableLayoutPanel.BackColor = System.Drawing.SystemColors.ControlLightLight;
    3.42 -            this.tableLayoutPanel.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
    3.43 -            this.tableLayoutPanel.ColumnCount = 1;
    3.44 -            this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
    3.45 -            this.tableLayoutPanel.Controls.Add(this.marqueeLabelTop, 0, 0);
    3.46 -            this.tableLayoutPanel.Controls.Add(this.marqueeLabelBottom, 0, 1);
    3.47 -            this.tableLayoutPanel.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
    3.48 -            this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0);
    3.49 -            this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(0);
    3.50 -            this.tableLayoutPanel.Name = "tableLayoutPanel";
    3.51 -            this.tableLayoutPanel.RowCount = 2;
    3.52 -            this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
    3.53 -            this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
    3.54 -            this.tableLayoutPanel.Size = new System.Drawing.Size(256, 64);
    3.55 -            this.tableLayoutPanel.TabIndex = 5;
    3.56 -            this.tableLayoutPanel.SizeChanged += new System.EventHandler(this.tableLayoutPanel_SizeChanged);
    3.57 +            this.iTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
    3.58 +            this.iTableLayoutPanel.BackColor = System.Drawing.SystemColors.ControlLightLight;
    3.59 +            this.iTableLayoutPanel.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
    3.60 +            this.iTableLayoutPanel.ColumnCount = 1;
    3.61 +            this.iTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
    3.62 +            this.iTableLayoutPanel.Controls.Add(this.marqueeLabelTop, 0, 0);
    3.63 +            this.iTableLayoutPanel.Controls.Add(this.marqueeLabelBottom, 0, 1);
    3.64 +            this.iTableLayoutPanel.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
    3.65 +            this.iTableLayoutPanel.Location = new System.Drawing.Point(0, 0);
    3.66 +            this.iTableLayoutPanel.Margin = new System.Windows.Forms.Padding(0);
    3.67 +            this.iTableLayoutPanel.Name = "iTableLayoutPanel";
    3.68 +            this.iTableLayoutPanel.RowCount = 2;
    3.69 +            this.iTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
    3.70 +            this.iTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
    3.71 +            this.iTableLayoutPanel.Size = new System.Drawing.Size(256, 64);
    3.72 +            this.iTableLayoutPanel.TabIndex = 5;
    3.73 +            this.iTableLayoutPanel.SizeChanged += new System.EventHandler(this.tableLayoutPanel_SizeChanged);
    3.74              // 
    3.75              // marqueeLabelTop
    3.76              // 
    3.77 @@ -954,8 +954,8 @@
    3.78              this.SizeChanged += new System.EventHandler(this.MainForm_SizeChanged);
    3.79              this.Resize += new System.EventHandler(this.MainForm_Resize);
    3.80              this.panelDisplay.ResumeLayout(false);
    3.81 -            this.tableLayoutPanel.ResumeLayout(false);
    3.82 -            this.tableLayoutPanel.PerformLayout();
    3.83 +            this.iTableLayoutPanel.ResumeLayout(false);
    3.84 +            this.iTableLayoutPanel.PerformLayout();
    3.85              this.statusStrip.ResumeLayout(false);
    3.86              this.statusStrip.PerformLayout();
    3.87              this.tabPageClients.ResumeLayout(false);
    3.88 @@ -990,7 +990,7 @@
    3.89          private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelSpring;
    3.90          private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelPower;
    3.91          private System.Windows.Forms.Panel panelDisplay;
    3.92 -        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
    3.93 +        private System.Windows.Forms.TableLayoutPanel iTableLayoutPanel;
    3.94          private MarqueeLabel marqueeLabelTop;
    3.95          private MarqueeLabel marqueeLabelBottom;
    3.96          private System.Windows.Forms.TabPage tabPageClients;
     4.1 --- a/Server/MainForm.cs	Wed Dec 23 18:54:38 2015 +0100
     4.2 +++ b/Server/MainForm.cs	Sat Dec 26 17:43:41 2015 +0100
     4.3 @@ -144,7 +144,7 @@
     4.4  
     4.5              //We have a bug when drawing minimized and reusing our bitmap
     4.6              //Though I could not reproduce it on Windows 10
     4.7 -            iBmp = new System.Drawing.Bitmap(tableLayoutPanel.Width, tableLayoutPanel.Height, PixelFormat.Format32bppArgb);
     4.8 +            iBmp = new System.Drawing.Bitmap(iTableLayoutPanel.Width, iTableLayoutPanel.Height, PixelFormat.Format32bppArgb);
     4.9              iCreateBitmap = false;
    4.10  
    4.11  			//Minimize our window if desired
    4.12 @@ -668,7 +668,7 @@
    4.13              if (DlgBox.ShowDialog(fontDialog) != DialogResult.Cancel)
    4.14              {
    4.15                  //Set the fonts to all our labels in our layout
    4.16 -                foreach (Control ctrl in tableLayoutPanel.Controls)
    4.17 +                foreach (Control ctrl in iTableLayoutPanel.Controls)
    4.18                  {
    4.19                      if (ctrl is MarqueeLabel)
    4.20                      {
    4.21 @@ -704,7 +704,7 @@
    4.22  
    4.23              MarqueeLabel label = null;
    4.24              //Get the first label control we can find
    4.25 -            foreach (Control ctrl in tableLayoutPanel.Controls)
    4.26 +            foreach (Control ctrl in iTableLayoutPanel.Controls)
    4.27              {
    4.28                  if (ctrl is MarqueeLabel)
    4.29                  {
    4.30 @@ -728,12 +728,12 @@
    4.31  
    4.32          private void buttonCapture_Click(object sender, EventArgs e)
    4.33          {
    4.34 -            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(tableLayoutPanel.Width, tableLayoutPanel.Height);
    4.35 -            tableLayoutPanel.DrawToBitmap(bmp, tableLayoutPanel.ClientRectangle);
    4.36 +            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(iTableLayoutPanel.Width, iTableLayoutPanel.Height);
    4.37 +            iTableLayoutPanel.DrawToBitmap(bmp, iTableLayoutPanel.ClientRectangle);
    4.38              //Bitmap bmpToSave = new Bitmap(bmp);
    4.39              bmp.Save("D:\\capture.png");
    4.40  
    4.41 -            ((MarqueeLabel)tableLayoutPanel.Controls[0]).Text = "Captured";
    4.42 +            ((MarqueeLabel)iTableLayoutPanel.Controls[0]).Text = "Captured";
    4.43  
    4.44              /*
    4.45              string outputFileName = "d:\\capture.png";
    4.46 @@ -876,7 +876,7 @@
    4.47  			UpdateNetworkSignal(LastTickTime, NewTickTime);
    4.48  
    4.49              //Update animation for all our marquees
    4.50 -            foreach (Control ctrl in tableLayoutPanel.Controls)
    4.51 +            foreach (Control ctrl in iTableLayoutPanel.Controls)
    4.52              {
    4.53                  if (ctrl is MarqueeLabel)
    4.54                  {
    4.55 @@ -896,10 +896,10 @@
    4.56  					//Draw to bitmap
    4.57  					if (iCreateBitmap)
    4.58  					{
    4.59 -                        iBmp = new System.Drawing.Bitmap(tableLayoutPanel.Width, tableLayoutPanel.Height, PixelFormat.Format32bppArgb);
    4.60 +                        iBmp = new System.Drawing.Bitmap(iTableLayoutPanel.Width, iTableLayoutPanel.Height, PixelFormat.Format32bppArgb);
    4.61                          iCreateBitmap = false;
    4.62                      }
    4.63 -					tableLayoutPanel.DrawToBitmap(iBmp, tableLayoutPanel.ClientRectangle);
    4.64 +					iTableLayoutPanel.DrawToBitmap(iBmp, iTableLayoutPanel.ClientRectangle);
    4.65  					//iBmp.Save("D:\\capture.png");
    4.66  
    4.67  					//Send it to our display
    4.68 @@ -1057,10 +1057,10 @@
    4.69          {            
    4.70              //Load settings
    4.71              checkBoxShowBorders.Checked = cds.ShowBorders;
    4.72 -            tableLayoutPanel.CellBorderStyle = (cds.ShowBorders ? TableLayoutPanelCellBorderStyle.Single : TableLayoutPanelCellBorderStyle.None);
    4.73 +            iTableLayoutPanel.CellBorderStyle = (cds.ShowBorders ? TableLayoutPanelCellBorderStyle.Single : TableLayoutPanelCellBorderStyle.None);
    4.74  
    4.75              //Set the proper font to each of our labels
    4.76 -            foreach (MarqueeLabel ctrl in tableLayoutPanel.Controls)
    4.77 +            foreach (MarqueeLabel ctrl in iTableLayoutPanel.Controls)
    4.78              {
    4.79                  ctrl.Font = cds.Font;
    4.80              }
    4.81 @@ -1123,7 +1123,7 @@
    4.82  				//We have a display connection
    4.83  				//Reflect that in our UI
    4.84  
    4.85 -				tableLayoutPanel.Enabled = true;
    4.86 +				iTableLayoutPanel.Enabled = true;
    4.87  				panelDisplay.Enabled = true;
    4.88  
    4.89                  //Only setup brightness if display is open
    4.90 @@ -1195,7 +1195,7 @@
    4.91  				//Display is connection not available
    4.92  				//Reflect that in our UI
    4.93  				checkBoxShowVolumeLabel.Enabled = false;
    4.94 -				tableLayoutPanel.Enabled = false;
    4.95 +				iTableLayoutPanel.Enabled = false;
    4.96  				panelDisplay.Enabled = false;
    4.97                  buttonFill.Enabled = false;
    4.98                  buttonClear.Enabled = false;
    4.99 @@ -1228,7 +1228,7 @@
   4.100          private void checkBoxShowBorders_CheckedChanged(object sender, EventArgs e)
   4.101          {
   4.102              //Save our show borders setting
   4.103 -            tableLayoutPanel.CellBorderStyle = (checkBoxShowBorders.Checked ? TableLayoutPanelCellBorderStyle.Single : TableLayoutPanelCellBorderStyle.None);
   4.104 +            iTableLayoutPanel.CellBorderStyle = (checkBoxShowBorders.Checked ? TableLayoutPanelCellBorderStyle.Single : TableLayoutPanelCellBorderStyle.None);
   4.105              cds.ShowBorders = checkBoxShowBorders.Checked;
   4.106              Properties.Settings.Default.Save();
   4.107              CheckFontHeight();
   4.108 @@ -1382,9 +1382,9 @@
   4.109  		/// </summary>
   4.110  		private void ClearLayout()
   4.111  		{
   4.112 -			tableLayoutPanel.Controls.Clear();
   4.113 -			tableLayoutPanel.RowStyles.Clear();
   4.114 -			tableLayoutPanel.ColumnStyles.Clear();
   4.115 +			iTableLayoutPanel.Controls.Clear();
   4.116 +			iTableLayoutPanel.RowStyles.Clear();
   4.117 +			iTableLayoutPanel.ColumnStyles.Clear();
   4.118  			iCurrentClientData = null;
   4.119  		}
   4.120  
   4.121 @@ -1529,6 +1529,8 @@
   4.122                          Debug.Print("SetClientLayoutThreadSafe: Layout updated.");
   4.123                          //Set our client layout then
   4.124                          client.Layout = aLayout;
   4.125 +                        //So that next time we update all our fields at ones
   4.126 +                        client.HasNewLayout = true;
   4.127                          //Layout has changed clear our fields then
   4.128                          client.Fields.Clear();
   4.129                          //
   4.130 @@ -1564,7 +1566,7 @@
   4.131          }
   4.132  
   4.133          /// <summary>
   4.134 -        ///
   4.135 +        /// Set a data field in the given client.
   4.136          /// </summary>
   4.137          /// <param name="aSessionId"></param>
   4.138          /// <param name="aField"></param>
   4.139 @@ -1584,30 +1586,32 @@
   4.140                  layoutChanged = true;
   4.141              }
   4.142  
   4.143 +            //Keep our previous field in there
   4.144 +            DataField previousField = client.Fields[aField.Index];
   4.145              //Now that we know our fields are in place just update that one
   4.146              client.Fields[aField.Index] = aField;
   4.147  
   4.148  
   4.149 -            if (client.Fields[aField.Index].IsSameLayout(aField))
   4.150 +            if (previousField.IsSameLayout(aField))
   4.151              {
   4.152                  //If we are updating a field in our current client we need to update it in our panel
   4.153                  if (aSessionId == iCurrentClientSessionId)
   4.154                  {
   4.155 -                    if (aField.IsTextField && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is MarqueeLabel)
   4.156 +                    if (aField.IsTextField && aField.Index < iTableLayoutPanel.Controls.Count && iTableLayoutPanel.Controls[aField.Index] is MarqueeLabel)
   4.157                      {
   4.158                          TextField textField=(TextField)aField;
   4.159                          //Text field control already in place, just change the text
   4.160 -                        MarqueeLabel label = (MarqueeLabel)tableLayoutPanel.Controls[aField.Index];
   4.161 +                        MarqueeLabel label = (MarqueeLabel)iTableLayoutPanel.Controls[aField.Index];
   4.162                          contentChanged = (label.Text != textField.Text || label.TextAlign != textField.Alignment);
   4.163                          label.Text = textField.Text;
   4.164                          label.TextAlign = textField.Alignment;
   4.165                      }
   4.166 -                    else if (aField.IsBitmapField && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is PictureBox)
   4.167 +                    else if (aField.IsBitmapField && aField.Index < iTableLayoutPanel.Controls.Count && iTableLayoutPanel.Controls[aField.Index] is PictureBox)
   4.168                      {
   4.169                          BitmapField bitmapField = (BitmapField)aField;
   4.170                          contentChanged = true; //TODO: Bitmap comp or should we leave that to clients?
   4.171                          //Bitmap field control already in place just change the bitmap
   4.172 -                        PictureBox pictureBox = (PictureBox)tableLayoutPanel.Controls[aField.Index];
   4.173 +                        PictureBox pictureBox = (PictureBox)iTableLayoutPanel.Controls[aField.Index];
   4.174                          pictureBox.Image = bitmapField.Bitmap;
   4.175                      }
   4.176                      else
   4.177 @@ -1664,10 +1668,33 @@
   4.178              }
   4.179              else
   4.180              {
   4.181 -                //Put each our text fields in a label control
   4.182 -                foreach (DataField field in aFields)
   4.183 +                ClientData client = iClients[aSessionId];
   4.184 +
   4.185 +                if (client.HasNewLayout)
   4.186                  {
   4.187 -                    SetClientField(aSessionId, field);
   4.188 +                    //TODO: Assert client.Count == 0
   4.189 +                    //Our layout was just changed
   4.190 +                    //Do some special handling to avoid re-creating our panel N times, once for each fields
   4.191 +                    client.HasNewLayout = false;
   4.192 +                    //Just set all our fields then
   4.193 +                    client.Fields.AddRange(aFields);
   4.194 +                    //Try switch to that client
   4.195 +                    SetCurrentClient(aSessionId);
   4.196 +
   4.197 +                    //If we are updating the current client update our panel
   4.198 +                    if (aSessionId == iCurrentClientSessionId)
   4.199 +                    {
   4.200 +                        //Apply layout and set data fields.
   4.201 +                        UpdateTableLayoutPanel(iCurrentClientData);
   4.202 +                    }
   4.203 +                }
   4.204 +                else
   4.205 +                {
   4.206 +                    //Put each our text fields in a label control
   4.207 +                    foreach (DataField field in aFields)
   4.208 +                    {
   4.209 +                        SetClientField(aSessionId, field);
   4.210 +                    }
   4.211                  }
   4.212              }
   4.213          }
   4.214 @@ -1780,20 +1807,22 @@
   4.215          /// </summary>
   4.216          private void UpdateTableLayoutRowStyles()
   4.217          {
   4.218 -            foreach (RowStyle rowStyle in tableLayoutPanel.RowStyles)
   4.219 +            foreach (RowStyle rowStyle in iTableLayoutPanel.RowStyles)
   4.220              {
   4.221                  rowStyle.SizeType = SizeType.Percent;
   4.222 -                rowStyle.Height = 100 / tableLayoutPanel.RowCount;
   4.223 +                rowStyle.Height = 100 / iTableLayoutPanel.RowCount;
   4.224              }
   4.225          }
   4.226  
   4.227          /// <summary>
   4.228          /// Update our display table layout.
   4.229 +        /// Will instanciated every field control as defined by our client.
   4.230 +        /// Fields must be specified by rows from the left.
   4.231          /// </summary>
   4.232          /// <param name="aLayout"></param>
   4.233          private void UpdateTableLayoutPanel(ClientData aClient)
   4.234          {
   4.235 -            Debug.Print("UpdateClientTreeViewNode");
   4.236 +            Debug.Print("UpdateTableLayoutPanel");
   4.237  
   4.238  			if (aClient == null)
   4.239  			{
   4.240 @@ -1806,37 +1835,41 @@
   4.241              int fieldCount = 0;
   4.242  
   4.243              //First clean our current panel
   4.244 -            tableLayoutPanel.Controls.Clear();
   4.245 -            tableLayoutPanel.RowStyles.Clear();
   4.246 -            tableLayoutPanel.ColumnStyles.Clear();
   4.247 -            tableLayoutPanel.RowCount = 0;
   4.248 -            tableLayoutPanel.ColumnCount = 0;
   4.249 +            iTableLayoutPanel.Controls.Clear();
   4.250 +            iTableLayoutPanel.RowStyles.Clear();
   4.251 +            iTableLayoutPanel.ColumnStyles.Clear();
   4.252 +            iTableLayoutPanel.RowCount = 0;
   4.253 +            iTableLayoutPanel.ColumnCount = 0;
   4.254  
   4.255 -            while (tableLayoutPanel.RowCount < layout.Rows.Count)
   4.256 +            //Then recreate our rows...
   4.257 +            while (iTableLayoutPanel.RowCount < layout.Rows.Count)
   4.258              {
   4.259 -                tableLayoutPanel.RowCount++;
   4.260 +                iTableLayoutPanel.RowCount++;
   4.261              }
   4.262  
   4.263 -            while (tableLayoutPanel.ColumnCount < layout.Columns.Count)
   4.264 +            // ...and columns 
   4.265 +            while (iTableLayoutPanel.ColumnCount < layout.Columns.Count)
   4.266              {
   4.267 -                tableLayoutPanel.ColumnCount++;
   4.268 +                iTableLayoutPanel.ColumnCount++;
   4.269              }
   4.270  
   4.271 -            for (int i = 0; i < tableLayoutPanel.ColumnCount; i++)
   4.272 +            //For each column
   4.273 +            for (int i = 0; i < iTableLayoutPanel.ColumnCount; i++)
   4.274              {
   4.275                  //Create our column styles
   4.276 -                this.tableLayoutPanel.ColumnStyles.Add(layout.Columns[i]);
   4.277 +                this.iTableLayoutPanel.ColumnStyles.Add(layout.Columns[i]);
   4.278  
   4.279 -                for (int j = 0; j < tableLayoutPanel.RowCount; j++)
   4.280 +                //For each rows
   4.281 +                for (int j = 0; j < iTableLayoutPanel.RowCount; j++)
   4.282                  {
   4.283                      if (i == 0)
   4.284                      {
   4.285                          //Create our row styles
   4.286 -                        this.tableLayoutPanel.RowStyles.Add(layout.Rows[j]);
   4.287 +                        this.iTableLayoutPanel.RowStyles.Add(layout.Rows[j]);
   4.288                      }
   4.289  
   4.290                      //Check if we already have a control
   4.291 -                    Control existingControl = tableLayoutPanel.GetControlFromPosition(i,j);
   4.292 +                    Control existingControl = iTableLayoutPanel.GetControlFromPosition(i,j);
   4.293                      if (existingControl!=null)
   4.294                      {
   4.295                          //We already have a control in that cell as a results of row/col spanning
   4.296 @@ -1847,14 +1880,14 @@
   4.297                      fieldCount++;
   4.298  
   4.299                      //Check if a client field already exists for that cell
   4.300 -                    if (aClient.Fields.Count <= tableLayoutPanel.Controls.Count)
   4.301 +                    if (aClient.Fields.Count <= iTableLayoutPanel.Controls.Count)
   4.302                      {
   4.303                          //No client field specified, create a text field by default
   4.304                          aClient.Fields.Add(new TextField(aClient.Fields.Count));
   4.305                      }
   4.306  
   4.307                      //
   4.308 -                    DataField field = aClient.Fields[tableLayoutPanel.Controls.Count];
   4.309 +                    DataField field = aClient.Fields[iTableLayoutPanel.Controls.Count];
   4.310                      if (!field.IsTableField)
   4.311                      {
   4.312                          //That field is not taking part in our table layout then 
   4.313 @@ -1868,10 +1901,10 @@
   4.314                      Control control = CreateControlForDataField(tableField);
   4.315  
   4.316                      //Add newly created control to our table layout at the specified row and column
   4.317 -                    tableLayoutPanel.Controls.Add(control, i, j);
   4.318 +                    iTableLayoutPanel.Controls.Add(control, i, j);
   4.319                      //Make sure we specify row and column span for that new control
   4.320 -                    tableLayoutPanel.SetRowSpan(control, tableField.RowSpan);
   4.321 -                    tableLayoutPanel.SetColumnSpan(control, tableField.ColumnSpan);
   4.322 +                    iTableLayoutPanel.SetRowSpan(control, tableField.RowSpan);
   4.323 +                    iTableLayoutPanel.SetColumnSpan(control, tableField.ColumnSpan);
   4.324                  }
   4.325              }
   4.326  
   4.327 @@ -2018,7 +2051,7 @@
   4.328              Properties.Settings.Default.Save();
   4.329  
   4.330  			//Update our text fields
   4.331 -			foreach (MarqueeLabel ctrl in tableLayoutPanel.Controls)
   4.332 +			foreach (MarqueeLabel ctrl in iTableLayoutPanel.Controls)
   4.333  			{
   4.334  				ctrl.Separator = cds.Separator;
   4.335  			}
     5.1 --- a/Server/MainForm.resx	Wed Dec 23 18:54:38 2015 +0100
     5.2 +++ b/Server/MainForm.resx	Sat Dec 26 17:43:41 2015 +0100
     5.3 @@ -185,9 +185,6 @@
     5.4          WSC3/b/CbwiR/gNzbuWksIMBOAAAAABJRU5ErkJggg==
     5.5  </value>
     5.6    </data>
     5.7 -  <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     5.8 -    <value>315, 17</value>
     5.9 -  </metadata>
    5.10    <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    5.11      <value>405, 17</value>
    5.12    </metadata>
     6.1 --- a/Server/SharpDisplayManager.csproj	Wed Dec 23 18:54:38 2015 +0100
     6.2 +++ b/Server/SharpDisplayManager.csproj	Sat Dec 26 17:43:41 2015 +0100
     6.3 @@ -204,7 +204,6 @@
     6.4      </Compile>
     6.5      <None Include="App.config" />
     6.6      <None Include="app.manifest" />
     6.7 -    <None Include="ClassDiagram1.cd" />
     6.8      <None Include="packages.config" />
     6.9      <None Include="Properties\Settings.settings">
    6.10        <Generator>SettingsSingleFileGenerator</Generator>