Example #1
0
        private void OnEndpointConnectStatusReceived(object sender, ConnectionWorkerEventArgs e)
        {
            if (!e.Success)
            {
                // Update instance name to first default if no custom name was given
                Information.DisplayName = String.IsNullOrWhiteSpace(CustomName)
                    ? PossibleEndpoints.First().Hostname
                    : CustomName;
            }
            else
            {
                // Sometimes a racing condition will occur that the connector detects a connection, through the instance is now unmonitored.
                if (!_fsm.CanFire(Trigger.Connected))
                {
                    return;
                }

                // Update instance name to conneted endpoint, if no custom name was given
                Information.DisplayName = String.IsNullOrWhiteSpace(CustomName) ? e.RestEndpoint.Hostname : CustomName;

                // Set default rest client and connected endpoint to the available ones
                _restClient       = e.RestClient;
                ConnectedEndpoint = e.RestEndpoint;

                _fsm.Fire(Trigger.Connected);
            }
        }
        private void OnEndpointConnectStatusReceived(object sender, ConnectionWorkerEventArgs e)
        {
            if (!e.Success)
            {
                // Update instance name to first default if no custom name was given
                Information.DisplayName = String.IsNullOrWhiteSpace(CustomName)
                    ? PossibleEndpoints.First().Hostname
                    : CustomName;
            }
            else
            {
                // Sometimes a racing condition will occur that the connector detects a connection, through the instance is now unmonitored.
                if (!_fsm.CanFire(Trigger.Connected)) return;

                // Update instance name to conneted endpoint, if no custom name was given
                Information.DisplayName = String.IsNullOrWhiteSpace(CustomName) ? e.RestEndpoint.Hostname : CustomName;

                // Set default rest client and connected endpoint to the available ones
                _restClient = e.RestClient;
                ConnectedEndpoint = e.RestEndpoint;

                _fsm.Fire(Trigger.Connected);
            }
        }