Exemplo n.º 1
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")
                {
                }
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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"));
 }
Exemplo n.º 5
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"));
 }
Exemplo n.º 6
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);
 }