Beispiel #1
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();
        }
Beispiel #2
0
        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();
        }