# HG changeset patch # User StephaneLenclud # Date 1454502016 -3600 # Node ID 7ada476f3fd7222ae1d32ebf080db7dfd224162e # Parent 60977f2b3ca72585a418f9451a3fef58efef38f9 Renaming our clients. diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Idle/FormIdleClient.Designer.cs --- a/Clients/Idle/FormIdleClient.Designer.cs Wed Feb 03 13:02:48 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -namespace SharpDisplayIdleClient -{ - partial class FormIdleClient - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // FormIdleClient - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(531, 303); - this.Name = "FormIdleClient"; - this.Text = "Sharp Display Idle Client"; - this.ResumeLayout(false); - - } - - #endregion - } -} - diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Idle/FormIdleClient.cs --- a/Clients/Idle/FormIdleClient.cs Wed Feb 03 13:02:48 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace SharpDisplayIdleClient -{ - public partial class FormIdleClient : Form - { - public StartParams Params { get; set; } - - public FormIdleClient() - { - InitializeComponent(); - } - } -} diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Idle/FormIdleClient.resx --- a/Clients/Idle/FormIdleClient.resx Wed Feb 03 13:02:48 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Idle/Program.cs --- a/Clients/Idle/Program.cs Wed Feb 03 13:02:48 2016 +0100 +++ b/Clients/Idle/Program.cs Wed Feb 03 13:20:16 2016 +0100 @@ -39,7 +39,7 @@ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new FormIdleClient()); + Application.Run(new FormClientIdle()); } [STAThread] @@ -50,7 +50,7 @@ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - FormIdleClient form = new FormIdleClient(); + FormClientIdle form = new FormClientIdle(); form.Params = (StartParams)aParams; Application.Run(form); } diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Idle/SharpDisplayClientIdle.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Clients/Idle/SharpDisplayClientIdle.csproj Wed Feb 03 13:20:16 2016 +0100 @@ -0,0 +1,95 @@ + + + + + Debug + AnyCPU + {A76579E5-AA8D-45A3-99E1-239A5C030A78} + WinExe + Properties + SharpDisplayIdleClient + SharpDisplayIdleClient + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\SharpLibDisplay.0.2.5\lib\net40\SharpLibDisplay.dll + True + + + + + + + + + + + + + + + + Form + + + FormClientIdle.cs + + + + + FormClientIdle.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + \ No newline at end of file diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Idle/SharpDisplayIdleClient.csproj --- a/Clients/Idle/SharpDisplayIdleClient.csproj Wed Feb 03 13:02:48 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ - - - - - Debug - AnyCPU - {A76579E5-AA8D-45A3-99E1-239A5C030A78} - WinExe - Properties - SharpDisplayIdleClient - SharpDisplayIdleClient - v4.5.2 - 512 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - Form - - - FormIdleClient.cs - - - - - FormIdleClient.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - \ No newline at end of file diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Idle/packages.config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Clients/Idle/packages.config Wed Feb 03 13:20:16 2016 +0100 @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Test/FormClientTest.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Clients/Test/FormClientTest.Designer.cs Wed Feb 03 13:20:16 2016 +0100 @@ -0,0 +1,254 @@ +namespace SharpDisplayClient +{ + partial class FormClientTest + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonSetText = new System.Windows.Forms.Button(); + this.textBoxTop = new System.Windows.Forms.TextBox(); + this.textBoxBottom = new System.Windows.Forms.TextBox(); + this.buttonAlignRight = new System.Windows.Forms.Button(); + this.buttonAlignCenter = new System.Windows.Forms.Button(); + this.buttonAlignLeft = new System.Windows.Forms.Button(); + this.buttonSetTopText = new System.Windows.Forms.Button(); + this.buttonLayoutUpdate = new System.Windows.Forms.Button(); + this.buttonSetBitmap = new System.Windows.Forms.Button(); + this.buttonBitmapLayout = new System.Windows.Forms.Button(); + this.buttonIndicatorsLayout = new System.Windows.Forms.Button(); + this.buttonUpdateTexts = new System.Windows.Forms.Button(); + this.buttonLayoutOneTextField = new System.Windows.Forms.Button(); + this.numericUpDownPriority = new System.Windows.Forms.NumericUpDown(); + this.labelPriority = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPriority)).BeginInit(); + this.SuspendLayout(); + // + // buttonSetText + // + this.buttonSetText.Location = new System.Drawing.Point(13, 132); + this.buttonSetText.Name = "buttonSetText"; + this.buttonSetText.Size = new System.Drawing.Size(75, 23); + this.buttonSetText.TabIndex = 0; + this.buttonSetText.Text = "Set Text"; + this.buttonSetText.UseVisualStyleBackColor = true; + this.buttonSetText.Click += new System.EventHandler(this.buttonSetText_Click); + // + // textBoxTop + // + this.textBoxTop.Location = new System.Drawing.Point(12, 31); + this.textBoxTop.Name = "textBoxTop"; + this.textBoxTop.Size = new System.Drawing.Size(419, 20); + this.textBoxTop.TabIndex = 1; + // + // textBoxBottom + // + this.textBoxBottom.Location = new System.Drawing.Point(12, 57); + this.textBoxBottom.Name = "textBoxBottom"; + this.textBoxBottom.Size = new System.Drawing.Size(419, 20); + this.textBoxBottom.TabIndex = 2; + // + // buttonAlignRight + // + this.buttonAlignRight.Location = new System.Drawing.Point(176, 160); + this.buttonAlignRight.Name = "buttonAlignRight"; + this.buttonAlignRight.Size = new System.Drawing.Size(75, 23); + this.buttonAlignRight.TabIndex = 23; + this.buttonAlignRight.Text = "Align Right"; + this.buttonAlignRight.UseVisualStyleBackColor = true; + this.buttonAlignRight.Click += new System.EventHandler(this.buttonAlignRight_Click); + // + // buttonAlignCenter + // + this.buttonAlignCenter.Location = new System.Drawing.Point(94, 161); + this.buttonAlignCenter.Name = "buttonAlignCenter"; + this.buttonAlignCenter.Size = new System.Drawing.Size(75, 23); + this.buttonAlignCenter.TabIndex = 22; + this.buttonAlignCenter.Text = "Align Center"; + this.buttonAlignCenter.UseVisualStyleBackColor = true; + this.buttonAlignCenter.Click += new System.EventHandler(this.buttonAlignCenter_Click); + // + // buttonAlignLeft + // + this.buttonAlignLeft.Location = new System.Drawing.Point(12, 161); + this.buttonAlignLeft.Name = "buttonAlignLeft"; + this.buttonAlignLeft.Size = new System.Drawing.Size(75, 23); + this.buttonAlignLeft.TabIndex = 21; + this.buttonAlignLeft.Text = "Align Left"; + this.buttonAlignLeft.UseVisualStyleBackColor = true; + this.buttonAlignLeft.Click += new System.EventHandler(this.buttonAlignLeft_Click); + // + // buttonSetTopText + // + this.buttonSetTopText.Location = new System.Drawing.Point(94, 132); + this.buttonSetTopText.Name = "buttonSetTopText"; + this.buttonSetTopText.Size = new System.Drawing.Size(75, 23); + this.buttonSetTopText.TabIndex = 24; + this.buttonSetTopText.Text = "Set Top Text"; + this.buttonSetTopText.UseVisualStyleBackColor = true; + this.buttonSetTopText.Click += new System.EventHandler(this.buttonSetTopText_Click); + // + // buttonLayoutUpdate + // + this.buttonLayoutUpdate.Location = new System.Drawing.Point(176, 131); + this.buttonLayoutUpdate.Name = "buttonLayoutUpdate"; + this.buttonLayoutUpdate.Size = new System.Drawing.Size(156, 23); + this.buttonLayoutUpdate.TabIndex = 25; + this.buttonLayoutUpdate.Text = "Layout 2x2 and Recording"; + this.buttonLayoutUpdate.UseVisualStyleBackColor = true; + this.buttonLayoutUpdate.Click += new System.EventHandler(this.buttonLayoutUpdate_Click); + // + // buttonSetBitmap + // + this.buttonSetBitmap.Location = new System.Drawing.Point(12, 190); + this.buttonSetBitmap.Name = "buttonSetBitmap"; + this.buttonSetBitmap.Size = new System.Drawing.Size(75, 23); + this.buttonSetBitmap.TabIndex = 26; + this.buttonSetBitmap.Text = "Set Bitmap"; + this.buttonSetBitmap.UseVisualStyleBackColor = true; + this.buttonSetBitmap.Click += new System.EventHandler(this.buttonSetBitmap_Click); + // + // buttonBitmapLayout + // + this.buttonBitmapLayout.Location = new System.Drawing.Point(176, 189); + this.buttonBitmapLayout.Name = "buttonBitmapLayout"; + this.buttonBitmapLayout.Size = new System.Drawing.Size(75, 35); + this.buttonBitmapLayout.TabIndex = 27; + this.buttonBitmapLayout.Text = "Bitmap Layout"; + this.buttonBitmapLayout.UseVisualStyleBackColor = true; + this.buttonBitmapLayout.Click += new System.EventHandler(this.buttonBitmapLayout_Click); + // + // buttonIndicatorsLayout + // + this.buttonIndicatorsLayout.Location = new System.Drawing.Point(94, 189); + this.buttonIndicatorsLayout.Name = "buttonIndicatorsLayout"; + this.buttonIndicatorsLayout.Size = new System.Drawing.Size(75, 35); + this.buttonIndicatorsLayout.TabIndex = 28; + this.buttonIndicatorsLayout.Text = "Indicators Layout "; + this.buttonIndicatorsLayout.UseVisualStyleBackColor = true; + this.buttonIndicatorsLayout.Click += new System.EventHandler(this.buttonIndicatorsLayout_Click); + // + // buttonUpdateTexts + // + this.buttonUpdateTexts.Location = new System.Drawing.Point(257, 189); + this.buttonUpdateTexts.Name = "buttonUpdateTexts"; + this.buttonUpdateTexts.Size = new System.Drawing.Size(75, 35); + this.buttonUpdateTexts.TabIndex = 29; + this.buttonUpdateTexts.Text = "Update Texts"; + this.buttonUpdateTexts.UseVisualStyleBackColor = true; + this.buttonUpdateTexts.Click += new System.EventHandler(this.buttonUpdateTexts_Click); + // + // buttonLayoutOneTextField + // + this.buttonLayoutOneTextField.Location = new System.Drawing.Point(257, 160); + this.buttonLayoutOneTextField.Name = "buttonLayoutOneTextField"; + this.buttonLayoutOneTextField.Size = new System.Drawing.Size(75, 23); + this.buttonLayoutOneTextField.TabIndex = 30; + this.buttonLayoutOneTextField.Text = "Layout 1x1"; + this.buttonLayoutOneTextField.UseVisualStyleBackColor = true; + this.buttonLayoutOneTextField.Click += new System.EventHandler(this.buttonLayoutOneTextField_Click); + // + // numericUpDownPriority + // + this.numericUpDownPriority.Increment = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.numericUpDownPriority.Location = new System.Drawing.Point(57, 83); + this.numericUpDownPriority.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numericUpDownPriority.Name = "numericUpDownPriority"; + this.numericUpDownPriority.Size = new System.Drawing.Size(60, 20); + this.numericUpDownPriority.TabIndex = 31; + this.numericUpDownPriority.Value = new decimal(new int[] { + 500, + 0, + 0, + 0}); + this.numericUpDownPriority.ValueChanged += new System.EventHandler(this.numericUpDownPriority_ValueChanged); + // + // labelPriority + // + this.labelPriority.AutoSize = true; + this.labelPriority.Location = new System.Drawing.Point(12, 85); + this.labelPriority.Name = "labelPriority"; + this.labelPriority.Size = new System.Drawing.Size(41, 13); + this.labelPriority.TabIndex = 32; + this.labelPriority.Text = "Priority:"; + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(443, 252); + this.Controls.Add(this.labelPriority); + this.Controls.Add(this.numericUpDownPriority); + this.Controls.Add(this.buttonLayoutOneTextField); + this.Controls.Add(this.buttonUpdateTexts); + this.Controls.Add(this.buttonIndicatorsLayout); + this.Controls.Add(this.buttonBitmapLayout); + this.Controls.Add(this.buttonSetBitmap); + this.Controls.Add(this.buttonLayoutUpdate); + this.Controls.Add(this.buttonSetTopText); + this.Controls.Add(this.buttonAlignRight); + this.Controls.Add(this.buttonAlignCenter); + this.Controls.Add(this.buttonAlignLeft); + this.Controls.Add(this.textBoxBottom); + this.Controls.Add(this.textBoxTop); + this.Controls.Add(this.buttonSetText); + this.Name = "MainForm"; + this.Text = "Client"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); + this.Load += new System.EventHandler(this.MainForm_Load); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPriority)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button buttonSetText; + private System.Windows.Forms.TextBox textBoxTop; + private System.Windows.Forms.TextBox textBoxBottom; + private System.Windows.Forms.Button buttonAlignRight; + private System.Windows.Forms.Button buttonAlignCenter; + private System.Windows.Forms.Button buttonAlignLeft; + private System.Windows.Forms.Button buttonSetTopText; + private System.Windows.Forms.Button buttonLayoutUpdate; + private System.Windows.Forms.Button buttonSetBitmap; + private System.Windows.Forms.Button buttonBitmapLayout; + private System.Windows.Forms.Button buttonIndicatorsLayout; + private System.Windows.Forms.Button buttonUpdateTexts; + private System.Windows.Forms.Button buttonLayoutOneTextField; + private System.Windows.Forms.NumericUpDown numericUpDownPriority; + private System.Windows.Forms.Label labelPriority; + } +} + diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Test/FormClientTest.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Clients/Test/FormClientTest.cs Wed Feb 03 13:20:16 2016 +0100 @@ -0,0 +1,404 @@ +// +// Copyright (C) 2014-2015 Stéphane Lenclud. +// +// This file is part of SharpDisplayManager. +// +// SharpDisplayManager is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// SharpDisplayManager is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with SharpDisplayManager. If not, see . +// + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.ServiceModel; +using System.ServiceModel.Channels; +using System.Diagnostics; +using SharpLib.Display; + + +namespace SharpDisplayClient +{ + public partial class FormClientTest : Form + { + public StartParams Params { get; set; } + + // + Client iClient; + // + ContentAlignment Alignment; + TextField iTextFieldTop; + + + /// + /// Constructor + /// + public FormClientTest() + { + InitializeComponent(); + Alignment = ContentAlignment.MiddleLeft; + iTextFieldTop = new TextField(); + } + + public void OnCloseOrder() + { + CloseThreadSafe(); + } + + /// + /// + /// + /// + /// + private void MainForm_Load(object sender, EventArgs e) + { + iClient = new Client(); + iClient.CloseOrderEvent += OnCloseOrder; + iClient.Open(); + + //Connect using unique name + //string name = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt"); + string name = "Client-" + (iClient.ClientCount() - 1); + iClient.SetName(name); + //Text = Text + ": " + name; + Text = "[[" + name + "]] " + iClient.SessionId; + + // + textBoxTop.Text = iClient.Name; + textBoxBottom.Text = iClient.SessionId; + + if (Params != null) + { + //Parameters where specified use them + if (Params.TopText != "") + { + textBoxTop.Text = Params.TopText; + } + + if (Params.BottomText != "") + { + textBoxBottom.Text = Params.BottomText; + } + + Location = Params.Location; + // + SetBasicLayoutAndText(); + } + + } + + + + public delegate void CloseConnectionDelegate(); + public delegate void CloseDelegate(); + + /// + /// + /// + public void CloseConnectionThreadSafe() + { + if (this.InvokeRequired) + { + //Not in the proper thread, invoke ourselves + CloseConnectionDelegate d = new CloseConnectionDelegate(CloseConnectionThreadSafe); + this.Invoke(d, new object[] { }); + } + else + { + //We are in the proper thread + if (IsClientReady()) + { + string sessionId = iClient.SessionId; + Trace.TraceInformation("Closing client: " + sessionId); + iClient.Close(); + Trace.TraceInformation("Closed client: " + sessionId); + } + + iClient = null; + } + } + + /// + /// + /// + public void CloseThreadSafe() + { + if (this.InvokeRequired) + { + //Not in the proper thread, invoke ourselves + CloseDelegate d = new CloseDelegate(CloseThreadSafe); + this.Invoke(d, new object[] { }); + } + else + { + //We are in the proper thread + Close(); + } + } + + + private void MainForm_FormClosing(object sender, FormClosingEventArgs e) + { + CloseConnectionThreadSafe(); + } + + public bool IsClientReady() + { + return (iClient != null && iClient.IsReady()); + } + + private void buttonAlignLeft_Click(object sender, EventArgs e) + { + Alignment = ContentAlignment.MiddleLeft; + textBoxTop.TextAlign = HorizontalAlignment.Left; + textBoxBottom.TextAlign = HorizontalAlignment.Left; + } + + private void buttonAlignCenter_Click(object sender, EventArgs e) + { + Alignment = ContentAlignment.MiddleCenter; + textBoxTop.TextAlign = HorizontalAlignment.Center; + textBoxBottom.TextAlign = HorizontalAlignment.Center; + } + + private void buttonAlignRight_Click(object sender, EventArgs e) + { + Alignment = ContentAlignment.MiddleRight; + textBoxTop.TextAlign = HorizontalAlignment.Right; + textBoxBottom.TextAlign = HorizontalAlignment.Right; + } + + private void buttonSetTopText_Click(object sender, EventArgs e) + { + //TextField top = new TextField(0, textBoxTop.Text, ContentAlignment.MiddleLeft); + iTextFieldTop.Text = textBoxTop.Text; + iTextFieldTop.Alignment = Alignment; + bool res = iClient.SetField(iTextFieldTop); + + if (!res) + { + MessageBox.Show("Create you fields first", "Field update error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + + } + + private void buttonSetText_Click(object sender, EventArgs e) + { + SetBasicLayoutAndText(); + } + + void SetBasicLayoutAndText() + { + //Set one column two lines layout + TableLayout layout = new TableLayout(1, 2); + iClient.SetLayout(layout); + + //Set our fields + iClient.CreateFields(new DataField[] + { + new TextField(textBoxTop.Text, Alignment, 0, 0), + new TextField(textBoxBottom.Text, Alignment, 0, 1) + }); + + } + + private void buttonLayoutUpdate_Click(object sender, EventArgs e) + { + //Define a 2 by 2 layout + TableLayout layout = new TableLayout(2,2); + //Second column only takes up 25% + layout.Columns[1].Width = 25F; + //Send layout to server + iClient.SetLayout(layout); + + // + RecordingField recording = new RecordingField(); + recording.IsActive = true; + recording.Text = "Recording Tame of Gone until 22:05"; + //Set texts + iClient.CreateFields(new DataField[] + { + new TextField(textBoxTop.Text, Alignment, 0, 0), + new TextField(textBoxBottom.Text, Alignment, 0, 1), + new TextField("Third text field", Alignment, 1, 0), + new TextField("Forth text field", Alignment, 1, 1), + recording + }); + + } + + private void buttonSetBitmap_Click(object sender, EventArgs e) + { + int x1 = 0; + int y1 = 0; + int x2 = 256; + int y2 = 32; + + Bitmap bitmap = new Bitmap(x2,y2); + Pen blackPen = new Pen(Color.Black, 3); + + // Draw line to screen. + using (var graphics = Graphics.FromImage(bitmap)) + { + graphics.DrawLine(blackPen, x1, y1, x2, y2); + graphics.DrawLine(blackPen, x1, y2, x2, y1); + } + + DataField field = new BitmapField(bitmap); + //field.ColumnSpan = 2; + iClient.SetField(field); + } + + private void buttonBitmapLayout_Click(object sender, EventArgs e) + { + SetLayoutWithBitmap(); + } + + /// + /// Define a layout with a bitmap field on the left and two lines of text on the right. + /// + private void SetLayoutWithBitmap() + { + //Define a 2 by 2 layout + TableLayout layout = new TableLayout(2, 2); + //First column only takes 25% + layout.Columns[0].Width = 25F; + //Second column takes up 75% + layout.Columns[1].Width = 75F; + //Send layout to server + iClient.SetLayout(layout); + + //Set a bitmap for our first field + int x1 = 0; + int y1 = 0; + int x2 = 64; + int y2 = 64; + + Bitmap bitmap = new Bitmap(x2, y2); + Pen blackPen = new Pen(Color.Black, 3); + + // Draw line to screen. + using (var graphics = Graphics.FromImage(bitmap)) + { + graphics.DrawLine(blackPen, x1, y1, x2, y2); + graphics.DrawLine(blackPen, x1, y2, x2, y1); + } + + //Create a bitmap field from the bitmap we just created + //We want our bitmap field to span across two rows + BitmapField bitmapField = new BitmapField(bitmap, 0, 0, 1, 2); + + //Set texts + iClient.CreateFields(new DataField[] + { + bitmapField, + new TextField(textBoxTop.Text, Alignment, 1, 0), + new TextField(textBoxBottom.Text, Alignment, 1, 1) + }); + + } + + private void buttonIndicatorsLayout_Click(object sender, EventArgs e) + { + //Define a 2 by 4 layout + TableLayout layout = new TableLayout(2, 4); + //First column + layout.Columns[0].Width = 87.5F; + //Second column + layout.Columns[1].Width = 12.5F; + //Send layout to server + iClient.SetLayout(layout); + + //Create a bitmap for our indicators field + int x1 = 0; + int y1 = 0; + int x2 = 32; + int y2 = 16; + + Bitmap bitmap = new Bitmap(x2, y2); + Pen blackPen = new Pen(Color.Black, 3); + + // Draw line to screen. + using (var graphics = Graphics.FromImage(bitmap)) + { + graphics.DrawLine(blackPen, x1, y1, x2, y2); + graphics.DrawLine(blackPen, x1, y2, x2, y1); + } + + //Create a bitmap field from the bitmap we just created + DataField indicator1 = new BitmapField(bitmap, 1, 0); + //Create a bitmap field from the bitmap we just created + DataField indicator2 = new BitmapField(bitmap, 1, 1); + //Create a bitmap field from the bitmap we just created + DataField indicator3 = new BitmapField(bitmap, 1, 2); + //Create a bitmap field from the bitmap we just created + DataField indicator4 = new BitmapField(bitmap, 1, 3); + + // + TextField textFieldTop = new TextField(textBoxTop.Text, Alignment, 0, 0, 1, 2); + TextField textFieldBottom = new TextField(textBoxBottom.Text, Alignment, 0, 2, 1, 2); + + //Set texts + iClient.CreateFields(new DataField[] + { + textFieldTop, + textFieldBottom, + indicator1, + indicator2, + indicator3, + indicator4 + }); + + } + + private void buttonUpdateTexts_Click(object sender, EventArgs e) + { + + bool res = iClient.SetFields(new DataField[] + { + new TextField(textBoxTop.Text, Alignment,0,0), + new TextField(textBoxBottom.Text, Alignment,0,1) + }); + + if (!res) + { + MessageBox.Show("Create you fields first", "Field update error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void buttonLayoutOneTextField_Click(object sender, EventArgs e) + { + //Set one column one line layout + TableLayout layout = new TableLayout(1, 1); + iClient.SetLayout(layout); + + //Set our fields + iClient.CreateFields(new DataField[] + { + new TextField(textBoxTop.Text, Alignment) + }); + } + + private void numericUpDownPriority_ValueChanged(object sender, EventArgs e) + { + iClient.SetPriority((uint)numericUpDownPriority.Value); + } + } +} diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Test/FormClientTest.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Clients/Test/FormClientTest.resx Wed Feb 03 13:20:16 2016 +0100 @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Test/MainForm.Designer.cs --- a/Clients/Test/MainForm.Designer.cs Wed Feb 03 13:02:48 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,254 +0,0 @@ -namespace SharpDisplayClient -{ - partial class MainForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.buttonSetText = new System.Windows.Forms.Button(); - this.textBoxTop = new System.Windows.Forms.TextBox(); - this.textBoxBottom = new System.Windows.Forms.TextBox(); - this.buttonAlignRight = new System.Windows.Forms.Button(); - this.buttonAlignCenter = new System.Windows.Forms.Button(); - this.buttonAlignLeft = new System.Windows.Forms.Button(); - this.buttonSetTopText = new System.Windows.Forms.Button(); - this.buttonLayoutUpdate = new System.Windows.Forms.Button(); - this.buttonSetBitmap = new System.Windows.Forms.Button(); - this.buttonBitmapLayout = new System.Windows.Forms.Button(); - this.buttonIndicatorsLayout = new System.Windows.Forms.Button(); - this.buttonUpdateTexts = new System.Windows.Forms.Button(); - this.buttonLayoutOneTextField = new System.Windows.Forms.Button(); - this.numericUpDownPriority = new System.Windows.Forms.NumericUpDown(); - this.labelPriority = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPriority)).BeginInit(); - this.SuspendLayout(); - // - // buttonSetText - // - this.buttonSetText.Location = new System.Drawing.Point(13, 132); - this.buttonSetText.Name = "buttonSetText"; - this.buttonSetText.Size = new System.Drawing.Size(75, 23); - this.buttonSetText.TabIndex = 0; - this.buttonSetText.Text = "Set Text"; - this.buttonSetText.UseVisualStyleBackColor = true; - this.buttonSetText.Click += new System.EventHandler(this.buttonSetText_Click); - // - // textBoxTop - // - this.textBoxTop.Location = new System.Drawing.Point(12, 31); - this.textBoxTop.Name = "textBoxTop"; - this.textBoxTop.Size = new System.Drawing.Size(419, 20); - this.textBoxTop.TabIndex = 1; - // - // textBoxBottom - // - this.textBoxBottom.Location = new System.Drawing.Point(12, 57); - this.textBoxBottom.Name = "textBoxBottom"; - this.textBoxBottom.Size = new System.Drawing.Size(419, 20); - this.textBoxBottom.TabIndex = 2; - // - // buttonAlignRight - // - this.buttonAlignRight.Location = new System.Drawing.Point(176, 160); - this.buttonAlignRight.Name = "buttonAlignRight"; - this.buttonAlignRight.Size = new System.Drawing.Size(75, 23); - this.buttonAlignRight.TabIndex = 23; - this.buttonAlignRight.Text = "Align Right"; - this.buttonAlignRight.UseVisualStyleBackColor = true; - this.buttonAlignRight.Click += new System.EventHandler(this.buttonAlignRight_Click); - // - // buttonAlignCenter - // - this.buttonAlignCenter.Location = new System.Drawing.Point(94, 161); - this.buttonAlignCenter.Name = "buttonAlignCenter"; - this.buttonAlignCenter.Size = new System.Drawing.Size(75, 23); - this.buttonAlignCenter.TabIndex = 22; - this.buttonAlignCenter.Text = "Align Center"; - this.buttonAlignCenter.UseVisualStyleBackColor = true; - this.buttonAlignCenter.Click += new System.EventHandler(this.buttonAlignCenter_Click); - // - // buttonAlignLeft - // - this.buttonAlignLeft.Location = new System.Drawing.Point(12, 161); - this.buttonAlignLeft.Name = "buttonAlignLeft"; - this.buttonAlignLeft.Size = new System.Drawing.Size(75, 23); - this.buttonAlignLeft.TabIndex = 21; - this.buttonAlignLeft.Text = "Align Left"; - this.buttonAlignLeft.UseVisualStyleBackColor = true; - this.buttonAlignLeft.Click += new System.EventHandler(this.buttonAlignLeft_Click); - // - // buttonSetTopText - // - this.buttonSetTopText.Location = new System.Drawing.Point(94, 132); - this.buttonSetTopText.Name = "buttonSetTopText"; - this.buttonSetTopText.Size = new System.Drawing.Size(75, 23); - this.buttonSetTopText.TabIndex = 24; - this.buttonSetTopText.Text = "Set Top Text"; - this.buttonSetTopText.UseVisualStyleBackColor = true; - this.buttonSetTopText.Click += new System.EventHandler(this.buttonSetTopText_Click); - // - // buttonLayoutUpdate - // - this.buttonLayoutUpdate.Location = new System.Drawing.Point(176, 131); - this.buttonLayoutUpdate.Name = "buttonLayoutUpdate"; - this.buttonLayoutUpdate.Size = new System.Drawing.Size(156, 23); - this.buttonLayoutUpdate.TabIndex = 25; - this.buttonLayoutUpdate.Text = "Layout 2x2 and Recording"; - this.buttonLayoutUpdate.UseVisualStyleBackColor = true; - this.buttonLayoutUpdate.Click += new System.EventHandler(this.buttonLayoutUpdate_Click); - // - // buttonSetBitmap - // - this.buttonSetBitmap.Location = new System.Drawing.Point(12, 190); - this.buttonSetBitmap.Name = "buttonSetBitmap"; - this.buttonSetBitmap.Size = new System.Drawing.Size(75, 23); - this.buttonSetBitmap.TabIndex = 26; - this.buttonSetBitmap.Text = "Set Bitmap"; - this.buttonSetBitmap.UseVisualStyleBackColor = true; - this.buttonSetBitmap.Click += new System.EventHandler(this.buttonSetBitmap_Click); - // - // buttonBitmapLayout - // - this.buttonBitmapLayout.Location = new System.Drawing.Point(176, 189); - this.buttonBitmapLayout.Name = "buttonBitmapLayout"; - this.buttonBitmapLayout.Size = new System.Drawing.Size(75, 35); - this.buttonBitmapLayout.TabIndex = 27; - this.buttonBitmapLayout.Text = "Bitmap Layout"; - this.buttonBitmapLayout.UseVisualStyleBackColor = true; - this.buttonBitmapLayout.Click += new System.EventHandler(this.buttonBitmapLayout_Click); - // - // buttonIndicatorsLayout - // - this.buttonIndicatorsLayout.Location = new System.Drawing.Point(94, 189); - this.buttonIndicatorsLayout.Name = "buttonIndicatorsLayout"; - this.buttonIndicatorsLayout.Size = new System.Drawing.Size(75, 35); - this.buttonIndicatorsLayout.TabIndex = 28; - this.buttonIndicatorsLayout.Text = "Indicators Layout "; - this.buttonIndicatorsLayout.UseVisualStyleBackColor = true; - this.buttonIndicatorsLayout.Click += new System.EventHandler(this.buttonIndicatorsLayout_Click); - // - // buttonUpdateTexts - // - this.buttonUpdateTexts.Location = new System.Drawing.Point(257, 189); - this.buttonUpdateTexts.Name = "buttonUpdateTexts"; - this.buttonUpdateTexts.Size = new System.Drawing.Size(75, 35); - this.buttonUpdateTexts.TabIndex = 29; - this.buttonUpdateTexts.Text = "Update Texts"; - this.buttonUpdateTexts.UseVisualStyleBackColor = true; - this.buttonUpdateTexts.Click += new System.EventHandler(this.buttonUpdateTexts_Click); - // - // buttonLayoutOneTextField - // - this.buttonLayoutOneTextField.Location = new System.Drawing.Point(257, 160); - this.buttonLayoutOneTextField.Name = "buttonLayoutOneTextField"; - this.buttonLayoutOneTextField.Size = new System.Drawing.Size(75, 23); - this.buttonLayoutOneTextField.TabIndex = 30; - this.buttonLayoutOneTextField.Text = "Layout 1x1"; - this.buttonLayoutOneTextField.UseVisualStyleBackColor = true; - this.buttonLayoutOneTextField.Click += new System.EventHandler(this.buttonLayoutOneTextField_Click); - // - // numericUpDownPriority - // - this.numericUpDownPriority.Increment = new decimal(new int[] { - 10, - 0, - 0, - 0}); - this.numericUpDownPriority.Location = new System.Drawing.Point(57, 83); - this.numericUpDownPriority.Maximum = new decimal(new int[] { - 1000, - 0, - 0, - 0}); - this.numericUpDownPriority.Name = "numericUpDownPriority"; - this.numericUpDownPriority.Size = new System.Drawing.Size(60, 20); - this.numericUpDownPriority.TabIndex = 31; - this.numericUpDownPriority.Value = new decimal(new int[] { - 500, - 0, - 0, - 0}); - this.numericUpDownPriority.ValueChanged += new System.EventHandler(this.numericUpDownPriority_ValueChanged); - // - // labelPriority - // - this.labelPriority.AutoSize = true; - this.labelPriority.Location = new System.Drawing.Point(12, 85); - this.labelPriority.Name = "labelPriority"; - this.labelPriority.Size = new System.Drawing.Size(41, 13); - this.labelPriority.TabIndex = 32; - this.labelPriority.Text = "Priority:"; - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(443, 252); - this.Controls.Add(this.labelPriority); - this.Controls.Add(this.numericUpDownPriority); - this.Controls.Add(this.buttonLayoutOneTextField); - this.Controls.Add(this.buttonUpdateTexts); - this.Controls.Add(this.buttonIndicatorsLayout); - this.Controls.Add(this.buttonBitmapLayout); - this.Controls.Add(this.buttonSetBitmap); - this.Controls.Add(this.buttonLayoutUpdate); - this.Controls.Add(this.buttonSetTopText); - this.Controls.Add(this.buttonAlignRight); - this.Controls.Add(this.buttonAlignCenter); - this.Controls.Add(this.buttonAlignLeft); - this.Controls.Add(this.textBoxBottom); - this.Controls.Add(this.textBoxTop); - this.Controls.Add(this.buttonSetText); - this.Name = "MainForm"; - this.Text = "Client"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); - this.Load += new System.EventHandler(this.MainForm_Load); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPriority)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button buttonSetText; - private System.Windows.Forms.TextBox textBoxTop; - private System.Windows.Forms.TextBox textBoxBottom; - private System.Windows.Forms.Button buttonAlignRight; - private System.Windows.Forms.Button buttonAlignCenter; - private System.Windows.Forms.Button buttonAlignLeft; - private System.Windows.Forms.Button buttonSetTopText; - private System.Windows.Forms.Button buttonLayoutUpdate; - private System.Windows.Forms.Button buttonSetBitmap; - private System.Windows.Forms.Button buttonBitmapLayout; - private System.Windows.Forms.Button buttonIndicatorsLayout; - private System.Windows.Forms.Button buttonUpdateTexts; - private System.Windows.Forms.Button buttonLayoutOneTextField; - private System.Windows.Forms.NumericUpDown numericUpDownPriority; - private System.Windows.Forms.Label labelPriority; - } -} - diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Test/MainForm.cs --- a/Clients/Test/MainForm.cs Wed Feb 03 13:02:48 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,404 +0,0 @@ -// -// Copyright (C) 2014-2015 Stéphane Lenclud. -// -// This file is part of SharpDisplayManager. -// -// SharpDisplayManager is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// SharpDisplayManager is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with SharpDisplayManager. If not, see . -// - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.ServiceModel; -using System.ServiceModel.Channels; -using System.Diagnostics; -using SharpLib.Display; - - -namespace SharpDisplayClient -{ - public partial class MainForm : Form - { - public StartParams Params { get; set; } - - // - Client iClient; - // - ContentAlignment Alignment; - TextField iTextFieldTop; - - - /// - /// Constructor - /// - public MainForm() - { - InitializeComponent(); - Alignment = ContentAlignment.MiddleLeft; - iTextFieldTop = new TextField(); - } - - public void OnCloseOrder() - { - CloseThreadSafe(); - } - - /// - /// - /// - /// - /// - private void MainForm_Load(object sender, EventArgs e) - { - iClient = new Client(); - iClient.CloseOrderEvent += OnCloseOrder; - iClient.Open(); - - //Connect using unique name - //string name = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt"); - string name = "Client-" + (iClient.ClientCount() - 1); - iClient.SetName(name); - //Text = Text + ": " + name; - Text = "[[" + name + "]] " + iClient.SessionId; - - // - textBoxTop.Text = iClient.Name; - textBoxBottom.Text = iClient.SessionId; - - if (Params != null) - { - //Parameters where specified use them - if (Params.TopText != "") - { - textBoxTop.Text = Params.TopText; - } - - if (Params.BottomText != "") - { - textBoxBottom.Text = Params.BottomText; - } - - Location = Params.Location; - // - SetBasicLayoutAndText(); - } - - } - - - - public delegate void CloseConnectionDelegate(); - public delegate void CloseDelegate(); - - /// - /// - /// - public void CloseConnectionThreadSafe() - { - if (this.InvokeRequired) - { - //Not in the proper thread, invoke ourselves - CloseConnectionDelegate d = new CloseConnectionDelegate(CloseConnectionThreadSafe); - this.Invoke(d, new object[] { }); - } - else - { - //We are in the proper thread - if (IsClientReady()) - { - string sessionId = iClient.SessionId; - Trace.TraceInformation("Closing client: " + sessionId); - iClient.Close(); - Trace.TraceInformation("Closed client: " + sessionId); - } - - iClient = null; - } - } - - /// - /// - /// - public void CloseThreadSafe() - { - if (this.InvokeRequired) - { - //Not in the proper thread, invoke ourselves - CloseDelegate d = new CloseDelegate(CloseThreadSafe); - this.Invoke(d, new object[] { }); - } - else - { - //We are in the proper thread - Close(); - } - } - - - private void MainForm_FormClosing(object sender, FormClosingEventArgs e) - { - CloseConnectionThreadSafe(); - } - - public bool IsClientReady() - { - return (iClient != null && iClient.IsReady()); - } - - private void buttonAlignLeft_Click(object sender, EventArgs e) - { - Alignment = ContentAlignment.MiddleLeft; - textBoxTop.TextAlign = HorizontalAlignment.Left; - textBoxBottom.TextAlign = HorizontalAlignment.Left; - } - - private void buttonAlignCenter_Click(object sender, EventArgs e) - { - Alignment = ContentAlignment.MiddleCenter; - textBoxTop.TextAlign = HorizontalAlignment.Center; - textBoxBottom.TextAlign = HorizontalAlignment.Center; - } - - private void buttonAlignRight_Click(object sender, EventArgs e) - { - Alignment = ContentAlignment.MiddleRight; - textBoxTop.TextAlign = HorizontalAlignment.Right; - textBoxBottom.TextAlign = HorizontalAlignment.Right; - } - - private void buttonSetTopText_Click(object sender, EventArgs e) - { - //TextField top = new TextField(0, textBoxTop.Text, ContentAlignment.MiddleLeft); - iTextFieldTop.Text = textBoxTop.Text; - iTextFieldTop.Alignment = Alignment; - bool res = iClient.SetField(iTextFieldTop); - - if (!res) - { - MessageBox.Show("Create you fields first", "Field update error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - - } - - private void buttonSetText_Click(object sender, EventArgs e) - { - SetBasicLayoutAndText(); - } - - void SetBasicLayoutAndText() - { - //Set one column two lines layout - TableLayout layout = new TableLayout(1, 2); - iClient.SetLayout(layout); - - //Set our fields - iClient.CreateFields(new DataField[] - { - new TextField(textBoxTop.Text, Alignment, 0, 0), - new TextField(textBoxBottom.Text, Alignment, 0, 1) - }); - - } - - private void buttonLayoutUpdate_Click(object sender, EventArgs e) - { - //Define a 2 by 2 layout - TableLayout layout = new TableLayout(2,2); - //Second column only takes up 25% - layout.Columns[1].Width = 25F; - //Send layout to server - iClient.SetLayout(layout); - - // - RecordingField recording = new RecordingField(); - recording.IsActive = true; - recording.Text = "Recording Tame of Gone until 22:05"; - //Set texts - iClient.CreateFields(new DataField[] - { - new TextField(textBoxTop.Text, Alignment, 0, 0), - new TextField(textBoxBottom.Text, Alignment, 0, 1), - new TextField("Third text field", Alignment, 1, 0), - new TextField("Forth text field", Alignment, 1, 1), - recording - }); - - } - - private void buttonSetBitmap_Click(object sender, EventArgs e) - { - int x1 = 0; - int y1 = 0; - int x2 = 256; - int y2 = 32; - - Bitmap bitmap = new Bitmap(x2,y2); - Pen blackPen = new Pen(Color.Black, 3); - - // Draw line to screen. - using (var graphics = Graphics.FromImage(bitmap)) - { - graphics.DrawLine(blackPen, x1, y1, x2, y2); - graphics.DrawLine(blackPen, x1, y2, x2, y1); - } - - DataField field = new BitmapField(bitmap); - //field.ColumnSpan = 2; - iClient.SetField(field); - } - - private void buttonBitmapLayout_Click(object sender, EventArgs e) - { - SetLayoutWithBitmap(); - } - - /// - /// Define a layout with a bitmap field on the left and two lines of text on the right. - /// - private void SetLayoutWithBitmap() - { - //Define a 2 by 2 layout - TableLayout layout = new TableLayout(2, 2); - //First column only takes 25% - layout.Columns[0].Width = 25F; - //Second column takes up 75% - layout.Columns[1].Width = 75F; - //Send layout to server - iClient.SetLayout(layout); - - //Set a bitmap for our first field - int x1 = 0; - int y1 = 0; - int x2 = 64; - int y2 = 64; - - Bitmap bitmap = new Bitmap(x2, y2); - Pen blackPen = new Pen(Color.Black, 3); - - // Draw line to screen. - using (var graphics = Graphics.FromImage(bitmap)) - { - graphics.DrawLine(blackPen, x1, y1, x2, y2); - graphics.DrawLine(blackPen, x1, y2, x2, y1); - } - - //Create a bitmap field from the bitmap we just created - //We want our bitmap field to span across two rows - BitmapField bitmapField = new BitmapField(bitmap, 0, 0, 1, 2); - - //Set texts - iClient.CreateFields(new DataField[] - { - bitmapField, - new TextField(textBoxTop.Text, Alignment, 1, 0), - new TextField(textBoxBottom.Text, Alignment, 1, 1) - }); - - } - - private void buttonIndicatorsLayout_Click(object sender, EventArgs e) - { - //Define a 2 by 4 layout - TableLayout layout = new TableLayout(2, 4); - //First column - layout.Columns[0].Width = 87.5F; - //Second column - layout.Columns[1].Width = 12.5F; - //Send layout to server - iClient.SetLayout(layout); - - //Create a bitmap for our indicators field - int x1 = 0; - int y1 = 0; - int x2 = 32; - int y2 = 16; - - Bitmap bitmap = new Bitmap(x2, y2); - Pen blackPen = new Pen(Color.Black, 3); - - // Draw line to screen. - using (var graphics = Graphics.FromImage(bitmap)) - { - graphics.DrawLine(blackPen, x1, y1, x2, y2); - graphics.DrawLine(blackPen, x1, y2, x2, y1); - } - - //Create a bitmap field from the bitmap we just created - DataField indicator1 = new BitmapField(bitmap, 1, 0); - //Create a bitmap field from the bitmap we just created - DataField indicator2 = new BitmapField(bitmap, 1, 1); - //Create a bitmap field from the bitmap we just created - DataField indicator3 = new BitmapField(bitmap, 1, 2); - //Create a bitmap field from the bitmap we just created - DataField indicator4 = new BitmapField(bitmap, 1, 3); - - // - TextField textFieldTop = new TextField(textBoxTop.Text, Alignment, 0, 0, 1, 2); - TextField textFieldBottom = new TextField(textBoxBottom.Text, Alignment, 0, 2, 1, 2); - - //Set texts - iClient.CreateFields(new DataField[] - { - textFieldTop, - textFieldBottom, - indicator1, - indicator2, - indicator3, - indicator4 - }); - - } - - private void buttonUpdateTexts_Click(object sender, EventArgs e) - { - - bool res = iClient.SetFields(new DataField[] - { - new TextField(textBoxTop.Text, Alignment,0,0), - new TextField(textBoxBottom.Text, Alignment,0,1) - }); - - if (!res) - { - MessageBox.Show("Create you fields first", "Field update error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - } - - private void buttonLayoutOneTextField_Click(object sender, EventArgs e) - { - //Set one column one line layout - TableLayout layout = new TableLayout(1, 1); - iClient.SetLayout(layout); - - //Set our fields - iClient.CreateFields(new DataField[] - { - new TextField(textBoxTop.Text, Alignment) - }); - } - - private void numericUpDownPriority_ValueChanged(object sender, EventArgs e) - { - iClient.SetPriority((uint)numericUpDownPriority.Value); - } - } -} diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Test/MainForm.resx --- a/Clients/Test/MainForm.resx Wed Feb 03 13:02:48 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Test/Program.cs --- a/Clients/Test/Program.cs Wed Feb 03 13:02:48 2016 +0100 +++ b/Clients/Test/Program.cs Wed Feb 03 13:20:16 2016 +0100 @@ -39,7 +39,7 @@ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); + Application.Run(new FormClientTest()); } [STAThread] @@ -50,7 +50,7 @@ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - MainForm mainForm = new MainForm(); + FormClientTest mainForm = new FormClientTest(); mainForm.Params = (StartParams)aParams; Application.Run(mainForm); } diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Test/SharpDisplayClient.csproj --- a/Clients/Test/SharpDisplayClient.csproj Wed Feb 03 13:02:48 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ - - - - - Debug - AnyCPU - {7EE64074-8CDB-4448-B40C-81B75D6B31CD} - WinExe - Properties - SharpDisplayClient - SharpDisplayClient - v4.6 - 512 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 0.1.0.%2a - false - false - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - ..\bin\x86\Debug\ - ..\bin\x86\Debug\obj - DEBUG;TRACE - full - x86 - prompt - MinimumRecommendedRules.ruleset - false - - - ..\bin\x86\Release\ - ..\bin\x86\Release\obj - TRACE - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - false - - - true - - - 70A149AB9F89E507D9411D109553BE22455895D6 - - - SharpDisplayManager_TemporaryKey.pfx - - - true - - - - ..\..\packages\SharpLibDisplay.0.2.5\lib\net40\SharpLibDisplay.dll - True - - - - - - - - - - - - - - - - Form - - - MainForm.cs - - - - - MainForm.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - False - Microsoft .NET Framework 4.5 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - - - \ No newline at end of file diff -r 60977f2b3ca7 -r 7ada476f3fd7 Clients/Test/SharpDisplayClientTest.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Clients/Test/SharpDisplayClientTest.csproj Wed Feb 03 13:20:16 2016 +0100 @@ -0,0 +1,164 @@ + + + + + Debug + AnyCPU + {7EE64074-8CDB-4448-B40C-81B75D6B31CD} + WinExe + Properties + SharpDisplayClient + SharpDisplayClient + v4.6 + 512 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 0.1.0.%2a + false + false + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + true + ..\bin\x86\Debug\ + ..\bin\x86\Debug\obj + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + false + + + ..\bin\x86\Release\ + ..\bin\x86\Release\obj + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + false + + + true + + + 70A149AB9F89E507D9411D109553BE22455895D6 + + + SharpDisplayManager_TemporaryKey.pfx + + + true + + + + ..\..\packages\SharpLibDisplay.0.2.5\lib\net40\SharpLibDisplay.dll + True + + + + + + + + + + + + + + + + Form + + + FormClientTest.cs + + + + + FormClientTest.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + False + Microsoft .NET Framework 4.5 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + + + \ No newline at end of file diff -r 60977f2b3ca7 -r 7ada476f3fd7 Server/SharpDisplayManager.csproj --- a/Server/SharpDisplayManager.csproj Wed Feb 03 13:02:48 2016 +0100 +++ b/Server/SharpDisplayManager.csproj Wed Feb 03 13:20:16 2016 +0100 @@ -218,13 +218,13 @@ - + {a76579e5-aa8d-45a3-99e1-239a5c030a78} - SharpDisplayIdleClient + SharpDisplayClientIdle - + {7ee64074-8cdb-4448-b40c-81b75d6b31cd} - SharpDisplayClient + SharpDisplayClientTest {c174f23d-3055-49bc-b6b0-563011af624d} diff -r 60977f2b3ca7 -r 7ada476f3fd7 SharpDisplayManager.sln --- a/SharpDisplayManager.sln Wed Feb 03 13:02:48 2016 +0100 +++ b/SharpDisplayManager.sln Wed Feb 03 13:20:16 2016 +0100 @@ -9,9 +9,9 @@ EndProject Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Setup", "Setup\Setup.vdproj", "{22C920A9-2352-4DC9-91E2-035EBD712866}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDisplayIdleClient", "Clients\Idle\SharpDisplayIdleClient.csproj", "{A76579E5-AA8D-45A3-99E1-239A5C030A78}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDisplayClientIdle", "Clients\Idle\SharpDisplayClientIdle.csproj", "{A76579E5-AA8D-45A3-99E1-239A5C030A78}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDisplayClient", "Clients\Test\SharpDisplayClient.csproj", "{7EE64074-8CDB-4448-B40C-81B75D6B31CD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDisplayClientTest", "Clients\Test\SharpDisplayClientTest.csproj", "{7EE64074-8CDB-4448-B40C-81B75D6B31CD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution