public ProgramSettings( IViewerSite viewer )
        {
            // Remember
            m_Viewer = viewer;

            // Load picture parameters
            if (null != m_Viewer) m_Initial = m_Viewer.PictureParameters;

            // Set up self
            InitializeComponent();
        }
        private void SetBar( TrackBar bar, PictureParameters.ParameterSet parameter, PictureParameters parameters )
        {
            // Load the relative value
            double relVal = (bar.Value - bar.Minimum) * 1.0 / (bar.Maximum - bar.Minimum);

            // Copy to value
            parameter.Value = (float) (parameter.Minimum + relVal * (parameter.Maximum - parameter.Minimum));

            // Change picture 
            m_Viewer.PictureParameters = parameters;
        }
        private void SetBar( TrackBar bar, PictureParameters.ParameterSet parameter, float value )
        {
            // Remember
            parameter.Value = value;

            // Get the relative position
            double relVal = (value - parameter.Minimum) / (parameter.Maximum - parameter.Minimum);

            // Set slider
            bar.Value = (int) (bar.Minimum + relVal * (bar.Maximum - bar.Minimum));

            // Activate slider
            bar.Enabled = true;
        }
        private void cmdSave_Click( object sender, EventArgs e )
        {
            // Validate
            if (!string.IsNullOrEmpty( txMCast.Text ))
                try
                {
                    // Parse
                    var test = IPAddress.Parse( txMCast.Text );

                    // Load
                    byte first = test.GetAddressBytes()[0];

                    // Check
                    if ((first < 224) || (first > 239))
                        throw new Exception();
                }
                catch
                {
                    // Report
                    MessageBox.Show( Properties.Resources.BadMulticast );

                    // Do not leave
                    DialogResult = DialogResult.None;

                    // Done
                    return;
                }

            // Attach to settngs
            var settings = Properties.Settings.Default;

            // Check for changes
            settings.SettingChanging += SettingChanging;
            try
            {
                // Copy general
                settings.DVBNETViewer_FullServer_VCR30Server = txURL.Text;
                settings.UseCyberlinkCodec = ckCyberlink.Checked;
                settings.UseRadio = (selType.SelectedIndex < 2);
                settings.BroadcastPort = (ushort) selPort.Value;
                settings.UseTV = (selType.SelectedIndex != 1);
                settings.FreeTV = (selEnc.SelectedIndex != 1);
                settings.PayTV = (selEnc.SelectedIndex < 2);
                settings.HideCursor = ckHideCursor.Checked;
                settings.OSDLifeTime = (int) selOSD.Value;
                settings.AVDelay = (int) udAVDelay.Value;
                settings.UseRemote = ckRemote.Checked;
                settings.Priority = CurrentPriority;
                settings.BroadcastIP = txMCast.Text;

                // Load decoders
                settings.MPEG2Decoder = ReadList( selMPEG2 );
                settings.H264Decoder = ReadList( selH264 );
                settings.MP2Decoder = ReadList( selMP2 );
                settings.AC3Decoder = ReadList( selAC3 );

                // Copy picture parameters
                if (ckOverwrite.Enabled)
                {
                    // All parameters as is
                    var current = m_Viewer.PictureParameters;

                    // Copy
                    settings.OverwriteVideoSettings = ckOverwrite.Checked;
                    settings.VideoSaturation = current.Saturation.Value;
                    settings.VideoBrightness = current.Brightness.Value;
                    settings.VideoContrast = current.Contrast.Value;
                    settings.VideoHue = current.Hue.Value;

                    // Do not reset
                    m_Initial = null;
                }
            }
            finally
            {
                // Remove handler
                settings.SettingChanging -= SettingChanging;
            }
        }
 private void SetVideoParameter( PictureParameters.ParameterSet parameter, float value )
 {
     // Store but keep in range
     parameter.Value = Math.Max( parameter.Minimum, Math.Min( parameter.Maximum, value ) );
 }
 void IGeneralInfo.SetPictureParameters( PictureParameters parameters )
 {
     // Copy over if necessary
     if (Properties.Settings.Default.OverwriteVideoSettings)
     {
         // Set all
         SetVideoParameter( parameters.Brightness, Properties.Settings.Default.VideoBrightness );
         SetVideoParameter( parameters.Saturation, Properties.Settings.Default.VideoSaturation );
         SetVideoParameter( parameters.Hue, Properties.Settings.Default.VideoHue );
         SetVideoParameter( parameters.Contrast, Properties.Settings.Default.VideoContrast );
     }
 }