예제 #1
0
파일: Form1.cs 프로젝트: kuma3/ImageCapture
        /// <summary>
        /// SelectDevice
        ///
        /// Show the device selection dialog.
        /// </summary>
        private void SelectDevice()
        {
            if (icImagingControl1.LiveVideoRunning)
            {
                icImagingControl1.LiveStop();
                icImagingControl1.ShowDeviceSettingsDialog();
                if (icImagingControl1.DeviceValid)
                {
                    icImagingControl1.LiveStart();
                }
            }
            else
            {
                icImagingControl1.ShowDeviceSettingsDialog();
            }

            UpdateControls();
            SetWindowSizeToImagesize();

            DeviceSettings.SaveSelectedDevice(icImagingControl1);
        }
예제 #2
0
        //
        // SaveSelectedDevice
        //
        // Saves the device settings from icImagingControl1 to the registry
        //
        internal static void SaveSelectedDevice(TIS.Imaging.ICImagingControl icImagingControl1)
        {
            string ActiveErrorHandler = "";

            try
            {
                //        On Error GoTo err_SaveSelectedDevice
                ActiveErrorHandler = "err_SaveSelectedDevice";

                if (icImagingControl1.DeviceValid)
                {
                    Microsoft.VisualBasic.Interaction.SaveSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_VIDEO_SOURCE, icImagingControl1.Device);
                    if (icImagingControl1.InputChannelAvailable)
                    {
                        Microsoft.VisualBasic.Interaction.SaveSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_INPUT_CHANNEL, icImagingControl1.InputChannel);
                    }
                    if (icImagingControl1.VideoNormAvailable)
                    {
                        Microsoft.VisualBasic.Interaction.SaveSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_VIDEO_NORM, icImagingControl1.VideoNorm);
                    }

                    Microsoft.VisualBasic.Interaction.SaveSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_VIDEO_FORMAT, icImagingControl1.VideoFormat);

                    if (icImagingControl1.DeviceFrameRateAvailable)
                    {
                        Microsoft.VisualBasic.Interaction.SaveSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_FRAME_RATE, icImagingControl1.DeviceFrameRate.ToString());
                    }
                }
            }

            catch
            {
                if (ActiveErrorHandler == "err_SaveSelectedDevice")
                {
                }
            }
        }
예제 #3
0
        //
        // OpenSelectedDevice
        //
        // Open the device that has be stored in the registry last time, the
        // device selection dialog has been used. Call this sub in the beginning
        // of an application to restore the last used video capture device.
        //
        internal static bool OpenSelectedDevice(TIS.Imaging.ICImagingControl icImagingControl1)
        {
            string ActiveErrorHandler = "";

            bool OpenSelectedDevice_temp = false;

            try
            {
                //        On Error GoTo err_OpenSelectedDevice
                ActiveErrorHandler = "err_OpenSelectedDevice";
                string VideoSource = "";

                icImagingControl1.Device = Microsoft.VisualBasic.Interaction.GetSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_VIDEO_SOURCE, "");

                // Restore settings
                if (icImagingControl1.VideoNormAvailable)
                {
                    icImagingControl1.VideoNorm = Microsoft.VisualBasic.Interaction.GetSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_VIDEO_NORM, "");
                }
                if (icImagingControl1.InputChannelAvailable)
                {
                    icImagingControl1.InputChannel = Microsoft.VisualBasic.Interaction.GetSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_INPUT_CHANNEL, "");
                }
                icImagingControl1.VideoFormat = Microsoft.VisualBasic.Interaction.GetSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_VIDEO_FORMAT, "");

                if (icImagingControl1.DeviceFrameRateAvailable)
                {
                    icImagingControl1.DeviceFrameRate = float.Parse(Microsoft.VisualBasic.Interaction.GetSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_FRAME_RATE, ""));
                }
                // No error occured, and device is present. Indicate success
                OpenSelectedDevice_temp = true;

                return(OpenSelectedDevice_temp);
            }
            catch
            {
                if (ActiveErrorHandler == "err_OpenSelectedDevice")
                {
                    return(OpenSelectedDevice_temp);
                }
            }

            return(OpenSelectedDevice_temp);
        }
예제 #4
0
 //
 // SaveAVIFileInRegisty
 //
 // Retrieve the last used AVI file from the registry
 //
 internal static void SaveAVIFileInRegisty(string FileName)
 {
     Microsoft.VisualBasic.Interaction.SaveSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_AVIFILE, FileName);
 }
예제 #5
0
 //
 // GetAVIFileFromRegisty
 //
 // Retrieve the last used AVI file from the registry.
 //
 internal static string GetAVIFileFromRegisty()
 {
     return(Microsoft.VisualBasic.Interaction.GetSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_AVIFILE, "new.avi"));
 }
예제 #6
0
 //
 // GetCodecFileFromRegisty
 //
 // Retrieve the last used codec configuration file from the registry.
 //
 internal static string GetCodecFileFromRegisty()
 {
     return(Microsoft.VisualBasic.Interaction.GetSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_CODECDATA, "new.cod"));
 }
예제 #7
0
 //
 // SaveCodecInRegisty
 //
 // Save the last used codec  file in the registry.
 //
 internal static void SaveCodecInRegisty(string Codec)
 {
     Microsoft.VisualBasic.Interaction.SaveSetting(DeviceSettings.CurrentProcessName().ToString(), REG_SECTION, REG_KEY_CODEC, Codec);
 }
예제 #8
0
파일: Form1.cs 프로젝트: kuma3/ImageCapture
 /// <summary>
 /// LoadLastUsedDevice
 ///
 /// Retrieve the last used video capture device from the registry and
 /// open it. The implementation of these functionallity is in the
 /// modul devicesettings.vb
 /// </summary>
 private void LoadLastUsedDevice()
 {
     DeviceSettings.OpenSelectedDevice(icImagingControl1);
     SetWindowSizeToImagesize();
 }
예제 #9
0
 //
 // AviDialog_Closing
 //
 // When the dialog is closed, the contents of the controls is save to the
 // registry. This contents will be loaded from the registry, when the
 // AVI dialog is opened again.
 //
 private void AviDialog_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     DeviceSettings.SaveAVIFileInRegisty(edtAVIFile.Text);
     DeviceSettings.SaveCodecInRegisty(((AviCompressor)(CodecBox.SelectedItem)).Name);
     DeviceSettings.SaveCodecFileInRegisty(edtConfigFile.Text);
 }