Пример #1
0
        public void EditConnection(int selectedIndex, Action <int> openWizard)
        {
            if (selectedIndex != -1 && selectedIndex <= Servers.Count)
            {
                var selectedServer   = Servers[selectedIndex];
                var environmentModel = selectedServer.Server;
                if (environmentModel?.Connection != null)
                {
                    var serverUri = environmentModel.Connection.AppServerUri;
                    var auth      = environmentModel.Connection.AuthenticationType;
                    openWizard?.Invoke(selectedIndex);
                    var updatedServer = _serverRepository.All().FirstOrDefault(e => e.EnvironmentID == environmentModel.EnvironmentID);
                    if (updatedServer != null && (!serverUri.Equals(updatedServer.Connection.AppServerUri) || auth != updatedServer.Connection.AuthenticationType))
                    {
                        ConnectedStatusChanged?.Invoke(this, new ConnectionStatusChangedEventArg(ConnectionEnumerations.ConnectedState.Busy, environmentModel.EnvironmentID, false));

                        selectedServer.Server = updatedServer;
                    }
                }
            }
        }
Пример #2
0
        public void OnTelemetryNotification(int vehicleId, List <Telemetry> telemetryList)
        {
            var linkTelemetry = telemetryList.Where(t => t.TelemetryField.Code == DownlinkPresentTelemetryCode);

            foreach (var telemetry in linkTelemetry)
            {
                var connected = telemetry.Value?.BoolValue ?? false;

                if (connected)
                {
                    _connectedVehicleIds.Add(vehicleId);
                }
                else
                {
                    _connectedVehicleIds.Remove(vehicleId);
                }
                ConnectedStatusChanged?.Invoke(this, new ConnectedStatusChangedEventArgs()
                {
                    VehicleId = vehicleId, IsConnected = connected
                });
            }
        }
Пример #3
0
        private bool Connect()
        {
            Dispose();
            _callingThread = Thread.CurrentThread;

            this.Connected = false;
            ConnectedStatusChanged?.Invoke();

            _balObject = GetFirstAvailableCanObject();

            if (_balObject == null)
            {
                return(false);
            }

            Setup();
            StartChannels();

            this.Connected = true;
            ConnectedStatusChanged?.Invoke();

            return(true);
        }
Пример #4
0
        void Connect(IConnectControlEnvironment selectedServer)
        {
            var environmentId = selectedServer.Server.EnvironmentID;

            ConnectedStatusChanged?.Invoke(this, new ConnectionStatusChangedEventArg(ConnectionEnumerations.ConnectedState.Busy, environmentId, false));
        }
Пример #5
0
 void Disconnect(IServer environment)
 {
     ConnectedStatusChanged?.Invoke(this, new ConnectionStatusChangedEventArg(ConnectionEnumerations.ConnectedState.Busy, environment.EnvironmentID, false));
     ConnectedStatusChanged?.Invoke(this, new ConnectionStatusChangedEventArg(ConnectionEnumerations.ConnectedState.Disconnected, environment.EnvironmentID, true));
 }
Пример #6
0
 public void SetConnectionState(Guid environmentId, ConnectionEnumerations.ConnectedState connectedState)
 {
     ConnectedStatusChanged?.Invoke(this, new ConnectionStatusChangedEventArg(connectedState, environmentId, false));
 }