コード例 #1
0
 public VibranceSettings(IVibranceProxy v, int minValue, int maxValue, int defaultValue, ListViewItem sender, ApplicationSetting setting, List <ResolutionModeWrapper> supportedResolutionList, Func <int, string> resolveLabelLevel)
 {
     InitializeComponent();
     this.trackBarIngameLevel.Minimum = minValue;
     this.trackBarIngameLevel.Maximum = maxValue;
     this.trackBarIngameLevel.Value   = defaultValue;
     this._sender                   = sender;
     _resolveLabelLevel             = resolveLabelLevel;
     this._v                        = v;
     labelIngameLevel.Text          = _resolveLabelLevel(trackBarIngameLevel.Value);
     this.labelTitle.Text          += $@"""{sender.Text}""";
     this.pictureBox.Image          = this._sender.ListView.LargeImageList.Images[this._sender.ImageIndex];
     this.cBoxResolution.DataSource = supportedResolutionList;
     // If the setting is new, we don't need to set the progress bar value
     if (setting != null)
     {
         // Sets the progress bar value to the Ingame Vibrance setting
         this.trackBarIngameLevel.Value         = setting.IngameLevel;
         this.cBoxResolution.SelectedItem       = setting.ResolutionSettings;
         this.checkBoxResolution.Checked        = setting.IsResolutionChangeNeeded;
         this.checkBoxResolutionRunning.Checked = setting.IsResolutionChangeNeededRunning;
         // Necessary to reload the label which tells the percentage
         trackBarIngameLevel_Scroll(null, null);
     }
 }
コード例 #2
0
        public VibranceGUI(
            Func <List <ApplicationSetting>, Dictionary <string, Tuple <ResolutionModeWrapper, List <ResolutionModeWrapper> > >, IVibranceProxy> getProxy,
            int defaultWindowsLevel,
            int minTrackBarValue,
            int maxTrackBarValue,
            int defaultIngameValue,
            Func <int, string> resolveLabelLevel)
        {
            _defaultWindowsLevel = defaultWindowsLevel;
            _minTrackBarValue    = minTrackBarValue;
            _maxTrackBarValue    = maxTrackBarValue;
            _defaultIngameValue  = defaultIngameValue;
            _resolveLabelLevel   = resolveLabelLevel;
            _allowVisible        = true;

            InitializeComponent();

            trackBarWindowsLevel.Minimum = minTrackBarValue;
            trackBarWindowsLevel.Maximum = maxTrackBarValue;

            _windowsResolutionSettings = new Dictionary <string, Tuple <ResolutionModeWrapper, List <ResolutionModeWrapper> > >();
            foreach (Screen screen in Screen.AllScreens)
            {
                Devmode currentResolutionMode;
                if (ResolutionHelper.GetCurrentResolutionSettings(out currentResolutionMode, screen.DeviceName))
                {
                    List <ResolutionModeWrapper> availableResolutions = ResolutionHelper.EnumerateSupportedResolutionModes(screen.DeviceName);
                    if (screen.Primary)
                    {
                        _supportedResolutionList = availableResolutions;
                    }
                    var tuple = new Tuple <ResolutionModeWrapper, List <ResolutionModeWrapper> >(new ResolutionModeWrapper(currentResolutionMode), availableResolutions);
                    _windowsResolutionSettings.Add(screen.DeviceName, tuple);
                }
                else
                {
                    MessageBox.Show("Current resolution mode could not be determined. Switching back to your Windows resolution will not work.");
                }
            }
            _applicationSettings = new List <ApplicationSetting>();
            _v = getProxy(_applicationSettings, _windowsResolutionSettings);

            backgroundWorker.WorkerReportsProgress         = true;
            settingsBackgroundWorker.WorkerReportsProgress = true;

            backgroundWorker.RunWorkerAsync();
        }
コード例 #3
0
ファイル: VibranceGUI.cs プロジェクト: jamezrin/vibranceGUI
        public VibranceGUI(
            Func <List <ApplicationSetting>, ResolutionModeWrapper, IVibranceProxy> getProxy,
            int defaultWindowsLevel,
            int minTrackBarValue,
            int maxTrackBarValue,
            int defaultIngameValue,
            Func <int, string> resolveLabelLevel)
        {
            _defaultWindowsLevel = defaultWindowsLevel;
            _minTrackBarValue    = minTrackBarValue;
            _maxTrackBarValue    = maxTrackBarValue;
            _defaultIngameValue  = defaultIngameValue;
            _resolveLabelLevel   = resolveLabelLevel;
            _allowVisible        = true;

            InitializeComponent();

            trackBarWindowsLevel.Minimum = minTrackBarValue;
            trackBarWindowsLevel.Maximum = maxTrackBarValue;

            _supportedResolutionList = ResolutionHelper.EnumerateSupportedResolutionModes();

            Devmode currentResolutionMode;

            if (ResolutionHelper.GetCurrentResolutionSettings(out currentResolutionMode, null))
            {
                _windowsResolutionSettings = new ResolutionModeWrapper(currentResolutionMode);
            }
            else
            {
                MessageBox.Show("Current resolution mode could not be determined. Switching back to your Windows resolution will not work.");
            }

            _applicationSettings = new List <ApplicationSetting>();
            _v = getProxy(_applicationSettings, _windowsResolutionSettings);

            backgroundWorker.WorkerReportsProgress         = true;
            settingsBackgroundWorker.WorkerReportsProgress = true;

            backgroundWorker.RunWorkerAsync();
        }
コード例 #4
0
 public VibranceSettings(IVibranceProxy v, int minValue, int maxValue, int defaultValue, ListViewItem sender, ApplicationSetting setting, List<ResolutionModeWrapper> supportedResolutionList, Func<int, string> resolveLabelLevel)
 {
     InitializeComponent();
     this.trackBarIngameLevel.Minimum = minValue;
     this.trackBarIngameLevel.Maximum = maxValue;
     this.trackBarIngameLevel.Value = defaultValue;
     this._sender = sender;
     _resolveLabelLevel = resolveLabelLevel;
     this._v = v;
     labelIngameLevel.Text = _resolveLabelLevel(trackBarIngameLevel.Value);
     this.labelTitle.Text += $@"""{sender.Text}""";
     this.pictureBox.Image = this._sender.ListView.LargeImageList.Images[this._sender.ImageIndex];
     this.cBoxResolution.DataSource = supportedResolutionList;
     // If the setting is new, we don't need to set the progress bar value
     if (setting != null)
     {
         // Sets the progress bar value to the Ingame Vibrance setting
         this.trackBarIngameLevel.Value = setting.IngameLevel;
         this.cBoxResolution.SelectedItem = setting.ResolutionSettings;
         this.checkBoxResolution.Checked = setting.IsResolutionChangeNeeded;
         // Necessary to reload the label which tells the percentage
         trackBarIngameLevel_Scroll(null, null);
     }
 }