Exemple #1
0
        public GlobalPrefsDialog(GlobalPrefs primaryPrefs)
        {
            this.primaryPrefs = primaryPrefs;
            localPrefs        = new GlobalPrefs();
            primaryPrefs.CopyTo(localPrefs);

            InitializeComponent();
            this.Icon = OutOfPhase.Properties.Resources.Icon2;

            DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom);

            devices = OutputDeviceEnumerator.EnumerateAudioOutputDeviceIdentifiers();
            for (int i = 0; i < devices.Length; i++)
            {
                comboBoxOutputDevice.Items.Add(devices[i].Value);
                if (String.Equals(devices[i].Key, localPrefs.OutputDevice))
                {
                    comboBoxOutputDevice.SelectedIndex = i;
                }
            }

            for (int i = 0; i < Priorities.Length; i++)
            {
                comboBoxPriority.Items.Add(Priorities[i].Key);
                if (Priorities[i].Value == localPrefs.PriorityMode)
                {
                    comboBoxPriority.SelectedIndex = i;
                }
            }

            concurrency = localPrefs.Concurrency;
            UpdateConcurrencyEnables();

            bool zoomSet = false;

            for (int i = 0; i < ZoomLevels.Length; i++)
            {
                comboBoxZoom.Items.Add(ZoomLevels[i]);
                if (!zoomSet && (primaryPrefs.AdditionalUIZoom <= ZoomLevels[i]))
                {
                    zoomSet = true;
                    comboBoxZoom.SelectedIndex = i;
                }
            }
            if (!zoomSet)
            {
                comboBoxZoom.SelectedIndex = ZoomLevels.Length - 1;
            }

            globalPrefsBindingSource.Add(localPrefs);
        }
Exemple #2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            // stage non-databound settings
            localPrefs.Concurrency      = concurrency;
            localPrefs.OutputDevice     = devices[comboBoxOutputDevice.SelectedIndex].Key;
            localPrefs.OutputDeviceName = devices[comboBoxOutputDevice.SelectedIndex].Value;
            localPrefs.PriorityMode     = comboBoxPriority.SelectedIndex;
            localPrefs.AdditionalUIZoom = ZoomLevels[comboBoxZoom.SelectedIndex];

            localPrefs.CopyTo(primaryPrefs);
            Program.SaveSettings();

            Close();
        }