Exemplo n.º 1
0
    private void OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
    {
        if (e.State == ConnectionState.Connected)
        {
            _isConnected = true;

            // commit the snapshot with the global interactor as soon as the connection to the engine is established.
            // (it cannot be done earlier because committing means "send to the engine".)
            CommitAllGlobalInteractors();

            _screenBoundsStateAccessor.OnConnected(_context);
            _displaySizeStateAccessor.OnConnected(_context);
            _eyeTrackingDeviceStatusStateAccessor.OnConnected(_context);
            _userPresenceStateAccessor.OnConnected(_context);
        }
        else
        {
            _isConnected = false;

            _screenBoundsStateAccessor.OnDisconnected();
            _displaySizeStateAccessor.OnDisconnected();
            _eyeTrackingDeviceStatusStateAccessor.OnDisconnected();
            _userPresenceStateAccessor.OnDisconnected();
        }
    }
Exemplo n.º 2
0
        /// <summary>
        /// Handles a connection-state-changed notification from the EyeX Engine.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">Event parameters.</param>
        protected virtual void OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            Debug.WriteLine("The connection state is now {0}.", e.State);

            if (e.State == ConnectionState.Connected)
            {
                // Send a snapshot including all data streams, now that the connection
                // to the EyeX Engine is established.
                SendDataStreamSnapshot();

                _screenBoundsStateAccessor.OnConnected(_context);
                _displaySizeStateAccessor.OnConnected(_context);
                _eyeTrackingDeviceStatusStateAccessor.OnConnected(_context);
                _userPresenceStateAccessor.OnConnected(_context);
                _userProfileNameStateAccessor.OnConnected(_context);
                _userProfilesStateAccessor.OnConnected(_context);
                _gazeTracking.OnConnected(_context);

                _connected.Set();
            }
            else
            {
                _screenBoundsStateAccessor.OnDisconnected();
                _displaySizeStateAccessor.OnDisconnected();
                _eyeTrackingDeviceStatusStateAccessor.OnDisconnected();
                _userPresenceStateAccessor.OnDisconnected();
                _userProfileNameStateAccessor.OnDisconnected();
                _userProfilesStateAccessor.OnDisconnected();
                _gazeTracking.OnDisconnected();

                _connected.Reset();
            }
        }
Exemplo n.º 3
0
        private static void client_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            var client = (SmppClient)sender;

            Console.WriteLine("SMPP client {1} - State {1}", client.Name, e.CurrentState);

            switch (e.CurrentState)
            {
            case SmppConnectionState.Closed:
                //Connection to the remote server is lost
                //Do something here
            {
                Console.WriteLine("SMPP client {0} - CLOSED", client.Name);
                e.ReconnectInteval = _smppConfig.ReconnectInteval;         //Try to reconnect after Interval in seconds
                break;
            }

            case SmppConnectionState.Connected:
                //A successful connection has been established
                Console.WriteLine("SMPP client {0} - CONNECTED", client.Name);
                break;

            case SmppConnectionState.Connecting:
                //A connection attemp is still on progress
                Console.WriteLine("SMPP client {0} - CONNECTING", client.Name);
                break;
            }
        }
Exemplo n.º 4
0
 public static void ConnectionStateChangedEventHandler(
     object sender,
     ConnectionStateChangedEventArgs e)
 {
     ConsoleUtilities.WriteToConsole(
         string.Format("Connect state changed: {0}", e.ConnectionState),
         Constants.DateTimeFormatIso8601);
 }
 private void NeuronService_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
 {
     UiDispatcher.BeginInvokeOnMainThread(() =>
     {
         SetConnectionStateAndText(e.State);
         RegisterCommand.ChangeCanExecute();
     });
 }
Exemplo n.º 6
0
        private void Client_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            _connected = e.IsConnected;

            UpdateButtons();

            AppendMessage(lblConnectedStatus.Text, false, true);
        }
Exemplo n.º 7
0
        protected override void ServerManager_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            base.ServerManager_ConnectionStateChanged(sender, e);

            if (e.State == ServerConnectionState.Connected)
            {
                ThreadUtility.RunOnUIThread(UpdateCurrentDatabase);
            }
        }
