예제 #1
0
        private void RunTimer()
        {
            int timeCount = 0;
            int i;

            DateTime[] startTime = null;
            DateTime[] stopTime  = null;
            DateTime   timeNow;
            string     capturePath;

            Invoke((MethodInvoker) delegate() {
                timeCount = lvwTimes.Items.Count;
                startTime = new DateTime[timeCount];
                stopTime  = new DateTime[timeCount];

                for (i = 0; i < timeCount; i++)
                {
                    ListViewItem item = lvwTimes.Items[i];
                    startTime[i]      = (DateTime)item.SubItems[0].Tag;
                    stopTime[i]       = (DateTime)item.SubItems[1].Tag;
                }
            });

            while (_timerEnabled)
            {
                if (FindCaptureWindow())
                {
                    timeNow = DateTime.Now;
                    for (i = 0; i < timeCount; i++)
                    {
                        if ((timeNow >= startTime[i]) && (timeNow < stopTime[i]))
                        {
                            capturePath = VDCapture.GetCapturePath();

                            if (!VDCapture.IsCapturing())
                            {
                                NumberFile(capturePath);
                                VDCapture.StartCapture();
                            }

                            while (DateTime.Now < stopTime[i])
                            {
                                if (!_timerEnabled)
                                {
                                    return;
                                }
                                Thread.Sleep(100);
                                FindCaptureWindow();
                            }

                            VDCapture.StopCapture();
                            NumberFile(capturePath);
                        }
                    }
                }

                Thread.Sleep(100);
            }
        }
예제 #2
0
        private bool FindCaptureWindow()
        {
            bool found = VDCapture.FindCaptureWindow();

            BeginInvoke((MethodInvoker) delegate() {
                lblCaptureWindowFound.Text = found ? "Yes" : "No";
            });

            return(found);
        }