# HG changeset patch # User sl # Date 1418723950 -3600 # Node ID 906d88eb53fb10f17dbb5cdd95ce2fa6a8958110 # Parent 2549a8055bd11a9fe65e8a77c5c23f892bdf47e0 Onlu update client tree view when needed. diff -r 2549a8055bd1 -r 906d88eb53fb Interface/Interface.cs --- a/Interface/Interface.cs Sun Oct 26 16:16:57 2014 +0100 +++ b/Interface/Interface.cs Tue Dec 16 10:59:10 2014 +0100 @@ -201,6 +201,4 @@ void OnCloseOrder(); } - - } diff -r 2549a8055bd1 -r 906d88eb53fb Server/MainForm.cs --- a/Server/MainForm.cs Sun Oct 26 16:16:57 2014 +0100 +++ b/Server/MainForm.cs Tue Dec 16 10:59:10 2014 +0100 @@ -829,11 +829,14 @@ ClientData client = iClients[aSessionId]; if (client != null) { + bool somethingChanged = false; + //Make sure all our fields are in place while (client.Fields.Count < (aField.Index + 1)) { //Add a text field with proper index client.Fields.Add(new DataField(client.Fields.Count)); + somethingChanged = true; } if (client.Fields[aField.Index].IsSameLayout(aField)) @@ -842,20 +845,23 @@ client.Fields[aField.Index] = aField; // if (aField.IsText && tableLayoutPanel.Controls[aField.Index] is MarqueeLabel) - { + { //Text field control already in place, just change the text MarqueeLabel label = (MarqueeLabel)tableLayoutPanel.Controls[aField.Index]; + somethingChanged = (label.Text != aField.Text || label.TextAlign != aField.Alignment); label.Text = aField.Text; label.TextAlign = aField.Alignment; } else if (aField.IsBitmap && tableLayoutPanel.Controls[aField.Index] is PictureBox) { + somethingChanged = true; //TODO: Bitmap comp or should we leave that to clients? //Bitmap field control already in place just change the bitmap PictureBox pictureBox = (PictureBox)tableLayoutPanel.Controls[aField.Index]; pictureBox.Image = aField.Bitmap; } else { + somethingChanged = true; //The requested control in our layout it not of the correct type //Wrong control type, re-create them all UpdateTableLayoutPanel(iCurrentClientData); @@ -863,13 +869,17 @@ } else { + somethingChanged = true; //Different layout, need to rebuild it client.Fields[aField.Index] = aField; UpdateTableLayoutPanel(iCurrentClientData); } // - UpdateClientTreeViewNode(client); + if (somethingChanged) + { + UpdateClientTreeViewNode(client); + } } }