private void PushOpen_Click(object sender, EventArgs e) { if (mydcam != null) { MyShowStatus("Internal Error: mydcam is already set"); MyFormStatus_Initialized(); // FormStatus should be Initialized. return; // internal error } // dcamdev_open() may takes for a few seconds Cursor.Current = Cursors.WaitCursor; MyDcam aMyDcam = new MyDcam(); if (!aMyDcam.dev_open(m_indexCamera)) { MyShowStatusNG("dcamdev_open()", aMyDcam.m_lasterr); aMyDcam = null; Cursor.Current = Cursors.Default; return; // Fail: dcamdev_open() } // Success: dcamdev_open() mydcam = aMyDcam; // store MyDcam instance MyShowStatusOK("dcamdev_open()"); MyFormStatus_Opened(); // change dialog FormStatus to Opened Cursor.Current = Cursors.Default; }
public MyDcamWait(ref MyDcam mydcam) { if (mydcam.m_hdcam == IntPtr.Zero) { // mydcam should have valid HDCAM handle. m_lasterr = DCAMERR.INVALIDHANDLE; m_hwait = IntPtr.Zero; } else { DCAMWAIT_OPEN param = new DCAMWAIT_OPEN(0); param.hdcam = mydcam.m_hdcam; m_lasterr = dcamwait.open(ref param); if (!m_lasterr.failed()) { m_hwait = param.hwait; m_supportevent = param.supportevent; } else { m_hwait = IntPtr.Zero; m_supportevent = 0; } } m_timeout = 1000; // 1 second }
void add_info(ref List <datainfo> listinfo, ref MyDcam mydcam, DCAMIDSTR idstr, string strkind) { string strvalue = mydcam.dev_getstring(idstr); if (strvalue.Length > 0) { listinfo.Add(new datainfo(strkind, strvalue)); } }
public void set_mydcam(ref MyDcam mydcam) { // update DataSource of DataGridView List <dataprop> listprop = new List <dataprop>(); MyDcamProp myprop = new MyDcamProp(mydcam, DCAMIDPROP.ZERO); while (myprop.nextid()) { listprop.Add(new dataprop(myprop.Clone())); } DataGridViewProp.DataSource = listprop; }
public void set_mydcam(ref MyDcam mydcam) { // update DataSource of DataGridView List <datainfo> listinfo = new List <datainfo>(); if (mydcam != null) { add_info(ref listinfo, ref mydcam, DCAMIDSTR.BUS, "BUS"); add_info(ref listinfo, ref mydcam, DCAMIDSTR.CAMERAID, "CAMERAID"); add_info(ref listinfo, ref mydcam, DCAMIDSTR.VENDOR, "VENDOR"); add_info(ref listinfo, ref mydcam, DCAMIDSTR.MODEL, "MODEL"); add_info(ref listinfo, ref mydcam, DCAMIDSTR.CAMERAVERSION, "CAMERA VERSION"); add_info(ref listinfo, ref mydcam, DCAMIDSTR.DRIVERVERSION, "DRIVER VERSION"); add_info(ref listinfo, ref mydcam, DCAMIDSTR.MODULEVERSION, "MODULE VERSION"); add_info(ref listinfo, ref mydcam, DCAMIDSTR.DCAMAPIVERSION, "DCAM-API VERSION"); add_info(ref listinfo, ref mydcam, DCAMIDSTR.CAMERA_SERIESNAME, "SERIES NAME"); } DataGridViewInfo.DataSource = listinfo; }
private void PushClose_Click(object sender, EventArgs e) { if (mydcam == null) { MyShowStatus("Internal Error: mydcam is null"); MyFormStatus_Initialized(); // FormStatus should be Initialized. return; // internal error } MyThreadCapture_Abort(); // abort capturing thread if exist if (!mydcam.dev_close()) { MyShowStatusNG("dcamdev_close()", mydcam.m_lasterr); return; // Fail: dcamdev_close() } // Success: dcamdev_close() mydcam = null; MyShowStatusOK("dcamdev_close()"); MyFormStatus_Initialized(); // change dialog FormStatus to Initialized }
public MyDcamProp(MyDcam mydcam, DCAMIDPROP _iprop) { m_hdcam = mydcam.m_hdcam; m_idProp = _iprop; m_attr = new DCAMPROP_ATTR(m_idProp); }