protected void ServiceMain() { eventLog1.WriteEntry("creating vg1"); vg1 = new VideoGrabber(); eventLog1.WriteEntry(vg1.Version); vg1.StoragePath = System.IO.Path.GetTempPath(); vg1.TextOverlay_Enabled = true; vg1.TextOverlay_String = "system date/time: %sys_time[dd/mm/yy hh:nn:ss]%"; eventLog1.WriteEntry("starting vg1 " + vg1.Version); vg1.StartPreview(); if (vg1.GraphState() == VidGrabNoForm.TGraphState.gs_Running) { eventLog1.WriteEntry("vg1 started on capture device " + vg1.VideoDeviceName); ThreadLoop(); vg1.StopPreview(); } else { eventLog1.WriteEntry("failed to start vg1"); } eventLog1.WriteEntry("stopping vg1"); eventLog1.WriteEntry("destroying vg1"); vg1.Dispose(); }
public void EndWriting() { isRunning = false; if (captureSound != null) { try { captureSound.Stop(); } catch (Exception) { } } if (videoGrabber != null) { try { videoGrabber.EndGrabber(); videoGrabber.Dispose(); } catch (Exception) { } } }