Adding support for client priorities.
1.1 --- a/Client/MainForm.Designer.cs Fri Jan 22 16:08:22 2016 +0100
1.2 +++ b/Client/MainForm.Designer.cs Sun Jan 24 19:25:51 2016 +0100
1.3 @@ -41,6 +41,9 @@
1.4 this.buttonIndicatorsLayout = new System.Windows.Forms.Button();
1.5 this.buttonUpdateTexts = new System.Windows.Forms.Button();
1.6 this.buttonLayoutOneTextField = new System.Windows.Forms.Button();
1.7 + this.numericUpDownPriority = new System.Windows.Forms.NumericUpDown();
1.8 + this.labelPriority = new System.Windows.Forms.Label();
1.9 + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPriority)).BeginInit();
1.10 this.SuspendLayout();
1.11 //
1.12 // buttonSetText
1.13 @@ -167,11 +170,45 @@
1.14 this.buttonLayoutOneTextField.UseVisualStyleBackColor = true;
1.15 this.buttonLayoutOneTextField.Click += new System.EventHandler(this.buttonLayoutOneTextField_Click);
1.16 //
1.17 + // numericUpDownPriority
1.18 + //
1.19 + this.numericUpDownPriority.Increment = new decimal(new int[] {
1.20 + 10,
1.21 + 0,
1.22 + 0,
1.23 + 0});
1.24 + this.numericUpDownPriority.Location = new System.Drawing.Point(57, 83);
1.25 + this.numericUpDownPriority.Maximum = new decimal(new int[] {
1.26 + 1000,
1.27 + 0,
1.28 + 0,
1.29 + 0});
1.30 + this.numericUpDownPriority.Name = "numericUpDownPriority";
1.31 + this.numericUpDownPriority.Size = new System.Drawing.Size(60, 20);
1.32 + this.numericUpDownPriority.TabIndex = 31;
1.33 + this.numericUpDownPriority.Value = new decimal(new int[] {
1.34 + 500,
1.35 + 0,
1.36 + 0,
1.37 + 0});
1.38 + this.numericUpDownPriority.ValueChanged += new System.EventHandler(this.numericUpDownPriority_ValueChanged);
1.39 + //
1.40 + // labelPriority
1.41 + //
1.42 + this.labelPriority.AutoSize = true;
1.43 + this.labelPriority.Location = new System.Drawing.Point(12, 85);
1.44 + this.labelPriority.Name = "labelPriority";
1.45 + this.labelPriority.Size = new System.Drawing.Size(41, 13);
1.46 + this.labelPriority.TabIndex = 32;
1.47 + this.labelPriority.Text = "Priority:";
1.48 + //
1.49 // MainForm
1.50 //
1.51 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
1.52 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
1.53 this.ClientSize = new System.Drawing.Size(443, 252);
1.54 + this.Controls.Add(this.labelPriority);
1.55 + this.Controls.Add(this.numericUpDownPriority);
1.56 this.Controls.Add(this.buttonLayoutOneTextField);
1.57 this.Controls.Add(this.buttonUpdateTexts);
1.58 this.Controls.Add(this.buttonIndicatorsLayout);
1.59 @@ -189,6 +226,7 @@
1.60 this.Text = "Client";
1.61 this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
1.62 this.Load += new System.EventHandler(this.MainForm_Load);
1.63 + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPriority)).EndInit();
1.64 this.ResumeLayout(false);
1.65 this.PerformLayout();
1.66
1.67 @@ -209,6 +247,8 @@
1.68 private System.Windows.Forms.Button buttonIndicatorsLayout;
1.69 private System.Windows.Forms.Button buttonUpdateTexts;
1.70 private System.Windows.Forms.Button buttonLayoutOneTextField;
1.71 + private System.Windows.Forms.NumericUpDown numericUpDownPriority;
1.72 + private System.Windows.Forms.Label labelPriority;
1.73 }
1.74 }
1.75
2.1 --- a/Client/MainForm.cs Fri Jan 22 16:08:22 2016 +0100
2.2 +++ b/Client/MainForm.cs Sun Jan 24 19:25:51 2016 +0100
2.3 @@ -395,5 +395,10 @@
2.4 new TextField(textBoxTop.Text, Alignment)
2.5 });
2.6 }
2.7 +
2.8 + private void numericUpDownPriority_ValueChanged(object sender, EventArgs e)
2.9 + {
2.10 + iClient.SetPriority((uint)numericUpDownPriority.Value);
2.11 + }
2.12 }
2.13 }
3.1 --- a/Client/SharpDisplayClient.csproj Fri Jan 22 16:08:22 2016 +0100
3.2 +++ b/Client/SharpDisplayClient.csproj Sun Jan 24 19:25:51 2016 +0100
3.3 @@ -85,7 +85,7 @@
3.4 </PropertyGroup>
3.5 <ItemGroup>
3.6 <Reference Include="SharpLibDisplay, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
3.7 - <HintPath>..\packages\SharpLibDisplay.0.2.4\lib\net40\SharpLibDisplay.dll</HintPath>
3.8 + <HintPath>..\packages\SharpLibDisplay.0.2.5\lib\net40\SharpLibDisplay.dll</HintPath>
3.9 <Private>True</Private>
3.10 </Reference>
3.11 <Reference Include="System" />
4.1 --- a/Client/packages.config Fri Jan 22 16:08:22 2016 +0100
4.2 +++ b/Client/packages.config Sun Jan 24 19:25:51 2016 +0100
4.3 @@ -1,4 +1,4 @@
4.4 <?xml version="1.0" encoding="utf-8"?>
4.5 <packages>
4.6 - <package id="SharpLibDisplay" version="0.2.4" targetFramework="net46" />
4.7 + <package id="SharpLibDisplay" version="0.2.5" targetFramework="net46" />
4.8 </packages>
4.9 \ No newline at end of file
5.1 --- a/Server/ClientData.cs Fri Jan 22 16:08:22 2016 +0100
5.2 +++ b/Server/ClientData.cs Sun Jan 24 19:25:51 2016 +0100
5.3 @@ -18,6 +18,7 @@
5.4 {
5.5 SessionId = aSessionId;
5.6 Name = "";
5.7 + Priority = Priorities.Default;
5.8 Fields = new List<DataField>();
5.9 Layout = new TableLayout(1, 2); //Default to one column and two rows
5.10 Callback = aCallback;
5.11 @@ -26,6 +27,7 @@
5.12
5.13 public string SessionId { get; set; }
5.14 public string Name { get; set; }
5.15 + public uint Priority { get; set; }
5.16 public List<DataField> Fields { get; set; }
5.17 public TableLayout Layout { get; set; }
5.18 public ICallback Callback { get; set; }
6.1 --- a/Server/MainForm.cs Fri Jan 22 16:08:22 2016 +0100
6.2 +++ b/Server/MainForm.cs Sun Jan 24 19:25:51 2016 +0100
6.3 @@ -58,7 +58,8 @@
6.4 public delegate void SetFieldsDelegate(string SessionId, System.Collections.Generic.IList<DataField> aFields);
6.5 public delegate void SetLayoutDelegate(string SessionId, TableLayout aLayout);
6.6 public delegate void SetClientNameDelegate(string aSessionId, string aName);
6.7 - public delegate void PlainUpdateDelegate();
6.8 + public delegate void SetClientPriorityDelegate(string aSessionId, uint aPriority);
6.9 + public delegate void PlainUpdateDelegate();
6.10 public delegate void WndProcDelegate(ref Message aMessage);
6.11
6.12 /// <summary>
6.13 @@ -1758,6 +1759,30 @@
6.14 }
6.15 }
6.16
6.17 + ///
6.18 + public void SetClientPriorityThreadSafe(string aSessionId, uint aPriority)
6.19 + {
6.20 + if (this.InvokeRequired)
6.21 + {
6.22 + //Not in the proper thread, invoke ourselves
6.23 + SetClientPriorityDelegate d = new SetClientPriorityDelegate(SetClientPriorityThreadSafe);
6.24 + this.Invoke(d, new object[] { aSessionId, aPriority });
6.25 + }
6.26 + else
6.27 + {
6.28 + //We are in the proper thread
6.29 + //Get our client
6.30 + ClientData client = iClients[aSessionId];
6.31 + if (client != null)
6.32 + {
6.33 + //Set its name
6.34 + client.Priority = aPriority;
6.35 + //Update our tree-view
6.36 + UpdateClientTreeViewNode(client);
6.37 + }
6.38 + }
6.39 + }
6.40 +
6.41 /// <summary>
6.42 ///
6.43 /// </summary>
6.44 @@ -1851,9 +1876,9 @@
6.45 if (node != null)
6.46 {
6.47 //Change its name
6.48 - if (aClient.Name != "")
6.49 + if (!String.IsNullOrEmpty(aClient.Name))
6.50 {
6.51 - //We have a name, us it as text for our root node
6.52 + //We have a name, use it as text for our root node
6.53 node.Text = aClient.Name;
6.54 //Add a child with SessionId
6.55 node.Nodes.Add(new TreeNode(aClient.SessionId));
6.56 @@ -1864,6 +1889,9 @@
6.57 node.Text = aClient.SessionId;
6.58 }
6.59
6.60 + //Display client priority
6.61 + node.Nodes.Add(new TreeNode("Priority: " + aClient.Priority));
6.62 +
6.63 if (aClient.Fields.Count > 0)
6.64 {
6.65 //Create root node for our texts
7.1 --- a/Server/Session.cs Fri Jan 22 16:08:22 2016 +0100
7.2 +++ b/Server/Session.cs Sun Jan 24 19:25:51 2016 +0100
7.3 @@ -40,6 +40,7 @@
7.4 {
7.5 public string SessionId { get; set; }
7.6 public string Name { get; set; }
7.7 + public uint Priority { get; set; }
7.8
7.9 Session()
7.10 {
7.11 @@ -73,6 +74,16 @@
7.12 //callback.OnConnected();
7.13 }
7.14
7.15 + /// <summary>
7.16 + ///
7.17 + /// </summary>
7.18 + /// <param name="aPriority"></param>
7.19 + public void SetPriority(uint aPriority)
7.20 + {
7.21 + Priority = aPriority;
7.22 + SharpDisplayManager.Program.iMainForm.SetClientPriorityThreadSafe(SessionId, Priority);
7.23 + }
7.24 +
7.25 public void SetLayout(TableLayout aLayout)
7.26 {
7.27 SharpDisplayManager.Program.iMainForm.SetClientLayoutThreadSafe(SessionId, aLayout);
8.1 --- a/Server/SharpDisplayManager.csproj Fri Jan 22 16:08:22 2016 +0100
8.2 +++ b/Server/SharpDisplayManager.csproj Sun Jan 24 19:25:51 2016 +0100
8.3 @@ -121,7 +121,7 @@
8.4 <HintPath>..\packages\NAudio.1.7.3\lib\net35\NAudio.dll</HintPath>
8.5 </Reference>
8.6 <Reference Include="SharpLibDisplay, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
8.7 - <HintPath>..\packages\SharpLibDisplay.0.2.4\lib\net40\SharpLibDisplay.dll</HintPath>
8.8 + <HintPath>..\packages\SharpLibDisplay.0.2.5\lib\net40\SharpLibDisplay.dll</HintPath>
8.9 <Private>True</Private>
8.10 </Reference>
8.11 <Reference Include="SharpLibHid, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
9.1 --- a/Server/packages.config Fri Jan 22 16:08:22 2016 +0100
9.2 +++ b/Server/packages.config Sun Jan 24 19:25:51 2016 +0100
9.3 @@ -2,7 +2,7 @@
9.4 <packages>
9.5 <package id="LibMiniDisplay" version="1.1.8" targetFramework="net46" />
9.6 <package id="NAudio" version="1.7.3" targetFramework="net45" />
9.7 - <package id="SharpLibDisplay" version="0.2.4" targetFramework="net46" />
9.8 + <package id="SharpLibDisplay" version="0.2.5" targetFramework="net46" />
9.9 <package id="SharpLibHid" version="1.3.1" targetFramework="net46" />
9.10 <package id="SharpLibNotification" version="0.0.1" targetFramework="net46" />
9.11 <package id="SharpLibWin32" version="0.0.7" targetFramework="net45" />