コード例 #1
0
        /// <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
 /// <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();
 }
コード例 #4
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";

                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);
        }
コード例 #5
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);
 }
コード例 #6
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"));
 }
コード例 #7
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"));
 }
コード例 #8
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);
 }
コード例 #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);
        }