コード例 #1
0
ファイル: frmImaging.cs プロジェクト: mtodman/Nite-Opps
        public void takeAnImage(bool arg)
        {
            if (InvokeRequired)
            {
                this.Invoke(new Action <bool>(takeAnImage), new object[] { arg });
                return;
            }

            if (!sd.isImagingCamConnected)
            {
                MessageBox.Show("Can't begin exposure. The Imaging camera is not connected");
                return;
            }
            form.ImagingForm.btnStart.Enabled      = false;
            form.ImagingForm.btnAbort.Enabled      = true;
            form.ImagingForm.btnStop.Enabled       = true;
            form.ImagingForm.chkAutoRepeat.Enabled = false;

            readCameraValues();
            readImageInfo();
            Int32 total_duration_msecs = (imagingCamExposureDurationMs + (imagingCamExposureDurationSecs * 1000) + (imagingCamExposureDurationMins * 1000 * 60));

            if (total_duration_msecs == 0)
            {
                total_duration_msecs = 1;                            //1ms is assumed to be a 0 length exposure
            }
            total_duration_secs = total_duration_msecs / 1000.0;
            maxTime             = (int)total_duration_secs;
            maxTimeMS           = total_duration_msecs;
            var d = new maxtime
            {
                MAXTIME = maxTime,
            };
            Thread progressBarThread = new System.Threading.Thread(t_progressbar);

            progressBarThread.Start(d);

            sd.ImagingCam.takeTheImage(imagingCamBinning, imagingCamFrameType, total_duration_secs);


            if (chkAutoRepeat.Checked)
            {
                if (!isAutoRepeat)
                {
                    isAutoRepeat = true;
                    Thread autoRepeatThread = new System.Threading.Thread(t_autoRepeat);
                    autoRepeatThread.Start();
                }
            }
        }
コード例 #2
0
ファイル: frmImaging.cs プロジェクト: mtodman/Nite-Opps
        private void t_progressbar(object x)
        {
            maxtime d = (maxtime)x;

            if (InvokeRequired)
            {
                this.Invoke(new Action <object>(t_progressbar), new object[] { x });
                return;
            }

            startTime            = DateTime.Now;
            endTime              = startTime.AddMilliseconds(maxTimeMS);
            progressBar1.Maximum = (int)maxTimeMS;

            progressBar1.Minimum = 0;
            progressbarTimer.Start();
        }