コード例 #1
0
        private void Client_ReconnectComplete(object sender, EventArgs e)
        {
            // ignore callbacks from discarded objects.
            if (!Object.ReferenceEquals(sender, reconnectHandler))
            {
                return;
            }

            session = reconnectHandler.Session;
            reconnectHandler.Dispose();
            reconnectHandler = null;

            Console.WriteLine("--- RECONNECTED ---");
            ConnectionSatus = true;
            OnConnectionStatusChange?.Invoke(this, true);
        }
コード例 #2
0
        private void Client_KeepAlive(Session sender, KeepAliveEventArgs e)
        {
            if (e.Status != null && ServiceResult.IsNotGood(e.Status))
            {
                Console.WriteLine("{0} {1}/{2}", e.Status, sender.OutstandingRequestCount, sender.DefunctRequestCount);

                if (reconnectHandler == null)
                {
                    ConnectionSatus = false;
                    OnConnectionStatusChange?.Invoke(this, false);
                    Console.WriteLine("--- RECONNECTING ---");
                    reconnectHandler = new SessionReconnectHandler();
                    reconnectHandler.BeginReconnect(sender, ReconnectPeriod * 1000, Client_ReconnectComplete);
                }
            }
        }
コード例 #3
0
ファイル: DriverCNC.cs プロジェクト: xiaodelea/FullCNC
 private void fireOnConnectionStatusChange()
 {
     OnConnectionStatusChange?.Invoke();
 }