private void SnapshotRetriever_CameraThumbnailProduced(object sender, CameraThumbnailProducedEventArgs e) { SnapshotRetriever retriever = sender as SnapshotRetriever; if (retriever != null) { retriever.CameraThumbnailProduced -= SnapshotRetriever_CameraThumbnailProduced; snapshotting.Remove(retriever.Identifier); } OnCameraThumbnailProduced(e); }
public override void GetSingleImage(CameraSummary summary) { if (snapshotting.IndexOf(summary.Identifier) >= 0) { return; } // Spawn a thread to get a snapshot. SnapshotRetriever retriever = new SnapshotRetriever(summary); retriever.CameraThumbnailProduced += SnapshotRetriever_CameraThumbnailProduced; snapshotting.Add(summary.Identifier); ThreadPool.QueueUserWorkItem(retriever.Run); }
public override void StartThumbnail(CameraSummary summary) { SnapshotRetriever snapper = snapshotting.FirstOrDefault(s => s.Identifier == summary.Identifier); if (snapper != null) { return; } snapper = new SnapshotRetriever(summary); snapper.CameraThumbnailProduced += SnapshotRetriever_CameraThumbnailProduced; snapshotting.Add(snapper); snapper.Start(); }
public void TestCamera() { if (testing) { return; } // Spawn a thread to get a snapshot. testing = true; CameraSummary testSummary = GetResult(); SnapshotRetriever retriever = new SnapshotRetriever(testSummary); retriever.CameraThumbnailProduced += SnapshotRetriever_CameraThumbnailProduced; ThreadPool.QueueUserWorkItem(retriever.Run); }
public override void StopAllThumbnails() { for (int i = snapshotting.Count - 1; i >= 0; i--) { SnapshotRetriever snapper = snapshotting[i]; snapper.Cancel(); snapper.Thread.Join(500); if (snapper.Thread.IsAlive) { snapper.Thread.Abort(); } snapper.CameraThumbnailProduced -= SnapshotRetriever_CameraThumbnailProduced; snapshotting.RemoveAt(i); } }
private void SnapshotRetriever_CameraThumbnailProduced(object sender, CameraThumbnailProducedEventArgs e) { SnapshotRetriever retriever = sender as SnapshotRetriever; if (retriever == null) { return; } FormHandshakeResult result = new FormHandshakeResult(e.Thumbnail); result.ShowDialog(); result.Dispose(); e.Thumbnail.Dispose(); AfterCameraTest(retriever); }
private void ProcessThumbnail(object sender, CameraThumbnailProducedEventArgs e) { SnapshotRetriever snapper = sender as SnapshotRetriever; if (snapper == null) { return; } log.DebugFormat("Received thumbnail event for {0}. Cancelled: {1}.", snapper.Alias, e.Cancelled); snapper.CameraThumbnailProduced -= SnapshotRetriever_CameraThumbnailProduced; if (snapshotting.Contains(snapper)) { snapshotting.Remove(snapper); } OnCameraThumbnailProduced(e); }
private void AfterCameraTest(SnapshotRetriever retriever) { retriever.CameraThumbnailProduced -= SnapshotRetriever_CameraThumbnailProduced; testing = false; }