예제 #1
0
        public bool ProcessAndWait(NetworkMessage msg, EventHandler <MessageFromServerEventArgs> handler)
        {
            DataClient.OnMessageReceived += handler;

            try
            {
                PhaseLock.Reset();

                DataClient.Send(msg);

                PhaseLock.Wait(GlobalTimeout.Token);
                return(!GlobalTimeout.IsCancellationRequested);
            }
            finally
            {
                DataClient.OnMessageReceived -= handler;
            }
        }
예제 #2
0
 public void Dispose()
 {
     GlobalTimeout.Dispose();
     PhaseLock?.Dispose();
 }