Server/Servers.cs
changeset 56 e86d84480b32
parent 55 b5ed2e29be23
child 57 544132d07c3b
     1.1 --- a/Server/Servers.cs	Sun Sep 21 13:15:52 2014 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,79 +0,0 @@
     1.4 -using System;
     1.5 -using System.Windows.Forms;
     1.6 -using System.Collections;
     1.7 -using System.ServiceModel;
     1.8 -using System.Collections.Generic;
     1.9 -using System.Linq;
    1.10 -using System.Diagnostics;
    1.11 -using SharpDisplay;
    1.12 -
    1.13 -namespace SharpDisplay
    1.14 -{
    1.15 -    /// <summary>
    1.16 -    /// Implement our display services.
    1.17 -    /// Each client connection has such a session object server side.
    1.18 -    /// </summary>
    1.19 -    [ServiceBehavior(   
    1.20 -                        ConcurrencyMode = ConcurrencyMode.Multiple,
    1.21 -                        InstanceContextMode = InstanceContextMode.PerSession                       
    1.22 -                    )]
    1.23 -    class Session : IService, IDisposable
    1.24 -    {
    1.25 -        public string SessionId { get; set; }
    1.26 -        public string Name { get; set; }
    1.27 -
    1.28 -        Session()
    1.29 -        {
    1.30 -            Trace.TraceInformation("Server session opening.");
    1.31 -            //First save our session ID. It will be needed in Dispose cause our OperationContxt won't be available then.
    1.32 -            SessionId = OperationContext.Current.SessionId;
    1.33 -            ICallback callback = OperationContext.Current.GetCallbackChannel<ICallback>();
    1.34 -            //
    1.35 -            SharpDisplayManager.Program.iMainForm.AddClientThreadSafe(SessionId,callback);
    1.36 -
    1.37 -        }
    1.38 -
    1.39 -        public void Dispose()
    1.40 -        {
    1.41 -            Trace.TraceInformation("Server session closing.");
    1.42 -            SharpDisplayManager.Program.iMainForm.RemoveClientThreadSafe(SessionId);
    1.43 -        }
    1.44 -        
    1.45 -        //From IDisplayService
    1.46 -        public void SetTexts(System.Collections.Generic.IList<TextField> aTextFields)
    1.47 -        {
    1.48 -            SharpDisplayManager.Program.iMainForm.SetTextsThreadSafe(SessionId, aTextFields);
    1.49 -        }
    1.50 -
    1.51 -        //
    1.52 -        public void SetText(TextField aTextField)
    1.53 -        {
    1.54 -            SharpDisplayManager.Program.iMainForm.SetTextThreadSafe(SessionId, aTextField);
    1.55 -        }
    1.56 -
    1.57 -        //
    1.58 -        public void SetName(string aClientName)
    1.59 -        {
    1.60 -            Name = aClientName;
    1.61 -            SharpDisplayManager.Program.iMainForm.SetClientNameThreadSafe(SessionId, Name);
    1.62 -            //Disconnect(aClientName);
    1.63 -
    1.64 -            //Register our client and its callback interface
    1.65 -            //IDisplayServiceCallback callback = OperationContext.Current.GetCallbackChannel<IDisplayServiceCallback>();
    1.66 -            //Program.iMainForm.iClients.Add(aClientName, callback);
    1.67 -            //Program.iMainForm.treeViewClients.Nodes.Add(aClientName, aClientName);
    1.68 -            //For some reason MP still hangs on that one
    1.69 -            //callback.OnConnected();
    1.70 -        }
    1.71 -
    1.72 -        ///
    1.73 -        public int ClientCount()
    1.74 -        {
    1.75 -            return SharpDisplayManager.Program.iMainForm.iClients.Count;
    1.76 -        }
    1.77 -
    1.78 -        
    1.79 -
    1.80 -    }
    1.81 -
    1.82 -}