void DisconnectMonitor() { statusLabel.Text = "Not connected"; heartRateLabel.Text = "0"; heartRateLabel.Hidden = true; heartRateUnitLabel.Hidden = true; deviceNameLabel.Text = String.Empty; deviceNameLabel.Hidden = true; if (monitor != null) { monitor.Dispose(); monitor = null; } }
void DisconnectMonitor() { statusLabel.StringValue = "Not connected"; heartRateLabel.IntValue = 0; heartRateLabel.Hidden = true; heartRateUnitLabel.Hidden = true; rssiLabel.Hidden = true; deviceNameLabel.StringValue = String.Empty; deviceNameLabel.Hidden = true; disconnectButton.Hidden = true; if (connectedMonitor != null) { connectedMonitor.HeartBeat -= OnHeartBeat; connectedMonitor.HeartRateUpdated -= OnHeartRateUpdated; connectedMonitor.RssiUpdated -= OnRssiUpdated; connectedMonitor.NameUpdated -= OnNameUpdated; connectedMonitor.Dispose(); connectedMonitor = null; } }