Exemplo n.º 8
0
 private void OnConnectionStateChanged(ConnectionStateChangedEventArgs eventArgs)
 {
     if (eventArgs.HasFault) {
         this.view.TransitionToAccountEntryState();
         this.view.ShowError("There was an error connecting to the stock trading service. Please make sure that you are connected to the Internet or try again later.");
     } else if (eventArgs.IsConnected) {
         this.onConnectionStateChangedEventSubscription.Dispose();
     }
 }
Exemplo n.º 9
0
        protected virtual void OnConnectionStateChanged(ConnectionStateChangedEventArgs eventArgs)
        {
            // Copy to temp to be thread safe.
            var temp = ConnectionStateChanged;

            if (temp != null)
            {
                temp(this, eventArgs);
            }
        }
Exemplo n.º 10
0
 private void PlcOnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
 {
     Debug.WriteLine($"Client connection state was {e.OldState} and is now {e.NewState} because of {e.Reason}");
     if (e.NewState == ConnectionState.Connected)
     {
         return;
     }
     PlcConnected = false;
     UpdateDumpStatus("PLC state: Disconnected", Colors.Red);
 }
Exemplo n.º 11
0
 private void NeuronService_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
 {
     this.uiDispatcher.BeginInvokeOnMainThread(() =>
     {
         this.ConnectionStateText = e.State.ToDisplayText(this.tagProfile.Domain);
         this.IsConnected         = e.State == XmppState.Connected;
         this.UserIsLoggedOut     = this.neuronService.IsLoggedOut;
         this.UpdateLogInLogOutMenuItem();
     });
 }
Exemplo n.º 12
0
 private async void OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
 {
     await Dispatcher.Invoke(() =>
     {
         return(e.NewState switch
         {
             ConnectionStateType.Connected => ShowConnectionFailedGrid(false),
             ConnectionStateType.Disconnected => ShowConnectionFailedGrid(true),
             _ => Task.CompletedTask,
         });
     }).ConfigureAwait(true);
Exemplo n.º 13
0
 void _client_OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
 {
     this.Invoke((MethodInvoker) delegate
     {
         if (!loggedout)
         {
             tbxLog.AppendText(string.Format("The connectionstate changed, the client is {0} connected and {1} logged in\r\n", e.Connected ? "" : "not", e.LoggedIn ? "" : "not"));
             loggedout = true;
         }
     });
 }
        private async void Contracts_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            if (this.neuronService.IsOnline && this.neuronService.Contracts.IsOnline && e.State == XmppState.Connected)
            {
                if (!(this.tagProfile.LegalIdentity is null) && this.tagProfile.IsCompleteOrWaitingForValidation())
                {
                    string id = this.tagProfile.LegalIdentity.Id;
                    await Task.Delay(Constants.Timeouts.XmppInit);

                    DownloadLegalIdentityInternal(id);
                }
            }
        }
Exemplo n.º 15
0
        private void OnConnectionDispatch(object sender, ConnectionStateChangedEventArgs e)
        {
            if (thread != null)
            {
                //Stop current dispatching
                thread.Stop();
                thread.Join(25000);
            }

            if (e.CurrentState == ConnectionState.Online)
            {
                DispatchAllPendingRequests();
            }
        }
Exemplo n.º 16
0
 private void BluetoothLEService_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
 {
     if (e.NewStatus == ProfileState.Disconnected && _bluetoothLEService != null)
     {
         _bluetoothLEService.CharacteristicNotificationReceived -= BluetoothLEService_CharacteristicNotificationReceived;
         _bluetoothLEService = null;
         SetControlsEnabled(false);
         RunOnUiThread(() =>
         {
             _retryConnectButton.Visibility = ViewStates.Visible;
             _retryConnectButton.Enabled    = true;
         });
         ShowAlert("Bluetooth Disconnected", "Device has disconnected or lost connection. Reconnect and try again.");
     }
 }
