MiniDisplay API update.
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 [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
18 public class Callback : IDisplayServiceCallback, IDisposable
20 private MainForm MainForm { get; set; }
22 public Callback(MainForm aMainForm)
27 public void OnConnected()
29 //Debug.Assert(Thread.CurrentThread.IsThreadPoolThread);
30 //Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId);
32 MessageBox.Show("OnConnected()", "Client");
36 public void OnCloseOrder()
38 //Debug.Assert(Thread.CurrentThread.IsThreadPoolThread);
39 //Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId);
41 //MessageBox.Show("OnServerClosing()", "Client");
42 MainForm.CloseConnectionThreadSafe();
43 MainForm.CloseThreadSafe();
57 [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
58 public class Client : DuplexClientBase<IDisplayService>
60 public string Name { get; set; }
61 public string SessionId { get { return InnerChannel.SessionId; } }
63 public Client(InstanceContext callbackInstance)
64 : base(callbackInstance, new NetTcpBinding(SecurityMode.None, true), new EndpointAddress("net.tcp://localhost:8001/DisplayService"))
67 public void SetName(string aClientName)
70 Channel.SetName(aClientName);
73 public void SetText(TextField aTextField)
75 Channel.SetText(aTextField);
78 public void SetTexts(System.Collections.Generic.IList<TextField> aTextFields)
80 Channel.SetTexts(aTextFields);
83 public int ClientCount()
85 return Channel.ClientCount();