Adding disconnect function to our interface.
2 using System.Collections.Generic;
5 using System.Threading.Tasks;
6 using System.Windows.Forms;
7 using SharpDisplayInterface;
8 using System.ServiceModel;
9 using System.ServiceModel.Channels;
12 namespace SharpDisplayClient
17 public partial class Callback : IDisplayServiceCallback, IDisposable
19 public void OnConnected()
21 //Debug.Assert(Thread.CurrentThread.IsThreadPoolThread);
22 //Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId);
24 MessageBox.Show("OnConnected()", "Client");
28 public void OnServerClosing()
30 //Debug.Assert(Thread.CurrentThread.IsThreadPoolThread);
31 //Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId);
33 //MessageBox.Show("OnServerClosing()", "Client");
34 Program.iMainForm.CloseConnection();
48 public partial class Client : DuplexClientBase<IDisplayService>
50 private string Name { get; set; }
52 public Client(InstanceContext callbackInstance)
53 : base(callbackInstance, new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8001/DisplayService"))
56 public void Connect(string aClientName)
59 Channel.Connect(aClientName);
62 public void Disconnect()
64 Channel.Disconnect(Name);
68 public void SetText(int aLineIndex, string aText)
70 Channel.SetText(aLineIndex, aText);
74 public void SetTexts(System.Collections.Generic.IList<string> aTexts)
76 Channel.SetTexts(aTexts);