Client/Client.cs
changeset 31 f19b04646b6a
parent 30 c375286d1a1c
child 32 4c416d2878dd
     1.1 --- a/Client/Client.cs	Fri Aug 15 10:20:01 2014 +0200
     1.2 +++ b/Client/Client.cs	Fri Aug 15 11:11:17 2014 +0200
     1.3 @@ -14,9 +14,16 @@
     1.4      /// <summary>
     1.5      ///
     1.6      /// </summary>
     1.7 -    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]
     1.8 +    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
     1.9      public class Callback : IDisplayServiceCallback, IDisposable
    1.10      {
    1.11 +        private MainForm MainForm { get; set; }
    1.12 +
    1.13 +        public Callback(MainForm aMainForm)
    1.14 +        {
    1.15 +            MainForm = aMainForm;
    1.16 +        }
    1.17 +
    1.18          public void OnConnected()
    1.19          {
    1.20              //Debug.Assert(Thread.CurrentThread.IsThreadPoolThread);
    1.21 @@ -32,8 +39,8 @@
    1.22              //Trace.WriteLine("Callback thread = " + Thread.CurrentThread.ManagedThreadId);
    1.23  
    1.24              //MessageBox.Show("OnServerClosing()", "Client");
    1.25 -            Program.iMainForm.CloseConnection();
    1.26 -            Program.iMainForm.Close();
    1.27 +            MainForm.CloseConnectionThreadSafe();
    1.28 +            MainForm.CloseThreadSafe();
    1.29          }
    1.30  
    1.31          //From IDisposable
    1.32 @@ -47,7 +54,7 @@
    1.33      /// <summary>
    1.34      ///
    1.35      /// </summary>
    1.36 -    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]
    1.37 +    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
    1.38      public class Client : DuplexClientBase<IDisplayService>
    1.39      {
    1.40          public string Name { get; set; }