Still trying to setup WCF for us to work nicely.
Now using multi threading and reliable session.
Implementing thread safe functions where needed.
Enforcing session mode.
Fixing bug in marquee label as we forgot to reset current position when text is changed.
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.Reentrant)]
18 public class Callback : IDisplayServiceCallback, IDisposable
20 public void OnConnected()
22 //Debug.Assert(Thread.CurrentThread.IsThreadPoolThread);
23 //Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId);
25 MessageBox.Show("OnConnected()", "Client");
29 public void OnServerClosing()
31 //Debug.Assert(Thread.CurrentThread.IsThreadPoolThread);
32 //Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId);
34 //MessageBox.Show("OnServerClosing()", "Client");
35 Program.iMainForm.CloseConnection();
36 Program.iMainForm.Close();
50 [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]
51 public class Client : DuplexClientBase<IDisplayService>
53 public string Name { get; set; }
54 public string SessionId { get { return InnerChannel.SessionId; } }
56 public Client(InstanceContext callbackInstance)
57 : base(callbackInstance, new NetTcpBinding(SecurityMode.None, true), new EndpointAddress("net.tcp://localhost:8001/DisplayService"))
60 public void Connect(string aClientName)
63 Channel.Connect(aClientName);
66 public void Disconnect()
68 Channel.Disconnect(Name);
72 public void SetText(int aLineIndex, string aText)
74 Channel.SetText(aLineIndex, aText);
78 public void SetTexts(System.Collections.Generic.IList<string> aTexts)
80 Channel.SetTexts(aTexts);