# HG changeset patch # User StephaneLenclud # Date 1448232412 -3600 # Node ID 5be2191d4be3c4c7216ca46265fcf728b69f9421 # Parent 151e11cac3b2885c19a87708486f0e85b9996524 Upgrading to SharpLibDisplay v0.1.2 diff -r 151e11cac3b2 -r 5be2191d4be3 Client/MainForm.cs --- a/Client/MainForm.cs Fri Oct 30 16:45:33 2015 +0100 +++ b/Client/MainForm.cs Sun Nov 22 23:46:52 2015 +0100 @@ -42,7 +42,7 @@ Client iClient; // ContentAlignment Alignment; - DataField iTextFieldTop; + TextField iTextFieldTop; /// @@ -52,7 +52,7 @@ { InitializeComponent(); Alignment = ContentAlignment.MiddleLeft; - iTextFieldTop = new DataField(0); + iTextFieldTop = new TextField(0); } public void OnCloseOrder() @@ -212,8 +212,8 @@ //Set our fields iClient.CreateFields(new DataField[] { - new DataField(0, textBoxTop.Text, Alignment), - new DataField(1, textBoxBottom.Text, Alignment) + new TextField(0, textBoxTop.Text, Alignment), + new TextField(1, textBoxBottom.Text, Alignment) }); } @@ -230,10 +230,10 @@ //Set texts iClient.CreateFields(new DataField[] { - new DataField(0, textBoxTop.Text, Alignment), - new DataField(1, textBoxBottom.Text, Alignment), - new DataField(2, "Third text field", Alignment), - new DataField(3, "Forth text field", Alignment) + new TextField(0, textBoxTop.Text, Alignment), + new TextField(1, textBoxBottom.Text, Alignment), + new TextField(2, "Third text field", Alignment), + new TextField(3, "Forth text field", Alignment) }); } @@ -255,7 +255,7 @@ graphics.DrawLine(blackPen, x1, y2, x2, y1); } - DataField field = new DataField(0, bitmap); + DataField field = new BitmapField(0, bitmap); //field.ColumnSpan = 2; iClient.SetField(field); } @@ -296,7 +296,7 @@ } //Create a bitmap field from the bitmap we just created - DataField field = new DataField(0, bitmap); + BitmapField field = new BitmapField(0, bitmap); //We want our bitmap field to span across two rows field.RowSpan = 2; @@ -304,8 +304,8 @@ iClient.CreateFields(new DataField[] { field, - new DataField(1, textBoxTop.Text, Alignment), - new DataField(2, textBoxBottom.Text, Alignment) + new TextField(1, textBoxTop.Text, Alignment), + new TextField(2, textBoxBottom.Text, Alignment) }); } @@ -338,19 +338,19 @@ } //Create a bitmap field from the bitmap we just created - DataField indicator1 = new DataField(2, bitmap); + DataField indicator1 = new BitmapField(2, bitmap); //Create a bitmap field from the bitmap we just created - DataField indicator2 = new DataField(3, bitmap); + DataField indicator2 = new BitmapField(3, bitmap); //Create a bitmap field from the bitmap we just created - DataField indicator3 = new DataField(4, bitmap); + DataField indicator3 = new BitmapField(4, bitmap); //Create a bitmap field from the bitmap we just created - DataField indicator4 = new DataField(5, bitmap); + DataField indicator4 = new BitmapField(5, bitmap); // - DataField textFieldTop = new DataField(0, textBoxTop.Text, Alignment); + TextField textFieldTop = new TextField(0, textBoxTop.Text, Alignment); textFieldTop.RowSpan = 2; - DataField textFieldBottom = new DataField(1, textBoxBottom.Text, Alignment); + TextField textFieldBottom = new TextField(1, textBoxBottom.Text, Alignment); textFieldBottom.RowSpan = 2; @@ -372,8 +372,8 @@ bool res = iClient.SetFields(new DataField[] { - new DataField(0, textBoxTop.Text, Alignment), - new DataField(1, textBoxBottom.Text, Alignment) + new TextField(0, textBoxTop.Text, Alignment), + new TextField(1, textBoxBottom.Text, Alignment) }); if (!res) @@ -385,14 +385,14 @@ private void buttonLayoutOneTextField_Click(object sender, EventArgs e) { - //Set one column two lines layout + //Set one column one line layout TableLayout layout = new TableLayout(1, 1); iClient.SetLayout(layout); //Set our fields iClient.CreateFields(new DataField[] { - new DataField(0, textBoxTop.Text, Alignment) + new TextField(0, textBoxTop.Text, Alignment) }); } } diff -r 151e11cac3b2 -r 5be2191d4be3 Client/SharpDisplayClient.csproj --- a/Client/SharpDisplayClient.csproj Fri Oct 30 16:45:33 2015 +0100 +++ b/Client/SharpDisplayClient.csproj Sun Nov 22 23:46:52 2015 +0100 @@ -85,7 +85,7 @@ - ..\packages\SharpLibDisplay.0.0.2\lib\net40\SharpLibDisplay.dll + ..\packages\SharpLibDisplay.0.1.2\lib\net40\SharpLibDisplay.dll True diff -r 151e11cac3b2 -r 5be2191d4be3 Client/packages.config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Client/packages.config Sun Nov 22 23:46:52 2015 +0100 @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff -r 151e11cac3b2 -r 5be2191d4be3 Server/MainForm.cs --- a/Server/MainForm.cs Fri Oct 30 16:45:33 2015 +0100 +++ b/Server/MainForm.cs Sun Nov 22 23:46:52 2015 +0100 @@ -1580,32 +1580,35 @@ while (client.Fields.Count < (aField.Index + 1)) { //Add a data field with proper index - client.Fields.Add(new DataField(client.Fields.Count)); + client.Fields.Add(new TextField(client.Fields.Count)); layoutChanged = true; } //Now that we know our fields are in place just update that one client.Fields[aField.Index] = aField; + if (client.Fields[aField.Index].IsSameLayout(aField)) { //If we are updating a field in our current client we need to update it in our panel if (aSessionId == iCurrentClientSessionId) { - if (aField.IsText && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is MarqueeLabel) + if (aField.IsTextField && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is MarqueeLabel) { + TextField textField=(TextField)aField; //Text field control already in place, just change the text MarqueeLabel label = (MarqueeLabel)tableLayoutPanel.Controls[aField.Index]; - contentChanged = (label.Text != aField.Text || label.TextAlign != aField.Alignment); - label.Text = aField.Text; - label.TextAlign = aField.Alignment; + contentChanged = (label.Text != textField.Text || label.TextAlign != textField.Alignment); + label.Text = textField.Text; + label.TextAlign = textField.Alignment; } - else if (aField.IsBitmap && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is PictureBox) + else if (aField.IsBitmapField && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is PictureBox) { + BitmapField bitmapField = (BitmapField)aField; contentChanged = 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; + pictureBox.Image = bitmapField.Bitmap; } else { @@ -1752,15 +1755,19 @@ //For each text add a new entry foreach (DataField field in aClient.Fields) { - if (!field.IsBitmap) + if (field.IsTextField) { - DataField textField = (DataField)field; + TextField textField = (TextField)field; textsRoot.Nodes.Add(new TreeNode("[Text]" + textField.Text)); } - else + else if (field.IsBitmapField) { textsRoot.Nodes.Add(new TreeNode("[Bitmap]")); } + else if (field.IsRecordingField) + { + textsRoot.Nodes.Add(new TreeNode("[Recording]")); + } } } @@ -1843,18 +1850,28 @@ if (aClient.Fields.Count <= tableLayoutPanel.Controls.Count) { //No client field specified, create a text field by default - aClient.Fields.Add(new DataField(aClient.Fields.Count)); + aClient.Fields.Add(new TextField(aClient.Fields.Count)); } + // + DataField field = aClient.Fields[tableLayoutPanel.Controls.Count]; + if (!field.IsTableField) + { + //That field is not taking part in our table layout then + //We should be ok I guess + continue; + } + + TableField tableField = (TableField)field; + //Create a control corresponding to the field specified for that cell - DataField field = aClient.Fields[tableLayoutPanel.Controls.Count]; - Control control = CreateControlForDataField(field); + Control control = CreateControlForDataField(tableField); //Add newly created control to our table layout at the specified row and column tableLayoutPanel.Controls.Add(control, i, j); //Make sure we specify row and column span for that new control - tableLayoutPanel.SetRowSpan(control,field.RowSpan); - tableLayoutPanel.SetColumnSpan(control, field.ColumnSpan); + tableLayoutPanel.SetRowSpan(control, tableField.RowSpan); + tableLayoutPanel.SetColumnSpan(control, tableField.ColumnSpan); } } @@ -1876,7 +1893,7 @@ private Control CreateControlForDataField(DataField aField) { Control control=null; - if (!aField.IsBitmap) + if (aField.IsTextField) { MarqueeLabel label = new SharpDisplayManager.MarqueeLabel(); label.AutoEllipsis = true; @@ -1895,13 +1912,14 @@ //control.TabIndex = 2; label.Font = cds.Font; - label.TextAlign = aField.Alignment; + TextField field = (TextField)aField; + label.TextAlign = field.Alignment; label.UseCompatibleTextRendering = true; - label.Text = aField.Text; + label.Text = field.Text; // control = label; } - else + else if (aField.IsBitmapField) { //Create picture box PictureBox picture = new PictureBox(); @@ -1912,10 +1930,12 @@ picture.Margin = new System.Windows.Forms.Padding(0); picture.Name = "pictureBox" + aField; //Set our image - picture.Image = aField.Bitmap; + BitmapField field = (BitmapField)aField; + picture.Image = field.Bitmap; // control = picture; } + //TODO: Handle recording field? return control; } diff -r 151e11cac3b2 -r 5be2191d4be3 Server/SharpDisplayManager.csproj --- a/Server/SharpDisplayManager.csproj Fri Oct 30 16:45:33 2015 +0100 +++ b/Server/SharpDisplayManager.csproj Sun Nov 22 23:46:52 2015 +0100 @@ -102,9 +102,7 @@ SharpDisplayManager.Program - - Resources\app.manifest - + LocalIntranet @@ -123,7 +121,7 @@ ..\packages\NAudio.1.7.3\lib\net35\NAudio.dll - ..\packages\SharpLibDisplay.0.0.2\lib\net40\SharpLibDisplay.dll + ..\packages\SharpLibDisplay.0.1.2\lib\net40\SharpLibDisplay.dll True @@ -201,9 +199,8 @@ Resources.resx True - - Designer - + + SettingsSingleFileGenerator @@ -218,9 +215,6 @@ - - - {7ee64074-8cdb-4448-b40c-81b75d6b31cd} SharpDisplayClient diff -r 151e11cac3b2 -r 5be2191d4be3 Server/packages.config --- a/Server/packages.config Fri Oct 30 16:45:33 2015 +0100 +++ b/Server/packages.config Sun Nov 22 23:46:52 2015 +0100 @@ -2,7 +2,7 @@ - + \ No newline at end of file