コード例 #1
0
ファイル: ContinuousCapture.cs プロジェクト: bzyk72/Shiretii
        public ContinuousCapture()
        {
            InitializeCameras();

            InitializeTimer();

            picturesFolder = new AppSettingsQuery().GetAppSettingByKey(QueryConstants.AppSettingsKey_PicturesSavePath);
        }
コード例 #2
0
ファイル: CaptureImage.cs プロジェクト: bzyk72/Shiretii
        /// <summary>
        /// Gets the path and file name where to save the picture
        /// </summary>
        /// <param name="camera"></param>
        /// <returns></returns>
        private string GetImageSavePath(Camera camera)
        {
            DateTime currentDateTime = DateTime.Now;
            string folder = new AppSettingsQuery().GetAppSettingByKey(QueryConstants.AppSettingsKey_PicturesSavePath);
            folder = String.Format(@"{0}/{1}/", folder, camera.CameraName);

            if (!Directory.Exists(folder))
                Directory.CreateDirectory(folder);

            string fileName = String.Format("{0}[{1}-{2}-{3}][{4}-{5}-{6}].jpg"
                , camera.CameraName
                , currentDateTime.Year, currentDateTime.Month, currentDateTime.Day
                , currentDateTime.Hour, currentDateTime.Minute, currentDateTime.Second);

            string saveToPath = Path.Combine(folder, fileName);
            return saveToPath;
        }
コード例 #3
0
ファイル: ContinuousCapture.cs プロジェクト: bzyk72/Shiretii
        /// <summary>
        /// The method fired when the timer interval elapses
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            timer.Stop();
            foreach(Camera cam in availableCameras)
            {
                new CaptureImage().TakePicture(cam, cameras);

                CompareTakenPictures(cam);
            }

            string interval = new AppSettingsQuery().GetAppSettingByKey(QueryConstants.AppSettingsKey_PicturesSaveInterval);
            Double actualInterval = Double.Parse(interval);

            timer.Interval = actualInterval;

            timer.Start();
        }
コード例 #4
0
ファイル: ContinuousCapture.cs プロジェクト: bzyk72/Shiretii
        private void InitializeTimer()
        {
            timer = new Timer();

            string interval = new AppSettingsQuery().GetAppSettingByKey(QueryConstants.AppSettingsKey_PicturesSaveInterval);

            timer.Interval = Double.Parse(interval);
            timer.Elapsed += timer_Elapsed;
        }