Beispiel #1
0
        private void DoStop(bool stopHrm, bool notifyError)
        {
            if (stopHrm)
            {
                bundle.Device.Stop();
            }

            signalGenerator.Stop();

            if (AlarmTripped != null)
            {
                AlarmTripped(this, false);
            }

            if (networkRelay != null && networkRelay.Running)
            {
                networkRelay.Send(new HeartRateMessage(null, null, null));
            }

            if (logger != null && logger.Running)
            {
                logger.Stop();
            }

            if (Stopped != null)
            {
                Stopped(this);
            }

            if (StatusChanged != null)
            {
                StatusChanged(this, "Device stopped", notifyError);
            }
        }
Beispiel #2
0
        private void networkProvider_OnclientDisconnected(object sender, int clientId)
        {
#if DEBUG
            System.Diagnostics.Debug.WriteLine(clientId + " diconnected");
#endif

            try
            {
                SignalGenerator clientGenerator = generators[clientId];
                clientGenerator.ResetSubscriptions();
                clientGenerator.Stop();
                generators.Remove(clientId);
            }
            catch (KeyNotFoundException) { }

            try
            {
                if (NetworkStatusChenged != null)
                {
                    NetworkStatusChenged(this, nicknames[clientId] + " disconnected");
                }
            }
            catch (KeyNotFoundException) { }

            if (NetworkClientDisconnected != null)
            {
                NetworkClientDisconnected(this, clientId);
            }

            nicknames.Remove(clientId);
        }