1.1 --- a/Client/Client.cs Thu Aug 14 09:12:59 2014 +0200
1.2 +++ b/Client/Client.cs Thu Aug 14 09:30:14 2014 +0200
1.3 @@ -11,7 +11,10 @@
1.4
1.5 namespace SharpDisplayClient
1.6 {
1.7 - public partial class ClientInput : IDisplayServiceCallback
1.8 + /// <summary>
1.9 + ///
1.10 + /// </summary>
1.11 + public partial class ClientInput : IDisplayServiceCallback, IDisposable
1.12 {
1.13 public void OnConnected()
1.14 {
1.15 @@ -30,10 +33,18 @@
1.16 //MessageBox.Show("OnServerClosing()", "Client");
1.17 Program.iMainForm.CloseConnection();
1.18 }
1.19 +
1.20 + //From IDisposable
1.21 + public void Dispose()
1.22 + {
1.23 +
1.24 + }
1.25 }
1.26
1.27
1.28 -
1.29 + /// <summary>
1.30 + ///
1.31 + /// </summary>
1.32 public partial class ClientOutput : DuplexClientBase<IDisplayService>, IDisplayService
1.33 {
1.34 public ClientOutput(InstanceContext callbackInstance)
2.1 --- a/Client/MainForm.cs Thu Aug 14 09:12:59 2014 +0200
2.2 +++ b/Client/MainForm.cs Thu Aug 14 09:30:14 2014 +0200
2.3 @@ -16,7 +16,6 @@
2.4 public partial class MainForm : Form
2.5 {
2.6 ClientOutput iClientOutput;
2.7 - InstanceContext iInstanceContext;
2.8 ClientInput iClientInput;
2.9
2.10 public MainForm()
2.11 @@ -34,8 +33,9 @@
2.12 private void MainForm_Load(object sender, EventArgs e)
2.13 {
2.14 iClientInput = new ClientInput();
2.15 - iInstanceContext = new InstanceContext(iClientInput);
2.16 - iClientOutput = new ClientOutput(iInstanceContext);
2.17 + //Instance context is then managed by our client class
2.18 + InstanceContext instanceContext = new InstanceContext(iClientInput);
2.19 + iClientOutput = new ClientOutput(instanceContext);
2.20
2.21 iClientOutput.Connect("TestClient");
2.22
2.23 @@ -43,9 +43,6 @@
2.24
2.25 public void CloseConnection()
2.26 {
2.27 - //If we close the instance context after the client output it hangs
2.28 - iInstanceContext.Close();
2.29 - iInstanceContext = null;
2.30 iClientOutput.Close();
2.31 iClientOutput = null;
2.32 iClientInput = null;
3.1 --- a/Client/Program.cs Thu Aug 14 09:12:59 2014 +0200
3.2 +++ b/Client/Program.cs Thu Aug 14 09:30:14 2014 +0200
3.3 @@ -6,7 +6,7 @@
3.4
3.5 namespace SharpDisplayClient
3.6 {
3.7 - static class Program
3.8 + static public class Program
3.9 {
3.10 public static MainForm iMainForm;
3.11
3.12 @@ -14,7 +14,7 @@
3.13 /// The main entry point for the application.
3.14 /// </summary>
3.15 [STAThread]
3.16 - static void Main()
3.17 + static public void Main()
3.18 {
3.19 Application.EnableVisualStyles();
3.20 Application.SetCompatibleTextRenderingDefault(false);
4.1 --- a/Server/MainForm.Designer.cs Thu Aug 14 09:12:59 2014 +0200
4.2 +++ b/Server/MainForm.Designer.cs Thu Aug 14 09:30:14 2014 +0200
4.3 @@ -35,6 +35,8 @@
4.4 this.checkBoxConnectOnStartup = new System.Windows.Forms.CheckBox();
4.5 this.panelDisplay = new System.Windows.Forms.Panel();
4.6 this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
4.7 + this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel();
4.8 + this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel();
4.9 this.checkBoxShowBorders = new System.Windows.Forms.CheckBox();
4.10 this.trackBarBrightness = new System.Windows.Forms.TrackBar();
4.11 this.buttonFill = new System.Windows.Forms.Button();
4.12 @@ -51,8 +53,7 @@
4.13 this.toolStripStatusLabelSpring = new System.Windows.Forms.ToolStripStatusLabel();
4.14 this.toolStripStatusLabelPower = new System.Windows.Forms.ToolStripStatusLabel();
4.15 this.toolStripStatusLabelFps = new System.Windows.Forms.ToolStripStatusLabel();
4.16 - this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel();
4.17 - this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel();
4.18 + this.buttonStartClient = new System.Windows.Forms.Button();
4.19 this.tabControl.SuspendLayout();
4.20 this.tabPageDisplay.SuspendLayout();
4.21 this.panelDisplay.SuspendLayout();
4.22 @@ -76,6 +77,7 @@
4.23 //
4.24 // tabPageDisplay
4.25 //
4.26 + this.tabPageDisplay.Controls.Add(this.buttonStartClient);
4.27 this.tabPageDisplay.Controls.Add(this.checkBoxReverseScreen);
4.28 this.tabPageDisplay.Controls.Add(this.checkBoxConnectOnStartup);
4.29 this.tabPageDisplay.Controls.Add(this.panelDisplay);
4.30 @@ -202,6 +204,39 @@
4.31 this.tableLayoutPanel.Size = new System.Drawing.Size(256, 64);
4.32 this.tableLayoutPanel.TabIndex = 5;
4.33 //
4.34 + // marqueeLabelTop
4.35 + //
4.36 + this.marqueeLabelTop.AutoEllipsis = true;
4.37 + this.marqueeLabelTop.BackColor = System.Drawing.Color.Transparent;
4.38 + this.marqueeLabelTop.Dock = System.Windows.Forms.DockStyle.Fill;
4.39 + this.marqueeLabelTop.Location = new System.Drawing.Point(1, 1);
4.40 + this.marqueeLabelTop.Margin = new System.Windows.Forms.Padding(0);
4.41 + this.marqueeLabelTop.Name = "marqueeLabelTop";
4.42 + this.marqueeLabelTop.OwnTimer = false;
4.43 + this.marqueeLabelTop.PixelsPerSecond = 64;
4.44 + this.marqueeLabelTop.Separator = "|";
4.45 + this.marqueeLabelTop.Size = new System.Drawing.Size(254, 30);
4.46 + this.marqueeLabelTop.TabIndex = 2;
4.47 + this.marqueeLabelTop.Text = "ABCDEFGHIJKLMNOPQRST-0123456789";
4.48 + this.marqueeLabelTop.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
4.49 + this.marqueeLabelTop.UseCompatibleTextRendering = true;
4.50 + //
4.51 + // marqueeLabelBottom
4.52 + //
4.53 + this.marqueeLabelBottom.AutoEllipsis = true;
4.54 + this.marqueeLabelBottom.Dock = System.Windows.Forms.DockStyle.Fill;
4.55 + this.marqueeLabelBottom.Location = new System.Drawing.Point(1, 32);
4.56 + this.marqueeLabelBottom.Margin = new System.Windows.Forms.Padding(0);
4.57 + this.marqueeLabelBottom.Name = "marqueeLabelBottom";
4.58 + this.marqueeLabelBottom.OwnTimer = false;
4.59 + this.marqueeLabelBottom.PixelsPerSecond = 64;
4.60 + this.marqueeLabelBottom.Separator = null;
4.61 + this.marqueeLabelBottom.Size = new System.Drawing.Size(254, 31);
4.62 + this.marqueeLabelBottom.TabIndex = 3;
4.63 + this.marqueeLabelBottom.Text = "abcdefghijklmnopqrst-0123456789";
4.64 + this.marqueeLabelBottom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
4.65 + this.marqueeLabelBottom.UseCompatibleTextRendering = true;
4.66 + //
4.67 // checkBoxShowBorders
4.68 //
4.69 this.checkBoxShowBorders.AutoSize = true;
4.70 @@ -342,38 +377,15 @@
4.71 this.toolStripStatusLabelFps.Size = new System.Drawing.Size(26, 17);
4.72 this.toolStripStatusLabelFps.Text = "FPS";
4.73 //
4.74 - // marqueeLabelTop
4.75 + // buttonStartClient
4.76 //
4.77 - this.marqueeLabelTop.AutoEllipsis = true;
4.78 - this.marqueeLabelTop.BackColor = System.Drawing.Color.Transparent;
4.79 - this.marqueeLabelTop.Dock = System.Windows.Forms.DockStyle.Fill;
4.80 - this.marqueeLabelTop.Location = new System.Drawing.Point(1, -124);
4.81 - this.marqueeLabelTop.Margin = new System.Windows.Forms.Padding(0);
4.82 - this.marqueeLabelTop.Name = "marqueeLabelTop";
4.83 - this.marqueeLabelTop.OwnTimer = false;
4.84 - this.marqueeLabelTop.PixelsPerSecond = 64;
4.85 - this.marqueeLabelTop.Separator = "|";
4.86 - this.marqueeLabelTop.Size = new System.Drawing.Size(254, 20);
4.87 - this.marqueeLabelTop.TabIndex = 2;
4.88 - this.marqueeLabelTop.Text = "ABCDEFGHIJKLMNOPQRST-0123456789";
4.89 - this.marqueeLabelTop.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
4.90 - this.marqueeLabelTop.UseCompatibleTextRendering = true;
4.91 - //
4.92 - // marqueeLabelBottom
4.93 - //
4.94 - this.marqueeLabelBottom.AutoEllipsis = true;
4.95 - this.marqueeLabelBottom.Dock = System.Windows.Forms.DockStyle.Fill;
4.96 - this.marqueeLabelBottom.Location = new System.Drawing.Point(1, -40);
4.97 - this.marqueeLabelBottom.Margin = new System.Windows.Forms.Padding(0);
4.98 - this.marqueeLabelBottom.Name = "marqueeLabelBottom";
4.99 - this.marqueeLabelBottom.OwnTimer = false;
4.100 - this.marqueeLabelBottom.PixelsPerSecond = 64;
4.101 - this.marqueeLabelBottom.Separator = null;
4.102 - this.marqueeLabelBottom.Size = new System.Drawing.Size(254, 20);
4.103 - this.marqueeLabelBottom.TabIndex = 3;
4.104 - this.marqueeLabelBottom.Text = "abcdefghijklmnopqrst-0123456789";
4.105 - this.marqueeLabelBottom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
4.106 - this.marqueeLabelBottom.UseCompatibleTextRendering = true;
4.107 + this.buttonStartClient.Location = new System.Drawing.Point(6, 282);
4.108 + this.buttonStartClient.Name = "buttonStartClient";
4.109 + this.buttonStartClient.Size = new System.Drawing.Size(75, 23);
4.110 + this.buttonStartClient.TabIndex = 15;
4.111 + this.buttonStartClient.Text = "Start Client";
4.112 + this.buttonStartClient.UseVisualStyleBackColor = true;
4.113 + this.buttonStartClient.Click += new System.EventHandler(this.buttonStartClient_Click);
4.114 //
4.115 // MainForm
4.116 //
4.117 @@ -427,6 +439,7 @@
4.118 public MarqueeLabel marqueeLabelBottom;
4.119 private System.Windows.Forms.CheckBox checkBoxConnectOnStartup;
4.120 private System.Windows.Forms.CheckBox checkBoxReverseScreen;
4.121 + private System.Windows.Forms.Button buttonStartClient;
4.122 }
4.123 }
4.124
5.1 --- a/Server/MainForm.cs Thu Aug 14 09:12:59 2014 +0200
5.2 +++ b/Server/MainForm.cs Thu Aug 14 09:30:14 2014 +0200
5.3 @@ -11,7 +11,10 @@
5.4 using CodeProject.Dialog;
5.5 using System.Drawing.Imaging;
5.6 using System.ServiceModel;
5.7 +using System.Threading;
5.8 +//
5.9 using SharpDisplayInterface;
5.10 +using SharpDisplayClient;
5.11
5.12
5.13 namespace SharpDisplayManager
5.14 @@ -397,6 +400,12 @@
5.15 }
5.16 }
5.17
5.18 + private void buttonStartClient_Click(object sender, EventArgs e)
5.19 + {
5.20 + Thread clientThread = new Thread(SharpDisplayClient.Program.Main);
5.21 + clientThread.Start();
5.22 + }
5.23 +
5.24
5.25
5.26 }
6.1 --- a/Server/SharpDisplayManager.csproj Thu Aug 14 09:12:59 2014 +0200
6.2 +++ b/Server/SharpDisplayManager.csproj Thu Aug 14 09:30:14 2014 +0200
6.3 @@ -90,6 +90,10 @@
6.4 <None Include="App.config" />
6.5 </ItemGroup>
6.6 <ItemGroup>
6.7 + <ProjectReference Include="..\Client\SharpDisplayClient.csproj">
6.8 + <Project>{7ee64074-8cdb-4448-b40c-81b75d6b31cd}</Project>
6.9 + <Name>SharpDisplayClient</Name>
6.10 + </ProjectReference>
6.11 <ProjectReference Include="..\Interface\SharpDisplayInterface.csproj">
6.12 <Project>{88eee0dc-abbc-4738-bad6-7e08cf7f50f9}</Project>
6.13 <Name>SharpDisplayInterface</Name>