1.1 --- a/Server/Servers.cs Mon Sep 01 19:23:36 2014 +0200
1.2 +++ b/Server/Servers.cs Sun Sep 21 13:15:52 2014 +0200
1.3 @@ -4,58 +4,58 @@
1.4 using System.ServiceModel;
1.5 using System.Collections.Generic;
1.6 using System.Linq;
1.7 -using SharpDisplayInterface;
1.8 using System.Diagnostics;
1.9 +using SharpDisplay;
1.10
1.11 -namespace SharpDisplayManager
1.12 +namespace SharpDisplay
1.13 {
1.14 /// <summary>
1.15 - /// Implement our display service.
1.16 - /// This class is instantiated anew whenever a client send a request.
1.17 + /// Implement our display services.
1.18 + /// Each client connection has such a session object server side.
1.19 /// </summary>
1.20 [ServiceBehavior(
1.21 ConcurrencyMode = ConcurrencyMode.Multiple,
1.22 InstanceContextMode = InstanceContextMode.PerSession
1.23 )]
1.24 - class DisplayServer : IDisplayService, IDisposable
1.25 + class Session : IService, IDisposable
1.26 {
1.27 public string SessionId { get; set; }
1.28 public string Name { get; set; }
1.29
1.30 - DisplayServer()
1.31 + Session()
1.32 {
1.33 Trace.TraceInformation("Server session opening.");
1.34 //First save our session ID. It will be needed in Dispose cause our OperationContxt won't be available then.
1.35 SessionId = OperationContext.Current.SessionId;
1.36 - IDisplayServiceCallback callback = OperationContext.Current.GetCallbackChannel<IDisplayServiceCallback>();
1.37 + ICallback callback = OperationContext.Current.GetCallbackChannel<ICallback>();
1.38 //
1.39 - Program.iMainForm.AddClientThreadSafe(SessionId,callback);
1.40 + SharpDisplayManager.Program.iMainForm.AddClientThreadSafe(SessionId,callback);
1.41
1.42 }
1.43
1.44 public void Dispose()
1.45 {
1.46 Trace.TraceInformation("Server session closing.");
1.47 - Program.iMainForm.RemoveClientThreadSafe(SessionId);
1.48 + SharpDisplayManager.Program.iMainForm.RemoveClientThreadSafe(SessionId);
1.49 }
1.50
1.51 //From IDisplayService
1.52 public void SetTexts(System.Collections.Generic.IList<TextField> aTextFields)
1.53 {
1.54 - Program.iMainForm.SetTextsThreadSafe(SessionId, aTextFields);
1.55 + SharpDisplayManager.Program.iMainForm.SetTextsThreadSafe(SessionId, aTextFields);
1.56 }
1.57
1.58 //
1.59 public void SetText(TextField aTextField)
1.60 {
1.61 - Program.iMainForm.SetTextThreadSafe(SessionId, aTextField);
1.62 + SharpDisplayManager.Program.iMainForm.SetTextThreadSafe(SessionId, aTextField);
1.63 }
1.64
1.65 //
1.66 public void SetName(string aClientName)
1.67 {
1.68 Name = aClientName;
1.69 - Program.iMainForm.SetClientNameThreadSafe(SessionId, Name);
1.70 + SharpDisplayManager.Program.iMainForm.SetClientNameThreadSafe(SessionId, Name);
1.71 //Disconnect(aClientName);
1.72
1.73 //Register our client and its callback interface
1.74 @@ -69,7 +69,7 @@
1.75 ///
1.76 public int ClientCount()
1.77 {
1.78 - return Program.iMainForm.iClients.Count;
1.79 + return SharpDisplayManager.Program.iMainForm.iClients.Count;
1.80 }
1.81
1.82