Upgrading to SharpLibDisplay v0.1.2
authorStephaneLenclud
Sun, 22 Nov 2015 23:46:52 +0100
changeset 1725be2191d4be3
parent 171 151e11cac3b2
child 173 d33776198be5
Upgrading to SharpLibDisplay v0.1.2
Client/MainForm.cs
Client/SharpDisplayClient.csproj
Client/packages.config
Server/MainForm.cs
Server/SharpDisplayManager.csproj
Server/packages.config
     1.1 --- a/Client/MainForm.cs	Fri Oct 30 16:45:33 2015 +0100
     1.2 +++ b/Client/MainForm.cs	Sun Nov 22 23:46:52 2015 +0100
     1.3 @@ -42,7 +42,7 @@
     1.4          Client iClient;
     1.5  		//
     1.6          ContentAlignment Alignment;
     1.7 -        DataField iTextFieldTop;
     1.8 +        TextField iTextFieldTop;
     1.9  
    1.10  		
    1.11  		/// <summary>
    1.12 @@ -52,7 +52,7 @@
    1.13          {
    1.14              InitializeComponent();
    1.15              Alignment = ContentAlignment.MiddleLeft;
    1.16 -            iTextFieldTop = new DataField(0);
    1.17 +            iTextFieldTop = new TextField(0);
    1.18          }
    1.19  
    1.20          public void OnCloseOrder()
    1.21 @@ -212,8 +212,8 @@
    1.22  			//Set our fields
    1.23  			iClient.CreateFields(new DataField[]
    1.24              {
    1.25 -                new DataField(0, textBoxTop.Text, Alignment),
    1.26 -                new DataField(1, textBoxBottom.Text, Alignment)
    1.27 +                new TextField(0, textBoxTop.Text, Alignment),
    1.28 +                new TextField(1, textBoxBottom.Text, Alignment)
    1.29              });
    1.30  
    1.31  		}
    1.32 @@ -230,10 +230,10 @@
    1.33              //Set texts
    1.34              iClient.CreateFields(new DataField[]
    1.35              {                
    1.36 -                new DataField(0, textBoxTop.Text, Alignment),
    1.37 -                new DataField(1, textBoxBottom.Text, Alignment),
    1.38 -                new DataField(2, "Third text field", Alignment),
    1.39 -                new DataField(3, "Forth text field", Alignment)
    1.40 +                new TextField(0, textBoxTop.Text, Alignment),
    1.41 +                new TextField(1, textBoxBottom.Text, Alignment),
    1.42 +                new TextField(2, "Third text field", Alignment),
    1.43 +                new TextField(3, "Forth text field", Alignment)
    1.44              });
    1.45  
    1.46          }
    1.47 @@ -255,7 +255,7 @@
    1.48                  graphics.DrawLine(blackPen, x1, y2, x2, y1);
    1.49              }
    1.50  
    1.51 -            DataField field = new DataField(0, bitmap);
    1.52 +            DataField field = new BitmapField(0, bitmap);
    1.53              //field.ColumnSpan = 2;
    1.54              iClient.SetField(field);
    1.55          }
    1.56 @@ -296,7 +296,7 @@
    1.57              }
    1.58  
    1.59              //Create a bitmap field from the bitmap we just created
    1.60 -            DataField field = new DataField(0, bitmap);
    1.61 +            BitmapField field = new BitmapField(0, bitmap);
    1.62              //We want our bitmap field to span across two rows
    1.63              field.RowSpan = 2;
    1.64  
    1.65 @@ -304,8 +304,8 @@
    1.66              iClient.CreateFields(new DataField[]
    1.67              {
    1.68                  field,
    1.69 -                new DataField(1, textBoxTop.Text, Alignment),
    1.70 -                new DataField(2, textBoxBottom.Text, Alignment)
    1.71 +                new TextField(1, textBoxTop.Text, Alignment),
    1.72 +                new TextField(2, textBoxBottom.Text, Alignment)
    1.73              });
    1.74  
    1.75          }
    1.76 @@ -338,19 +338,19 @@
    1.77              }
    1.78  
    1.79              //Create a bitmap field from the bitmap we just created
    1.80 -            DataField indicator1 = new DataField(2, bitmap);
    1.81 +            DataField indicator1 = new BitmapField(2, bitmap);
    1.82              //Create a bitmap field from the bitmap we just created
    1.83 -            DataField indicator2 = new DataField(3, bitmap);
    1.84 +            DataField indicator2 = new BitmapField(3, bitmap);
    1.85              //Create a bitmap field from the bitmap we just created
    1.86 -            DataField indicator3 = new DataField(4, bitmap);
    1.87 +            DataField indicator3 = new BitmapField(4, bitmap);
    1.88              //Create a bitmap field from the bitmap we just created
    1.89 -            DataField indicator4 = new DataField(5, bitmap);
    1.90 +            DataField indicator4 = new BitmapField(5, bitmap);
    1.91  
    1.92              //
    1.93 -            DataField textFieldTop = new DataField(0, textBoxTop.Text, Alignment);
    1.94 +            TextField textFieldTop = new TextField(0, textBoxTop.Text, Alignment);
    1.95              textFieldTop.RowSpan = 2;
    1.96  
    1.97 -            DataField textFieldBottom = new DataField(1, textBoxBottom.Text, Alignment);
    1.98 +            TextField textFieldBottom = new TextField(1, textBoxBottom.Text, Alignment);
    1.99              textFieldBottom.RowSpan = 2;
   1.100  
   1.101  
   1.102 @@ -372,8 +372,8 @@
   1.103  
   1.104              bool res = iClient.SetFields(new DataField[]
   1.105              {
   1.106 -                new DataField(0, textBoxTop.Text, Alignment),
   1.107 -                new DataField(1, textBoxBottom.Text, Alignment)
   1.108 +                new TextField(0, textBoxTop.Text, Alignment),
   1.109 +                new TextField(1, textBoxBottom.Text, Alignment)
   1.110              });
   1.111  
   1.112              if (!res)
   1.113 @@ -385,14 +385,14 @@
   1.114  
   1.115  		private void buttonLayoutOneTextField_Click(object sender, EventArgs e)
   1.116  		{
   1.117 -			//Set one column two lines layout
   1.118 +			//Set one column one line layout
   1.119  			TableLayout layout = new TableLayout(1, 1);
   1.120  			iClient.SetLayout(layout);
   1.121  
   1.122  			//Set our fields
   1.123  			iClient.CreateFields(new DataField[]
   1.124              {
   1.125 -                new DataField(0, textBoxTop.Text, Alignment)
   1.126 +                new TextField(0, textBoxTop.Text, Alignment)
   1.127              });
   1.128  		}
   1.129      }
     2.1 --- a/Client/SharpDisplayClient.csproj	Fri Oct 30 16:45:33 2015 +0100
     2.2 +++ b/Client/SharpDisplayClient.csproj	Sun Nov 22 23:46:52 2015 +0100
     2.3 @@ -85,7 +85,7 @@
     2.4    </PropertyGroup>
     2.5    <ItemGroup>
     2.6      <Reference Include="SharpLibDisplay, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
     2.7 -      <HintPath>..\packages\SharpLibDisplay.0.0.2\lib\net40\SharpLibDisplay.dll</HintPath>
     2.8 +      <HintPath>..\packages\SharpLibDisplay.0.1.2\lib\net40\SharpLibDisplay.dll</HintPath>
     2.9        <Private>True</Private>
    2.10      </Reference>
    2.11      <Reference Include="System" />
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Client/packages.config	Sun Nov 22 23:46:52 2015 +0100
     3.3 @@ -0,0 +1,4 @@
     3.4 +<?xml version="1.0" encoding="utf-8"?>
     3.5 +<packages>
     3.6 +  <package id="SharpLibDisplay" version="0.1.2" targetFramework="net46" />
     3.7 +</packages>
     3.8 \ No newline at end of file
     4.1 --- a/Server/MainForm.cs	Fri Oct 30 16:45:33 2015 +0100
     4.2 +++ b/Server/MainForm.cs	Sun Nov 22 23:46:52 2015 +0100
     4.3 @@ -1580,32 +1580,35 @@
     4.4              while (client.Fields.Count < (aField.Index + 1))
     4.5              {
     4.6                  //Add a data field with proper index
     4.7 -                client.Fields.Add(new DataField(client.Fields.Count));
     4.8 +                client.Fields.Add(new TextField(client.Fields.Count));
     4.9                  layoutChanged = true;
    4.10              }
    4.11  
    4.12              //Now that we know our fields are in place just update that one
    4.13              client.Fields[aField.Index] = aField;
    4.14  
    4.15 +
    4.16              if (client.Fields[aField.Index].IsSameLayout(aField))
    4.17              {
    4.18                  //If we are updating a field in our current client we need to update it in our panel
    4.19                  if (aSessionId == iCurrentClientSessionId)
    4.20                  {
    4.21 -                    if (aField.IsText && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is MarqueeLabel)
    4.22 +                    if (aField.IsTextField && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is MarqueeLabel)
    4.23                      {
    4.24 +                        TextField textField=(TextField)aField;
    4.25                          //Text field control already in place, just change the text
    4.26                          MarqueeLabel label = (MarqueeLabel)tableLayoutPanel.Controls[aField.Index];
    4.27 -                        contentChanged = (label.Text != aField.Text || label.TextAlign != aField.Alignment);
    4.28 -                        label.Text = aField.Text;
    4.29 -                        label.TextAlign = aField.Alignment;
    4.30 +                        contentChanged = (label.Text != textField.Text || label.TextAlign != textField.Alignment);
    4.31 +                        label.Text = textField.Text;
    4.32 +                        label.TextAlign = textField.Alignment;
    4.33                      }
    4.34 -                    else if (aField.IsBitmap && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is PictureBox)
    4.35 +                    else if (aField.IsBitmapField && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is PictureBox)
    4.36                      {
    4.37 +                        BitmapField bitmapField = (BitmapField)aField;
    4.38                          contentChanged = true; //TODO: Bitmap comp or should we leave that to clients?
    4.39                          //Bitmap field control already in place just change the bitmap
    4.40                          PictureBox pictureBox = (PictureBox)tableLayoutPanel.Controls[aField.Index];
    4.41 -                        pictureBox.Image = aField.Bitmap;
    4.42 +                        pictureBox.Image = bitmapField.Bitmap;
    4.43                      }
    4.44                      else
    4.45                      {
    4.46 @@ -1752,15 +1755,19 @@
    4.47                      //For each text add a new entry
    4.48                      foreach (DataField field in aClient.Fields)
    4.49                      {
    4.50 -                        if (!field.IsBitmap)
    4.51 +                        if (field.IsTextField)
    4.52                          {
    4.53 -                            DataField textField = (DataField)field;
    4.54 +                            TextField textField = (TextField)field;
    4.55                              textsRoot.Nodes.Add(new TreeNode("[Text]" + textField.Text));
    4.56                          }
    4.57 -                        else
    4.58 +                        else if (field.IsBitmapField)
    4.59                          {
    4.60                              textsRoot.Nodes.Add(new TreeNode("[Bitmap]"));
    4.61                          }
    4.62 +                        else if (field.IsRecordingField)
    4.63 +                        {
    4.64 +                            textsRoot.Nodes.Add(new TreeNode("[Recording]"));
    4.65 +                        }
    4.66                      }
    4.67                  }
    4.68  
    4.69 @@ -1843,18 +1850,28 @@
    4.70                      if (aClient.Fields.Count <= tableLayoutPanel.Controls.Count)
    4.71                      {
    4.72                          //No client field specified, create a text field by default
    4.73 -                        aClient.Fields.Add(new DataField(aClient.Fields.Count));
    4.74 +                        aClient.Fields.Add(new TextField(aClient.Fields.Count));
    4.75                      }
    4.76  
    4.77 +                    //
    4.78 +                    DataField field = aClient.Fields[tableLayoutPanel.Controls.Count];
    4.79 +                    if (!field.IsTableField)
    4.80 +                    {
    4.81 +                        //That field is not taking part in our table layout then 
    4.82 +                        //We should be ok I guess
    4.83 +                        continue;
    4.84 +                    }
    4.85 +
    4.86 +                    TableField tableField = (TableField)field;
    4.87 +
    4.88                      //Create a control corresponding to the field specified for that cell
    4.89 -                    DataField field = aClient.Fields[tableLayoutPanel.Controls.Count];
    4.90 -                    Control control = CreateControlForDataField(field);
    4.91 +                    Control control = CreateControlForDataField(tableField);
    4.92  
    4.93                      //Add newly created control to our table layout at the specified row and column
    4.94                      tableLayoutPanel.Controls.Add(control, i, j);
    4.95                      //Make sure we specify row and column span for that new control
    4.96 -                    tableLayoutPanel.SetRowSpan(control,field.RowSpan);
    4.97 -                    tableLayoutPanel.SetColumnSpan(control, field.ColumnSpan);
    4.98 +                    tableLayoutPanel.SetRowSpan(control, tableField.RowSpan);
    4.99 +                    tableLayoutPanel.SetColumnSpan(control, tableField.ColumnSpan);
   4.100                  }
   4.101              }
   4.102  
   4.103 @@ -1876,7 +1893,7 @@
   4.104          private Control CreateControlForDataField(DataField aField)
   4.105          {
   4.106              Control control=null;
   4.107 -            if (!aField.IsBitmap)
   4.108 +            if (aField.IsTextField)
   4.109              {
   4.110                  MarqueeLabel label = new SharpDisplayManager.MarqueeLabel();
   4.111                  label.AutoEllipsis = true;
   4.112 @@ -1895,13 +1912,14 @@
   4.113                  //control.TabIndex = 2;
   4.114                  label.Font = cds.Font;
   4.115  
   4.116 -				label.TextAlign = aField.Alignment;
   4.117 +                TextField field = (TextField)aField;
   4.118 +                label.TextAlign = field.Alignment;
   4.119                  label.UseCompatibleTextRendering = true;
   4.120 -                label.Text = aField.Text;
   4.121 +                label.Text = field.Text;
   4.122                  //
   4.123                  control = label;
   4.124              }
   4.125 -            else
   4.126 +            else if (aField.IsBitmapField)
   4.127              {
   4.128                  //Create picture box
   4.129                  PictureBox picture = new PictureBox();
   4.130 @@ -1912,10 +1930,12 @@
   4.131                  picture.Margin = new System.Windows.Forms.Padding(0);
   4.132                  picture.Name = "pictureBox" + aField;
   4.133                  //Set our image
   4.134 -                picture.Image = aField.Bitmap;
   4.135 +                BitmapField field = (BitmapField)aField;
   4.136 +                picture.Image = field.Bitmap;
   4.137                  //
   4.138                  control = picture;
   4.139              }
   4.140 +            //TODO: Handle recording field?
   4.141  
   4.142              return control;
   4.143          }
     5.1 --- a/Server/SharpDisplayManager.csproj	Fri Oct 30 16:45:33 2015 +0100
     5.2 +++ b/Server/SharpDisplayManager.csproj	Sun Nov 22 23:46:52 2015 +0100
     5.3 @@ -102,9 +102,7 @@
     5.4    <PropertyGroup>
     5.5      <StartupObject>SharpDisplayManager.Program</StartupObject>
     5.6    </PropertyGroup>
     5.7 -  <PropertyGroup>
     5.8 -    <ApplicationManifest>Resources\app.manifest</ApplicationManifest>
     5.9 -  </PropertyGroup>
    5.10 +  <PropertyGroup />
    5.11    <PropertyGroup>
    5.12      <TargetZone>LocalIntranet</TargetZone>
    5.13    </PropertyGroup>
    5.14 @@ -123,7 +121,7 @@
    5.15        <HintPath>..\packages\NAudio.1.7.3\lib\net35\NAudio.dll</HintPath>
    5.16      </Reference>
    5.17      <Reference Include="SharpLibDisplay, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
    5.18 -      <HintPath>..\packages\SharpLibDisplay.0.0.2\lib\net40\SharpLibDisplay.dll</HintPath>
    5.19 +      <HintPath>..\packages\SharpLibDisplay.0.1.2\lib\net40\SharpLibDisplay.dll</HintPath>
    5.20        <Private>True</Private>
    5.21      </Reference>
    5.22      <Reference Include="SharpLibHid">
    5.23 @@ -201,9 +199,8 @@
    5.24        <DependentUpon>Resources.resx</DependentUpon>
    5.25        <DesignTime>True</DesignTime>
    5.26      </Compile>
    5.27 -    <None Include="Resources\app.manifest">
    5.28 -      <SubType>Designer</SubType>
    5.29 -    </None>
    5.30 +    <None Include="App.config" />
    5.31 +    <None Include="app.manifest" />
    5.32      <None Include="packages.config" />
    5.33      <None Include="Properties\Settings.settings">
    5.34        <Generator>SettingsSingleFileGenerator</Generator>
    5.35 @@ -218,9 +215,6 @@
    5.36      <None Include="SharpDisplayManager_TemporaryKey.pfx" />
    5.37    </ItemGroup>
    5.38    <ItemGroup>
    5.39 -    <None Include="Resources\App.config" />
    5.40 -  </ItemGroup>
    5.41 -  <ItemGroup>
    5.42      <ProjectReference Include="..\Client\SharpDisplayClient.csproj">
    5.43        <Project>{7ee64074-8cdb-4448-b40c-81b75d6b31cd}</Project>
    5.44        <Name>SharpDisplayClient</Name>
     6.1 --- a/Server/packages.config	Fri Oct 30 16:45:33 2015 +0100
     6.2 +++ b/Server/packages.config	Sun Nov 22 23:46:52 2015 +0100
     6.3 @@ -2,7 +2,7 @@
     6.4  <packages>
     6.5    <package id="LibMiniDisplay" version="1.1.8" targetFramework="net46" />
     6.6    <package id="NAudio" version="1.7.3" targetFramework="net45" />
     6.7 -  <package id="SharpLibDisplay" version="0.0.2" targetFramework="net46" />
     6.8 +  <package id="SharpLibDisplay" version="0.1.2" targetFramework="net46" />
     6.9    <package id="SharpLibHid" version="1.2.1" targetFramework="net45" />
    6.10    <package id="SharpLibWin32" version="0.0.7" targetFramework="net45" />
    6.11  </packages>
    6.12 \ No newline at end of file