Renaming stuff.
1.1 --- a/Client/Client.cs Mon Sep 01 19:23:36 2014 +0200
1.2 +++ b/Client/Client.cs Sun Sep 21 13:15:52 2014 +0200
1.3 @@ -4,7 +4,7 @@
1.4 using System.Text;
1.5 using System.Threading.Tasks;
1.6 using System.Windows.Forms;
1.7 -using SharpDisplayInterface;
1.8 +using SharpDisplay;
1.9 using System.ServiceModel;
1.10 using System.ServiceModel.Channels;
1.11
1.12 @@ -15,7 +15,7 @@
1.13 ///
1.14 /// </summary>
1.15 [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
1.16 - public class Callback : IDisplayServiceCallback, IDisposable
1.17 + public class Callback : ICallback, IDisposable
1.18 {
1.19 private MainForm MainForm { get; set; }
1.20
1.21 @@ -55,7 +55,7 @@
1.22 ///
1.23 /// </summary>
1.24 [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
1.25 - public class Client : DuplexClientBase<IDisplayService>
1.26 + public class Client : DuplexClientBase<IService>
1.27 {
1.28 public string Name { get; set; }
1.29 public string SessionId { get { return InnerChannel.SessionId; } }
2.1 --- a/Client/MainForm.cs Mon Sep 01 19:23:36 2014 +0200
2.2 +++ b/Client/MainForm.cs Sun Sep 21 13:15:52 2014 +0200
2.3 @@ -10,7 +10,7 @@
2.4 using System.ServiceModel;
2.5 using System.ServiceModel.Channels;
2.6 using System.Diagnostics;
2.7 -using SharpDisplayInterface;
2.8 +using SharpDisplay;
2.9
2.10
2.11 namespace SharpDisplayClient
3.1 --- a/Interface/Interface.cs Mon Sep 01 19:23:36 2014 +0200
3.2 +++ b/Interface/Interface.cs Sun Sep 21 13:15:52 2014 +0200
3.3 @@ -9,7 +9,7 @@
3.4 using System.Runtime.Serialization;
3.5
3.6
3.7 -namespace SharpDisplayInterface
3.8 +namespace SharpDisplay
3.9 {
3.10 [DataContract]
3.11 public class TextField
3.12 @@ -39,9 +39,8 @@
3.13 }
3.14
3.15
3.16 - [ServiceContract( CallbackContract = typeof(IDisplayServiceCallback),
3.17 - SessionMode = SessionMode.Required)]
3.18 - public interface IDisplayService
3.19 + [ServiceContract( CallbackContract = typeof(ICallback), SessionMode = SessionMode.Required)]
3.20 + public interface IService
3.21 {
3.22 /// <summary>
3.23 /// Set the name of this client.
3.24 @@ -78,7 +77,7 @@
3.25 }
3.26
3.27
3.28 - public interface IDisplayServiceCallback
3.29 + public interface ICallback
3.30 {
3.31 [OperationContract(IsOneWay = true)]
3.32 void OnConnected();
4.1 --- a/Server/MainForm.cs Mon Sep 01 19:23:36 2014 +0200
4.2 +++ b/Server/MainForm.cs Sun Sep 21 13:15:52 2014 +0200
4.3 @@ -14,9 +14,8 @@
4.4 using System.Threading;
4.5 using System.Diagnostics;
4.6 //
4.7 -using SharpDisplayInterface;
4.8 using SharpDisplayClient;
4.9 -
4.10 +using SharpDisplay;
4.11
4.12 namespace SharpDisplayManager
4.13 {
4.14 @@ -490,11 +489,11 @@
4.15 {
4.16 iServiceHost = new ServiceHost
4.17 (
4.18 - typeof(DisplayServer),
4.19 + typeof(Session),
4.20 new Uri[] { new Uri("net.tcp://localhost:8001/") }
4.21 );
4.22
4.23 - iServiceHost.AddServiceEndpoint(typeof(IDisplayService), new NetTcpBinding(SecurityMode.None,true), "DisplayService");
4.24 + iServiceHost.AddServiceEndpoint(typeof(IService), new NetTcpBinding(SecurityMode.None, true), "DisplayService");
4.25 iServiceHost.Open();
4.26 }
4.27
4.28 @@ -583,7 +582,7 @@
4.29 }
4.30
4.31 //Delegates are used for our thread safe method
4.32 - public delegate void AddClientDelegate(string aSessionId, IDisplayServiceCallback aCallback);
4.33 + public delegate void AddClientDelegate(string aSessionId, ICallback aCallback);
4.34 public delegate void RemoveClientDelegate(string aSessionId);
4.35 public delegate void SetTextDelegate(string SessionId, TextField aTextField);
4.36 public delegate void SetTextsDelegate(string SessionId, System.Collections.Generic.IList<TextField> aTextFields);
4.37 @@ -595,7 +594,7 @@
4.38 /// </summary>
4.39 /// <param name="aSessionId"></param>
4.40 /// <param name="aCallback"></param>
4.41 - public void AddClientThreadSafe(string aSessionId, IDisplayServiceCallback aCallback)
4.42 + public void AddClientThreadSafe(string aSessionId, ICallback aCallback)
4.43 {
4.44 if (this.InvokeRequired)
4.45 {
4.46 @@ -948,7 +947,7 @@
4.47 /// </summary>
4.48 public class ClientData
4.49 {
4.50 - public ClientData(string aSessionId, IDisplayServiceCallback aCallback)
4.51 + public ClientData(string aSessionId, ICallback aCallback)
4.52 {
4.53 SessionId = aSessionId;
4.54 Name = "";
4.55 @@ -959,6 +958,6 @@
4.56 public string SessionId { get; set; }
4.57 public string Name { get; set; }
4.58 public List<TextField> Texts { get; set; }
4.59 - public IDisplayServiceCallback Callback { get; set; }
4.60 + public ICallback Callback { get; set; }
4.61 }
4.62 }
5.1 --- a/Server/Servers.cs Mon Sep 01 19:23:36 2014 +0200
5.2 +++ b/Server/Servers.cs Sun Sep 21 13:15:52 2014 +0200
5.3 @@ -4,58 +4,58 @@
5.4 using System.ServiceModel;
5.5 using System.Collections.Generic;
5.6 using System.Linq;
5.7 -using SharpDisplayInterface;
5.8 using System.Diagnostics;
5.9 +using SharpDisplay;
5.10
5.11 -namespace SharpDisplayManager
5.12 +namespace SharpDisplay
5.13 {
5.14 /// <summary>
5.15 - /// Implement our display service.
5.16 - /// This class is instantiated anew whenever a client send a request.
5.17 + /// Implement our display services.
5.18 + /// Each client connection has such a session object server side.
5.19 /// </summary>
5.20 [ServiceBehavior(
5.21 ConcurrencyMode = ConcurrencyMode.Multiple,
5.22 InstanceContextMode = InstanceContextMode.PerSession
5.23 )]
5.24 - class DisplayServer : IDisplayService, IDisposable
5.25 + class Session : IService, IDisposable
5.26 {
5.27 public string SessionId { get; set; }
5.28 public string Name { get; set; }
5.29
5.30 - DisplayServer()
5.31 + Session()
5.32 {
5.33 Trace.TraceInformation("Server session opening.");
5.34 //First save our session ID. It will be needed in Dispose cause our OperationContxt won't be available then.
5.35 SessionId = OperationContext.Current.SessionId;
5.36 - IDisplayServiceCallback callback = OperationContext.Current.GetCallbackChannel<IDisplayServiceCallback>();
5.37 + ICallback callback = OperationContext.Current.GetCallbackChannel<ICallback>();
5.38 //
5.39 - Program.iMainForm.AddClientThreadSafe(SessionId,callback);
5.40 + SharpDisplayManager.Program.iMainForm.AddClientThreadSafe(SessionId,callback);
5.41
5.42 }
5.43
5.44 public void Dispose()
5.45 {
5.46 Trace.TraceInformation("Server session closing.");
5.47 - Program.iMainForm.RemoveClientThreadSafe(SessionId);
5.48 + SharpDisplayManager.Program.iMainForm.RemoveClientThreadSafe(SessionId);
5.49 }
5.50
5.51 //From IDisplayService
5.52 public void SetTexts(System.Collections.Generic.IList<TextField> aTextFields)
5.53 {
5.54 - Program.iMainForm.SetTextsThreadSafe(SessionId, aTextFields);
5.55 + SharpDisplayManager.Program.iMainForm.SetTextsThreadSafe(SessionId, aTextFields);
5.56 }
5.57
5.58 //
5.59 public void SetText(TextField aTextField)
5.60 {
5.61 - Program.iMainForm.SetTextThreadSafe(SessionId, aTextField);
5.62 + SharpDisplayManager.Program.iMainForm.SetTextThreadSafe(SessionId, aTextField);
5.63 }
5.64
5.65 //
5.66 public void SetName(string aClientName)
5.67 {
5.68 Name = aClientName;
5.69 - Program.iMainForm.SetClientNameThreadSafe(SessionId, Name);
5.70 + SharpDisplayManager.Program.iMainForm.SetClientNameThreadSafe(SessionId, Name);
5.71 //Disconnect(aClientName);
5.72
5.73 //Register our client and its callback interface
5.74 @@ -69,7 +69,7 @@
5.75 ///
5.76 public int ClientCount()
5.77 {
5.78 - return Program.iMainForm.iClients.Count;
5.79 + return SharpDisplayManager.Program.iMainForm.iClients.Count;
5.80 }
5.81
5.82