author | sl |
Thu, 14 Aug 2014 09:11:27 +0200 | |
changeset 22 | cac466b1b6e6 |
parent 21 | 274a6b27c3f9 |
child 25 | 6f10207a89a8 |
permissions | -rw-r--r-- |
sl@20 | 1 |
using System; |
sl@20 | 2 |
using System.Collections.Generic; |
sl@20 | 3 |
using System.Linq; |
sl@20 | 4 |
using System.Text; |
sl@20 | 5 |
using System.Threading.Tasks; |
sl@20 | 6 |
using System.Windows.Forms; |
sl@22 | 7 |
using SharpDisplayInterface; |
sl@20 | 8 |
using System.ServiceModel; |
sl@20 | 9 |
using System.ServiceModel.Channels; |
sl@20 | 10 |
|
sl@20 | 11 |
|
sl@20 | 12 |
namespace SharpDisplayClient |
sl@20 | 13 |
{ |
sl@22 | 14 |
public partial class ClientInput : IDisplayServiceCallback |
sl@20 | 15 |
{ |
sl@20 | 16 |
public void OnConnected() |
sl@20 | 17 |
{ |
sl@20 | 18 |
//Debug.Assert(Thread.CurrentThread.IsThreadPoolThread); |
sl@20 | 19 |
//Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId); |
sl@20 | 20 |
|
sl@20 | 21 |
MessageBox.Show("OnConnected()", "Client"); |
sl@20 | 22 |
} |
sl@20 | 23 |
|
sl@20 | 24 |
|
sl@20 | 25 |
public void OnServerClosing() |
sl@20 | 26 |
{ |
sl@20 | 27 |
//Debug.Assert(Thread.CurrentThread.IsThreadPoolThread); |
sl@20 | 28 |
//Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId); |
sl@20 | 29 |
|
sl@21 | 30 |
//MessageBox.Show("OnServerClosing()", "Client"); |
sl@21 | 31 |
Program.iMainForm.CloseConnection(); |
sl@20 | 32 |
} |
sl@20 | 33 |
} |
sl@20 | 34 |
|
sl@20 | 35 |
|
sl@20 | 36 |
|
sl@20 | 37 |
public partial class ClientOutput : DuplexClientBase<IDisplayService>, IDisplayService |
sl@20 | 38 |
{ |
sl@20 | 39 |
public ClientOutput(InstanceContext callbackInstance) |
sl@20 | 40 |
: base(callbackInstance, new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8001/DisplayService")) |
sl@20 | 41 |
{ } |
sl@20 | 42 |
|
sl@20 | 43 |
public void Connect(string aClientName) |
sl@20 | 44 |
{ |
sl@20 | 45 |
Channel.Connect(aClientName); |
sl@20 | 46 |
} |
sl@20 | 47 |
|
sl@20 | 48 |
public void SetText(int aLineIndex, string aText) |
sl@20 | 49 |
{ |
sl@20 | 50 |
Channel.SetText(aLineIndex, aText); |
sl@20 | 51 |
} |
sl@20 | 52 |
|
sl@20 | 53 |
|
sl@20 | 54 |
public void SetTexts(System.Collections.Generic.IList<string> aTexts) |
sl@20 | 55 |
{ |
sl@20 | 56 |
Channel.SetTexts(aTexts); |
sl@20 | 57 |
} |
sl@20 | 58 |
|
sl@20 | 59 |
|
sl@20 | 60 |
} |
sl@20 | 61 |
} |