private void Window_Closed(object sender, EventArgs e) { if (_sensor.State == GoState.Running) { _system.Stop(); //_syncContext.Post(delegate { UpdateMsg("System Stopped"); }, null); _system.Disconnect(); } }
private void Generator_FormClosing(object sender, FormClosingEventArgs e) { if (_sensor != null || _system != null) { _sensor.Stop(); _system.Disconnect(); _system.Dispose(); } }