Exemplo n.º 17
0
        void _cardClient_OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            GSClient client = (GSClient)sender;

            tbxLog.AppendText(string.Format("The connectionstate of CardServer-Client changed, the client is {0} connected and {1} logged in\r\n", client.Connected ? "" : "not", client.LoggedIn ? "" : "not"));

            if (e.Connected && !e.LoggedIn)
            {
                client.Login();
            }
            else if (e.Connected && e.LoggedIn)
            {
                client.JoinRoom();
            }
        }
Exemplo n.º 18
0
 public void Monitor_ConnectionStateChangedHandler(object sender, ConnectionStateChangedEventArgs e)
 {
     //Realizar acción correspondiente según el estado al que cambia la conexión
     if (e.IsConnected)
     {
         //Conectado
         clsUtil.online = true;
         ActualizarEstado();
     }
     else
     {
         //Desconectado
         clsUtil.online = false;
     }
     ActualizarEstado();
 }
Exemplo n.º 19
0
        private void OnConnectionStateChanged(ConnectionStateChangedEventArgs eventArgs)
        {
            if (eventArgs.IsConnected) {
                this.onConnectionStateChangedEventSubscription.Dispose();
                this.onConnectionStateChangedEventSubscription = null;

                var shellPresenter = this.container.Resolve<ShellPresenter>();
                this.regionManager.AddToRegion(RegionNames.MainRegion, shellPresenter.View);

                var balancePresenter = this.container.Resolve<BalancePresenter>();
                this.regionManager.AddToRegion(RegionNames.BalanceRegion, balancePresenter.View);

                var stocksPresenter = this.container.Resolve<StocksPresenter>();
                this.regionManager.AddToRegion(RegionNames.StocksRegion, stocksPresenter.View);

                var historyPresenter = this.container.Resolve<HistoryPresenter>();
                this.regionManager.AddToRegion(RegionNames.HistoryRegion, historyPresenter.View);
            }
        }
Exemplo n.º 20
0
        //Changes in conection
        private void client_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            switch (e.CurrentState)
            {
            case SmppConnectionState.Closed:
                //Connection to the remote server is lost
                //Do something here
                Library.WriteErrorLog("Connection to the remote server is lost");
                e.ReconnectInteval = 60000;     //Try to reconnect after 1 min
                attempts           = attempts + 1;
                if (attempts >= 3)
                {
                    client.Shutdown();
                    timer1.Enabled = false;
                    Library.WriteErrorLog("Service Stopped");
                }
                break;

            case SmppConnectionState.Connected:
                //A successful connection has been established
                Library.WriteErrorLog("Connection SMPP Client (" + client.Properties.SystemID + ") Started");
                timer1 = new Timer();
                this.timer1.Interval = 20000;     //20 segundos
                this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer_connection);
                timer1.Enabled       = true;

                //Sending Messages
                msg.DestinationAddress = numReceipient;  //Receipient number
                msg.SourceAddress      = numOriginating; //Originating number
                msg.Text = textMessage;
                msg.RegisterDeliveryNotification = true; //I want delivery notification for this message

                client.SendMessage(msg, 1000);
                Library.WriteErrorLog("Message Sent Successfully! Receipient number:" + numReceipient + "Message:" + textMessage);

                break;

            case SmppConnectionState.Connecting:
                //A connection attemp is still on progress
                Library.WriteErrorLog("A connection attemp is still on progress");
                break;
            }
        }
Exemplo n.º 21
0
        private void Connection_ConnectionStateChanged(AbstractConnection sender, ConnectionStateChangedEventArgs args)
        {
            if (args.newState == ConnectionState.CONNECTED)
            {
                connectDisconnectTCS?.TrySetResult(true);
                Logger.Info("Connected to account: " + getXMPPAccount().getBareJid());
            }
            else if (args.newState == ConnectionState.DISCONNECTED)
            {
                connectDisconnectTCS?.TrySetResult(false);
                Logger.Info("Disconnected account: " + getXMPPAccount().getBareJid());
            }
            else if (args.newState == ConnectionState.ERROR)
            {
                connectDisconnectTCS?.TrySetResult(false);
            }

            ConnectionStateChanged?.Invoke(this, args);
        }
