示例#1
0
 /// <summary>
 /// 关闭驱动
 /// </summary>
 public void CloseDevice()
 {
     timerAi.Enabled  = false;
     timerDi.Enabled  = false;
     timerCnt.Enabled = false;
     waveformAiCtrlUsb4704.Dispose();
     instantDiCtrlUsb4704.Dispose();
     instantDoCtrlUsb4704.Dispose();
     eventCounterCtrlUsb4704.Dispose();
     instantAoCtrlUsb4704.Dispose();
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="disposing"></param>
 /// <remarks>
 /// Dispose(bool disposing) executes in two distinct scenarios.
 /// If disposing equals true, the method has been called directly
 /// or indirectly by a user's code. Managed and unmanaged resources
 /// can be disposed.
 /// If disposing equals false, the method has been called by the
 /// runtime from inside the finalizer and you should not reference
 /// other objects. Only unmanaged resources can be disposed.
 /// </remarks>
 private void Dispose(bool disposing)
 {
     // Check to see if Dispose has already been called.
     if (_disposed)
     {
         return;
     }
     // If disposing equals true, dispose all managed and unmanaged resources.
     if (disposing)
     {
         // Dispose managed resources.
         // Step 4: Close device and release any allocated resource.
         InstantAiContrl.Dispose();
         InstantAoContrl.Dispose();
         InstantDiCtrl.Dispose();
         InstantDoCtrl.Dispose();
         _baseDioCtrl.Dispose();
     }
     // Dispose native ( unmanaged ) resources, if exits
     // Note disposing has been done.
     _disposed = true;
 }