diff -r fdda7642776a -r b5ed2e29be23 Server/Servers.cs --- a/Server/Servers.cs Mon Sep 01 19:23:36 2014 +0200 +++ b/Server/Servers.cs Sun Sep 21 13:15:52 2014 +0200 @@ -4,58 +4,58 @@ using System.ServiceModel; using System.Collections.Generic; using System.Linq; -using SharpDisplayInterface; using System.Diagnostics; +using SharpDisplay; -namespace SharpDisplayManager +namespace SharpDisplay { /// - /// Implement our display service. - /// This class is instantiated anew whenever a client send a request. + /// Implement our display services. + /// Each client connection has such a session object server side. /// [ServiceBehavior( ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.PerSession )] - class DisplayServer : IDisplayService, IDisposable + class Session : IService, IDisposable { public string SessionId { get; set; } public string Name { get; set; } - DisplayServer() + Session() { Trace.TraceInformation("Server session opening."); //First save our session ID. It will be needed in Dispose cause our OperationContxt won't be available then. SessionId = OperationContext.Current.SessionId; - IDisplayServiceCallback callback = OperationContext.Current.GetCallbackChannel(); + ICallback callback = OperationContext.Current.GetCallbackChannel(); // - Program.iMainForm.AddClientThreadSafe(SessionId,callback); + SharpDisplayManager.Program.iMainForm.AddClientThreadSafe(SessionId,callback); } public void Dispose() { Trace.TraceInformation("Server session closing."); - Program.iMainForm.RemoveClientThreadSafe(SessionId); + SharpDisplayManager.Program.iMainForm.RemoveClientThreadSafe(SessionId); } //From IDisplayService public void SetTexts(System.Collections.Generic.IList aTextFields) { - Program.iMainForm.SetTextsThreadSafe(SessionId, aTextFields); + SharpDisplayManager.Program.iMainForm.SetTextsThreadSafe(SessionId, aTextFields); } // public void SetText(TextField aTextField) { - Program.iMainForm.SetTextThreadSafe(SessionId, aTextField); + SharpDisplayManager.Program.iMainForm.SetTextThreadSafe(SessionId, aTextField); } // public void SetName(string aClientName) { Name = aClientName; - Program.iMainForm.SetClientNameThreadSafe(SessionId, Name); + SharpDisplayManager.Program.iMainForm.SetClientNameThreadSafe(SessionId, Name); //Disconnect(aClientName); //Register our client and its callback interface @@ -69,7 +69,7 @@ /// public int ClientCount() { - return Program.iMainForm.iClients.Count; + return SharpDisplayManager.Program.iMainForm.iClients.Count; }