コード例 #1
0
        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;
        }
コード例 #2
0
        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
        }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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
        }
コード例 #7
0
 public MyDcamProp(MyDcam mydcam, DCAMIDPROP _iprop)
 {
     m_hdcam  = mydcam.m_hdcam;
     m_idProp = _iprop;
     m_attr   = new DCAMPROP_ATTR(m_idProp);
 }