private void startCapture() { try { long payloadSize; AVT.VmbAPINET.Frame[] frameArray = new AVT.VmbAPINET.Frame[3]; sc.OnFrameReceived += new Camera.OnFrameReceivedHandler(onFrameReceived); feature = features["PayloadSize"]; payloadSize = feature.IntValue; for (int index = 0; index < frameArray.Length; ++index) { frameArray[index] = new AVT.VmbAPINET.Frame(payloadSize); sc.AnnounceFrame(frameArray[index]); } sc.StartCapture(); for (int index = 0; index < frameArray.Length; ++index) { sc.QueueFrame(frameArray[index]); } feature = features["AcquisitionMode"]; feature.EnumValue = "Continuous"; feature = features["AcquisitionStart"]; feature.RunCommand(); } catch (VimbaException ve) { MessageBox.Show("An error occured: " + ve.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void onFrameReceived(AVT.VmbAPINET.Frame frame) { //if (InvokeRequired) // if not from this thread invoke it in our context //{ // In case of a separate thread (e.g. GUI ) use BeginInvoke to avoid a deadlock Dispatcher.Invoke(new Camera.OnFrameReceivedHandler(onFrameReceived), frame); //} if (VmbFrameStatusType.VmbFrameStatusComplete == frame.ReceiveStatus) { Console.WriteLine("Frame status complete"); } sc.QueueFrame(frame); }