private void Generator_FormClosing(object sender, FormClosingEventArgs e) { if (_sensor != null || _system != null) { _sensor.Stop(); _system.Disconnect(); _system.Dispose(); } }
/// <summary> /// 析构相机 /// </summary> public void Dispose() { try { if (system != null) { StopListen(); system.Dispose(); system = null; sensor = null; } } catch (Exception ex) { Console.WriteLine("DisposeCamera Error:" + ex.Message); } }
public bool Disconnect() { if (FrameworkExtenion.IsSimulate) { return(true); } if (sensor == null) { return(false); } if (EnableAccelerator) { //accelerator.Detach(sensor); //accelerator.Stop(); //accelerator.Dispose(); } try { //sensor.Disconnect(); //sensor.Dispose(); //sensor = null; system.Stop(); system.EnableData(false); system.Dispose(); system = null; } catch (Exception) { return(false); } return(true); }