Esempio n. 1
0
 private void Generator_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (_sensor != null || _system != null)
     {
         _sensor.Stop();
         _system.Disconnect();
         _system.Dispose();
     }
 }
Esempio n. 2
0
 /// <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);
     }
 }
Esempio n. 3
0
        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);
        }