Represents a change in the connection state.
 void hubConnection_StateChanged(StateChange objState)
 {
     dispatchState(objState.NewState);
 }
 private static void Connection_StateChanged(StateChange obj)
 {
     string line;
     Console.WriteLine("The server has been closed.");
     line = Console.ReadLine();
     Environment.Exit(0);
 }
Beispiel #3
0
 // This method just checks the connection state
 private static void Connection_StateChanged(StateChange state)
 {
     Console.WriteLine("State Changed {0}", state.NewState.ToString());
     if (state.NewState == ConnectionState.Disconnected)
     {
         System.Environment.Exit(0);
     }
 }
 private void OnHubConnectionStateChanged(StateChange stateChange)
 {
     if (stateChange.OldState == ConnectionState.Connecting &&
         stateChange.NewState == ConnectionState.Connected)
     {
         this.hub.Invoke("Register", this.MyRobotId);
         this.hub.On<string>("send", message => ReceiveWalk(message));
     }
 }
Beispiel #5
0
        private void HubConnectionStateChanged(StateChange state)
        {
            Debug.WriteLine("HubConnectionStateChanged Old={0}  New={1}", state.OldState, state.NewState);

            if (state.NewState == ConnectionState.Connected)
            {
                var message = new Message { Text = "Connected to service", Url = _serviceUrl, IsLocal = true };
                CreateNotificationFromMainDispatcher(message);
            }
        }
		void _hubConnection_StateChanged(StateChange obj)
		{

			LogMessage(_hubConnection.State.ToString());

			if (_hubConnection.State == ConnectionState.Connected)
			{
				_connectionStable = true;
			}
		}
Beispiel #7
0
Datei: Hub.cs Projekt: lx223/Q3
 private async void HubConnectionOnStateChanged(StateChange stateChange)
 {
     logger.Info("hub connection state changed: " + stateChange.OldState + " -> " + stateChange.NewState);
     OnPropertyChanged("ConnectionState");
     if (hubConnection.State == ConnectionState.Disconnected)
     {
         logger.Info("Queuing new connection attempt in 10s");
         await Task.Delay(TimeSpan.FromSeconds(10)).ConfigureAwait(false);
         await TryConnect().ConfigureAwait(false);
     }
 }
Beispiel #8
0
        private static void HubConnectionStateChanged(StateChange stateChange)
        {
            Console.WriteLine(@"{0} - Client state is {1}", DateTime.Now, _hubConnection.State);
            Console.WriteLine(@"Connection ID is {0}", _hubConnection.ConnectionId);

            if (_hubConnection.State == ConnectionState.Connected)
            {
                Console.WriteLine(@"{0} - UserOnline sent to hub", DateTime.Now);
                _conversationProxy.Invoke("UserOnline").Wait();
            }
        }
Beispiel #9
0
 private void ReportChange(StateChange change)
 {
     if (change.NewState == ConnectionState.Connected)
     {
         _Connected = true;
         ShowProgress(false);
     }
     else if (change.OldState == ConnectionState.Connected)
     {
         _Connected = false;
         ShowProgress(true);
     }
 }
 public static void ConnectionStateChanged(StateChange connection)
 {
     switch (connection.NewState) {
         case ConnectionState.Connected:
             connected = true;
             break;
         case ConnectionState.Connecting:
             break;
         case ConnectionState.Disconnected:
             connected = false;
             break;
         case ConnectionState.Reconnecting:
             break;
     }
 }
