Exemplo n.º 1
0
        private void LogoTimer_Tick(object sender, EventArgs e)
        {
            Logo.Close();
            LogoTimer.Enabled = false;

            if (bCameraDetected == false)
            {
                MessageBox.Show("Camera is not found..");
                Environment.Exit(0);
            }
            else
            {
                while (videoSource.IsRunning == false)
                {
                    ;
                }
            }

            videoSource.SetCameraProperty(CameraControlProperty.Focus, 0, CameraControlFlags.Auto);
            btnFocus.Text = "AF";

            string  LastDirectory;
            string  AppDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            IniFile ini          = new IniFile(AppDirectory + "\\properties.ini");

            LastDirectory = ini.IniReadValue("Properties", "LastDirectory");

            fbd             = new FolderBrowserDialog();
            fbd.Description = "Please select directory for video recording.";
            if (LastDirectory != null)
            {
                fbd.SelectedPath = LastDirectory;
            }

            DialogResult result = fbd.ShowDialog();

            ini.IniWriteValue("Properties", "LastDirectory", fbd.SelectedPath);

            if (!System.IO.Directory.Exists(fbd.SelectedPath + "\\DCAM2_" + DateTime.Now.ToString("yyyyMMdd")))
            {
                System.IO.Directory.CreateDirectory(fbd.SelectedPath + "\\DCAM2_" + DateTime.Now.ToString("yyyyMMdd"));
            }
            if (!System.IO.Directory.Exists(fbd.SelectedPath + "\\DCAM2_" + DateTime.Now.ToString("yyyyMMdd") + "\\Video"))
            {
                System.IO.Directory.CreateDirectory(fbd.SelectedPath + "\\DCAM2_" + DateTime.Now.ToString("yyyyMMdd") + "\\Video");
            }
            if (!System.IO.Directory.Exists(fbd.SelectedPath + "\\DCAM2_" + DateTime.Now.ToString("yyyyMMdd") + "\\Image"))
            {
                System.IO.Directory.CreateDirectory(fbd.SelectedPath + "\\DCAM2_" + DateTime.Now.ToString("yyyyMMdd") + "\\Image");
            }
        }