Adding server closing notification to clients.
2 using System.Collections.Generic;
5 using System.Threading.Tasks;
6 using System.Windows.Forms;
7 using SharpDisplayManager;
8 using System.ServiceModel;
9 using System.ServiceModel.Channels;
12 namespace SharpDisplayClient
14 public partial class ClientInput : SharpDisplayManager.IDisplayServiceCallback
16 public void OnConnected()
18 //Debug.Assert(Thread.CurrentThread.IsThreadPoolThread);
19 //Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId);
21 MessageBox.Show("OnConnected()", "Client");
25 public void OnServerClosing()
27 //Debug.Assert(Thread.CurrentThread.IsThreadPoolThread);
28 //Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId);
30 //MessageBox.Show("OnServerClosing()", "Client");
31 Program.iMainForm.CloseConnection();
37 public partial class ClientOutput : DuplexClientBase<IDisplayService>, IDisplayService
39 public ClientOutput(InstanceContext callbackInstance)
40 : base(callbackInstance, new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8001/DisplayService"))
43 public void Connect(string aClientName)
45 Channel.Connect(aClientName);
48 public void SetText(int aLineIndex, string aText)
50 Channel.SetText(aLineIndex, aText);
54 public void SetTexts(System.Collections.Generic.IList<string> aTexts)
56 Channel.SetTexts(aTexts);