Beispiel #11
0
        private void Connection_StateChanged(StateChange obj)
        {
            if (obj.NewState == ConnectionState.Connected)
            {
                if (this.ShouldSubscribe)
                {
                    this.SubscribePincode(this.ShouldSubscribeCode);
                    this.ShouldSubscribe = false;
                }

                this.proxy.Invoke("SubscribeToLists");
            }

            if(this.ConnectionStatusChanged != null)
            {
                this.ConnectionStatusChanged(obj);
            }
        }
 private void ConnectionOnStateChanged(StateChange stateChange)
 {
     switch (stateChange.NewState)
     {
         case ConnectionState.Connecting:
             StatusText.Text = "Connecting...";
             break;
         case ConnectionState.Connected:
             Dispatcher.BeginInvoke(() => StatusText.Text = "Connected");
             break;
         case ConnectionState.Reconnecting:
             Dispatcher.BeginInvoke(() => StatusText.Text = "Reconnecting...");
             break;
         case ConnectionState.Disconnected:
             Dispatcher.BeginInvoke(() => StatusText.Text = "Disconnected");
             break;
     }
 }
Beispiel #13
0
        void ConnectionStateChanged(Microsoft.AspNet.SignalR.Client.StateChange state)
        {
            Invoke(new Action(() => btnConnect.Text = state.NewState.ToString()));

            ActiveControls(state.NewState == Microsoft.AspNet.SignalR.Client.ConnectionState.Connected);

            if (state.OldState == ConnectionState.Reconnecting && state.NewState == ConnectionState.Disconnected)
            {
                WaitSplash.DockOnControlThreadSafe(this);
            }
            else if (state.NewState == ConnectionState.Reconnecting)
            {
                WaitSplash.DockOnControlThreadSafe(this);
            }
            else if (state.NewState == ConnectionState.Connected)
            {
                WaitSplash.Hide();
            }
        }
Beispiel #14
0
 private void OnClientStateChanged(StateChange state)
 {
     if (state.NewState == ConnectionState.Disconnected)
     {
         Logger.Warn("Jabbr client is disconnected");
     }
     else
     {
         Logger.Info(string.Format("Jabbr client is {0}", state.NewState));
     }
 }
 private void OnStateChanged(StateChange stateChange)
 {
     if (StateChanged != null)
     {
         StateChanged(stateChange);
     }
 }
Beispiel #16
0
 void _hubConnection_StateChanged(StateChange obj)
 {
     Log.InfoFormat("Connection={0}", _hubConnection.State);
     if (_hubConnection.State == ConnectionState.Connected || _hubConnection.State == ConnectionState.Disconnected)
     {
         _connectionStable = true;
     }
 }
Beispiel #17
0
 static void hubConnection_StateChanged(StateChange obj)
 {
     Logging.DebugMessage("Going from {0} to {1} on {2}", obj.OldState, obj.NewState, GetConfigLocation());
 }
 protected void ConnectionOnStateChanged(StateChange stateChange)
 {
     Log.InfoFormat("State Changed: {0}->{1}",stateChange.OldState,stateChange.NewState);
     switch (stateChange.NewState)
     {
         case ConnectionState.Connecting:
             break;
         case ConnectionState.Connected:
             // Created a task because if reconnecting, it seems that this message doesn't go through if it doesn't have a delay
             var t = new Task(() =>
                 {
                     Thread.Sleep(1000);
                     if(GameStateEngine.GetContext().State.Status == EnumHostedGameStatus.Booting)
                         GameStateEngine.GetContext().SetStatus(EnumHostedGameStatus.Booted);
                     else
                         GameStateEngine.GetContext().SetStatus(GameStateEngine.GetContext().Game.Status);
                 });
             t.Start();
             break;
         case ConnectionState.Reconnecting:
             break;
         case ConnectionState.Disconnected:
             break;
     }
     ConnectionState = stateChange.NewState;
 }
 private async void _OnSignalRConnectionStateChanged(StateChange aStateChange)
 {
     if (aStateChange.NewState != ConnectionState.Connected)
     {
         await this.Logout();
     }
 }
 void HubConnection_StateChanged(StateChange obj)
 {
     logger.Debug("HubConnection_StateChanged New State:" + _hubConnection.State + " " + _hubConnection.ConnectionId);
 }
        void licenseClient_StateChanged(StateChange obj)
        {
            //서버 연결 상태에 따라서 결정 
            switch (obj.NewState)
            {
                case ConnectionState.Connected:
                    {
                        Dispatcher.BeginInvoke(delegate()
                        {
                            txtEventContent.Text
                               += "StateChanged 이벤트 발생 " + ConnectionState.Connected.ToString() + DateTime.UtcNow + "\n";
                           HubState.Fill = new SolidColorBrush(Colors.Blue);
                        });
                    }
                    break;
                case ConnectionState.Connecting:
                    {
                        Dispatcher.BeginInvoke(delegate()
                        {
                            txtEventContent.Text += "StateChanged 이벤트 발생 " + ConnectionState.Connecting.ToString() + DateTime.UtcNow + "\n";
                          HubState.Fill = new SolidColorBrush(Colors.Green);
                        });
                    }
                    break;
                case ConnectionState.Disconnected:
                    {
                        Dispatcher.BeginInvoke(delegate()
                        {
                            txtEventContent.Text += "StateChanged 이벤트 발생 " + ConnectionState.Disconnected.ToString() + DateTime.UtcNow + "\n";
                          HubState.Fill = new SolidColorBrush(Colors.Red);
                        });
                    }
                    break;
                case ConnectionState.Reconnecting:
                    {
                        Dispatcher.BeginInvoke(delegate()
                       {
                           txtEventContent.Text += "StateChanged 이벤트 발생 " + ConnectionState.Reconnecting.ToString() + DateTime.UtcNow + "\n";
                           HubState.Fill = new SolidColorBrush(Colors.Green);
                       });
                    }
                    break;
                default:
                    break;
            }

            System.Diagnostics.Debug.WriteLine(obj.NewState.ToString());
        }
