author | sl |
Thu, 14 Aug 2014 09:30:14 +0200 | |
changeset 25 | 6f10207a89a8 |
parent 22 | cac466b1b6e6 |
child 26 | a6fb2b2f73b0 |
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@25 | 14 |
/// <summary> |
sl@25 | 15 |
/// |
sl@25 | 16 |
/// </summary> |
sl@25 | 17 |
public partial class ClientInput : IDisplayServiceCallback, IDisposable |
sl@20 | 18 |
{ |
sl@20 | 19 |
public void OnConnected() |
sl@20 | 20 |
{ |
sl@20 | 21 |
//Debug.Assert(Thread.CurrentThread.IsThreadPoolThread); |
sl@20 | 22 |
//Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId); |
sl@20 | 23 |
|
sl@20 | 24 |
MessageBox.Show("OnConnected()", "Client"); |
sl@20 | 25 |
} |
sl@20 | 26 |
|
sl@20 | 27 |
|
sl@20 | 28 |
public void OnServerClosing() |
sl@20 | 29 |
{ |
sl@20 | 30 |
//Debug.Assert(Thread.CurrentThread.IsThreadPoolThread); |
sl@20 | 31 |
//Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId); |
sl@20 | 32 |
|
sl@21 | 33 |
//MessageBox.Show("OnServerClosing()", "Client"); |
sl@21 | 34 |
Program.iMainForm.CloseConnection(); |
sl@20 | 35 |
} |
sl@25 | 36 |
|
sl@25 | 37 |
//From IDisposable |
sl@25 | 38 |
public void Dispose() |
sl@25 | 39 |
{ |
sl@25 | 40 |
|
sl@25 | 41 |
} |
sl@20 | 42 |
} |
sl@20 | 43 |
|
sl@20 | 44 |
|
sl@25 | 45 |
/// <summary> |
sl@25 | 46 |
/// |
sl@25 | 47 |
/// </summary> |
sl@20 | 48 |
public partial class ClientOutput : DuplexClientBase<IDisplayService>, IDisplayService |
sl@20 | 49 |
{ |
sl@20 | 50 |
public ClientOutput(InstanceContext callbackInstance) |
sl@20 | 51 |
: base(callbackInstance, new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8001/DisplayService")) |
sl@20 | 52 |
{ } |
sl@20 | 53 |
|
sl@20 | 54 |
public void Connect(string aClientName) |
sl@20 | 55 |
{ |
sl@20 | 56 |
Channel.Connect(aClientName); |
sl@20 | 57 |
} |
sl@20 | 58 |
|
sl@20 | 59 |
public void SetText(int aLineIndex, string aText) |
sl@20 | 60 |
{ |
sl@20 | 61 |
Channel.SetText(aLineIndex, aText); |
sl@20 | 62 |
} |
sl@20 | 63 |
|
sl@20 | 64 |
|
sl@20 | 65 |
public void SetTexts(System.Collections.Generic.IList<string> aTexts) |
sl@20 | 66 |
{ |
sl@20 | 67 |
Channel.SetTexts(aTexts); |
sl@20 | 68 |
} |
sl@20 | 69 |
|
sl@20 | 70 |
|
sl@20 | 71 |
} |
sl@20 | 72 |
} |