Exemplo n.º 22
0
        private void client_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            switch (e.CurrentState)
            {
            case SmppConnectionState.Closed:
                //Connection to the remote server is lost
                //Do something here
                e.ReconnectInteval = 60000;     //Try to reconnect after 1 min
                break;

            case SmppConnectionState.Connected:
                //A successful connection has been established
                Enable_Button();
                break;

            case SmppConnectionState.Connecting:
                //A connection attemp is still on progress
                break;
            }
        }
Exemplo n.º 23
0
 public void Monitor_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
 {
     try
     {
         this.Invoke(new EventHandler<ConnectionStateChangedEventArgs>(Monitor_ConnectionStateChangedHandler), sender, e);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Monitor_ConnectionState: " + ex.Message,
                         clsUtil.TituloAviso,
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation,
                         MessageBoxDefaultButton.Button1);
     }
 }
        private void SessionOnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            try
            {
                // Initialize things on UP
                if (_session.ConnectionState == ConnectionState.Up)
                {
                    Context.Send(s =>
                    {
                        ConfigManager.Save(ConfigData);
                        StatusText = "Connected to " + _session.ICServer;
                    }, null);
                    _userConfigurationList = new UserConfigurationList(ConfigurationManager.GetInstance(_session));
                }
                else
                {
                    Context.Send(s => StatusText = _session.ConnectionStateMessage, null);
                }

                // Save states
                Context.Send(s =>
                {
                    IsConnected = _session.ConnectionState == ConnectionState.Up;
                    IsConnecting = _session.ConnectionState == ConnectionState.Attempting;
                    ConnectionStateMessage = _session.ConnectionStateMessage;
                }, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// Handles a connection-state-changed notification from the EyeX Engine.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">Event parameters.</param>
        protected virtual void OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            Debug.WriteLine("The connection state is now {0}.", e.State);

            if (e.State == ConnectionState.Connected)
            {
                // Send a snapshot including all data streams, now that the connection
                // to the EyeX Engine is established.
                SendDataStreamSnapshot();

                _screenBoundsStateAccessor.OnConnected(_context);
                _displaySizeStateAccessor.OnConnected(_context);
                _eyeTrackingDeviceStatusStateAccessor.OnConnected(_context);
                _userPresenceStateAccessor.OnConnected(_context);
                _userProfileNameStateAccessor.OnConnected(_context);
                _userProfilesStateAccessor.OnConnected(_context);
                _gazeTracking.OnConnected(_context);

                _connected.Set();
            }
            else
            {
                _screenBoundsStateAccessor.OnDisconnected();
                _displaySizeStateAccessor.OnDisconnected();
                _eyeTrackingDeviceStatusStateAccessor.OnDisconnected();
                _userPresenceStateAccessor.OnDisconnected();
                _userProfileNameStateAccessor.OnDisconnected();
                _userProfilesStateAccessor.OnDisconnected();
                _gazeTracking.OnDisconnected();

                _connected.Reset();
            }
        }
Exemplo n.º 26
0
    private void OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
    {
        Console.WriteLine("The connection state is now {0}.", e.State);

        if (e.State == ConnectionState.Connected)
        {
            _isConnected = true;

            if (_globalInteractors.Count == 0) return;

            // commit the snapshot with the global interactor as soon as the connection to the engine is established.
            // (it cannot be done earlier because committing means "send to the engine".)
            // make a copy of the collection of interactors to avoid race conditions.
            List<EyeXGlobalInteractor> globalInteractorsCopy;
            lock (_lock)
            {
                globalInteractorsCopy = new List<EyeXGlobalInteractor>(_globalInteractors.Values);
            }

            CommitGlobalInteractors(globalInteractorsCopy);
        }
        else
        {
            _isConnected = false;
        }
    }
Exemplo n.º 27
0
 void ICSession_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs args)
 {
     LoggedIn = args.State == ConnectionState.Up;
 }
 private void OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
 {
     PostToWebService();
 }