Beispiel #22
0
 private void Connection_StateChanged(StateChange obj)
 {
     if(obj.NewState == ConnectionState.Connected)
     {
         Console.WriteLine("Connection_connected");
         modeControl.SetConnectionState(ConnecState.Connected);
         connection.Send(new ClientAuthPackage {
             Content = new AuthCommand
             {
                 Type = AuthCommandTypeConstants.PCLogin,
                 DeviceId = AppConfig.DeviceId
             }
         });
     }
     else if(obj.NewState == ConnectionState.Connecting)
     {
         Console.WriteLine("Connecting");
     }
     else if(obj.NewState == ConnectionState.Reconnecting)
     {
         Console.WriteLine("Reconnecting");
     }
 }
 private void ConnectionOnStateChanged(StateChange stateChange)
 {
     _log.Debug("Sos Online: " + stateChange.NewState);
     if (stateChange.NewState == ConnectionState.Connected)
         InvokeOnSosOnlineStatusChange("Connected");
     if (stateChange.NewState == ConnectionState.Disconnected)
         InvokeOnSosOnlineStatusChange("Disconnected");
     if (stateChange.NewState == ConnectionState.Reconnecting)
         InvokeOnSosOnlineStatusChange("Reconnecting");
     if (stateChange.NewState == ConnectionState.Connecting)
         InvokeOnSosOnlineStatusChange("Connecting");
 }
Beispiel #24
0
        private void Connection_StateChanged(StateChange obj)
        {
            if (obj.NewState == ConnectionState.Connected)
            {
                Console.WriteLine("Connection_connected");
                if(firstTimeConnected)
                {
                    CheckUpdateAsync();
                }
                firstTimeConnected = false;

                modeControl.SetConnectionState(ConnecState.Connected);
                connection.Send(new ClientAuthPackage
                {
                    Content = new AuthCommand
                    {
                        Type = AuthCommandTypeConstants.PCLogin,
                        DeviceId = AppConfig.DeviceId
                    }
                });
                if (LastDisconnectTime == null ||
                   DateTime.Now.Subtract(LastDisconnectTime.Value).TotalSeconds > 60)
                {
                    if(LastDisconnectTime != null)
                         log.Info("断线超过30秒后, 再连接进行资源更新");

                    AppData.DataProvider.LoadResourcesAsync();
                }
                LastDisconnectTime = null;
            }
            else if (obj.NewState == ConnectionState.Connecting)
            {
                Console.WriteLine("Connecting");
            }
            else if (obj.NewState == ConnectionState.Reconnecting)
            {
                Console.WriteLine("Reconnecting");
            }
        }
