public void Stop() { if (visionTimer != null) { visionTimer.Stop(); visionTimer = null; } if (wCam != null) { wCam.Dispose(); wCam = null; } }
public void Start(IntPtr parentHandle, int captureWidth, int captureHeight, bool previewVisible, int posx, int posy, int displayWidth, int displayHeight, int deviceID = 0) { if (wCam == null) { wCam = new WebCam(); wCam.OpenConnection(parentHandle, captureWidth, captureHeight, previewVisible, posx, posy, displayWidth, displayHeight, deviceID); //visionTimer = new DispatcherTimer(); //Note: for WPF maybe should use a DispatchTimer instead //visionTimer.Interval = new TimeSpan(0,0,0,0,200); //200 msec visionTimer = new Timer(); visionTimer.Interval = 200; //msec visionTimer.Tick += visionTimer_Tick; visionTimer.Start(); } else { Stop(); } }