Beispiel #25
0
        /* Handle the connection state change */
        private void ReportChange(StateChange change)
        {
            // Set connected state
            _Connected = (change.NewState == ConnectionState.Connected);
    
            // If connected and not welcomed yet
            if (_Connected && !_Welcome)
            {
                // Set state
                _Welcome = true;

                // Add the welcome message
                AddConversationText(false, "How can I assist you?");
            }

            // Update the UI state
            UpdateState();
        }
        void connection_StateChanged(StateChange obj)
        {
            if (obj.NewState == ConnectionState.Connected)
            {
                App.Current.Dispatcher.Invoke(() =>
                {
                    if (signalRConnectionProgressBar.Visibility == Visibility.Visible)
                        signalRConnectionProgressBar.Visibility = Visibility.Hidden;

                    DisplayMessage("Listening for messages...",false);
                    Action.Content = "Stop";
                });

                signalrConnectionTimer.Stop();
                alreadyConnected = true;
                tracingStarted = true;
            }
        }
Beispiel #27
0
 private void Connection_StateChanged(StateChange state)
 {
     if (!!cts.IsCancellationRequested && !this.IsDisposed)
     {
         this.InvokeAction(() =>
         {
             this.tssl_ConnState.Text = "连接状态:" + state.NewState.AsZhConnectionState();
         });
         if (state.NewState == ConnectionState.Connected)
         {
             //Activate UI
             if (!this.InvokeRequired)
             {
                 ButtonSend.Enabled = true;
                 ButtonSend.Text = "消息测试";
                 ButtonSend.Click -= ButtonSend_Click;
                 ButtonSend.Click += ButtonSend_Click;
                 ButtonSend.Click -= ButtonConnect_Click;
                 TextBoxMessage.Focus();
             }
             else
             {
                 this.Invoke((Action)(() =>
                 {
                     ButtonSend.Enabled = true;
                     ButtonSend.Text = "消息测试";
                     ButtonSend.Click -= ButtonSend_Click;
                     ButtonSend.Click += ButtonSend_Click;
                     ButtonSend.Click -= ButtonConnect_Click;
                     TextBoxMessage.Focus();
                 }));
             }
         }
     }
 }
Beispiel #28
0
		void connection_StateChanged (StateChange state)
		{
			#if DEBUG
			Console.WriteLine (state.NewState.ToString ());
			#endif

			if (state.NewState == ConnectionState.Connected) {
				this.numTimes = 1;
				this.isConnectedSignalR = true;
			} else if (state.NewState == ConnectionState.Disconnected) {
				if (this.isConnectedSignalR && MApplication.getInstance().isLogedIn) {
					this.isConnectedSignalR = false;
					start (this.accessToken);
				}
			}
		}
Beispiel #29
0
 protected void ConnectionOnStateChanged(StateChange stateChange)
 {
     Log.InfoFormat("State Changed: {0}->{1}",stateChange.OldState,stateChange.NewState);
 }
Beispiel #30
0
 public virtual void OnConnectionStateChanged(Microsoft.AspNet.SignalR.Client.StateChange connectionstate)
 {
     ConnectionStateChanged(connectionstate);
 }
 private async void OnStatechange(StateChange obj)
 {
     await App.Debug.LogAsync(string.Format("State changed from {0} to {1}.", obj.OldState, obj.NewState));
 }
 private static void HubConnectionStateChanged(StateChange stateChange)
 {
     Console.WriteLine(
         "Hub connection's state has changed from oldstate: {0} to new state: {1}",
         stateChange.OldState,
         stateChange.NewState);
 }