public SettingsForm(IAudioDeviceLister audioDeviceLister) { _audioDeviceLister = audioDeviceLister; // Form itself InitializeComponent(); Icon = RessourceSettingsIcon; Text = AssemblyUtils.GetReleaseState() == AssemblyUtils.ReleaseState.Beta ? $"{SettingsStrings.settings} {AssemblyUtils.GetReleaseState()}" : SettingsStrings.settings; LocalizeForm(); var closeToolTip = new ToolTip(); closeToolTip.SetToolTip(closeButton, SettingsStrings.closeTooltip); hotKeyControl.HotKey = AppConfigs.Configuration.PlaybackHotKey; hotKeyControl.Tag = new Tuple <HotKeyAction, HotKey>(HotKeyAction.Playback, AppConfigs.Configuration.PlaybackHotKey); hotKeyControl.Enabled = hotkeysCheckBox.Checked = AppConfigs.Configuration.PlaybackHotKey.Enabled; muteHotKey.HotKey = AppConfigs.Configuration.MuteRecordingHotKey; muteHotKey.Tag = new Tuple <HotKeyAction, HotKey>(HotKeyAction.Mute, AppConfigs.Configuration.MuteRecordingHotKey); muteHotKey.Enabled = muteHotKeyCheckbox.Checked = AppConfigs.Configuration.MuteRecordingHotKey.Enabled; var hotkeysToolTip = new ToolTip(); hotkeysToolTip.SetToolTip(hotkeysCheckBox, SettingsStrings.hotkeysTooltip); // Settings - Basic startWithWindowsCheckBox.Checked = AppModel.Instance.RunAtStartup; new IconChangerFactory().ConfigureListControl(iconChangeChoicesComboBox); iconChangeChoicesComboBox.SelectedValue = AppConfigs.Configuration.SwitchIcon; var iconChangeToolTip = new ToolTip(); iconChangeToolTip.SetToolTip(iconChangeLabel, SettingsStrings.iconChange_tooltip); // Settings - Audio switchCommunicationDeviceCheckBox.Checked = AppModel.Instance.SetCommunications; var switchCommunicationsDeviceToolTip = new ToolTip(); switchCommunicationsDeviceToolTip.SetToolTip(switchCommunicationDeviceCheckBox, SettingsStrings.communicationsDeviceTooltip); foregroundAppCheckbox.Checked = AppModel.Instance.SwitchForegroundProgram; var foregroundAppToolTip = new ToolTip(); foregroundAppToolTip.SetToolTip(foregroundAppCheckbox, SettingsStrings.foregroundAppTooltip); usePrimaryScreenCheckbox.Checked = AppModel.Instance.NotifyUsingPrimaryScreen; usePrimaryScreenCheckbox.Enabled = AppModel.Instance.NotificationSettings == NotificationTypeEnum.BannerNotification; var usePrimaryScreenTooltip = new ToolTip(); usePrimaryScreenTooltip.SetToolTip(usePrimaryScreenCheckbox, SettingsStrings.usePrimaryScreenTooltip); var notificationToolTip = new ToolTip(); notificationToolTip.SetToolTip(notificationComboBox, SettingsStrings.notificationTooltip); var notificationFactory = new NotificationFactory(); notificationFactory.ConfigureListControl(notificationComboBox); notificationComboBox.SelectedValue = AppModel.Instance.NotificationSettings; selectSoundFileDialog.Filter = SettingsStrings.audioFiles + @" (*.wav;*.mp3)|*.wav;*.mp3;*.aiff"; selectSoundFileDialog.FileOk += SelectSoundFileDialogOnFileOk; selectSoundFileDialog.CheckFileExists = true; selectSoundFileDialog.CheckPathExists = true; var soundSupported = notificationFactory.Get(AppModel.Instance.NotificationSettings).SupportCustomSound() != NotificationCustomSoundEnum.NotSupported; selectSoundButton.Visible = soundSupported; var removeCustomSoundToolTip = new ToolTip(); removeCustomSoundToolTip.SetToolTip(deleteSoundButton, SettingsStrings.disableCustomSoundTooltip); try { deleteSoundButton.Visible = soundSupported && AppModel.Instance.CustomNotificationSound != null; } catch (CachedSoundFileNotExistsException) { } var selectSoundButtonToolTip = new ToolTip(); selectSoundButtonToolTip.SetToolTip(selectSoundButton, SettingsStrings.selectSoundButtonTooltip); new TooltipInfoFactory().ConfigureListControl(tooltipInfoComboBox); tooltipInfoComboBox.SelectedValue = TooltipInfoManager.CurrentTooltipInfo; new DeviceCyclerFactory().ConfigureListControl(cycleThroughComboBox); cycleThroughComboBox.SelectedValue = DeviceCyclerManager.CurrentCycler; var cycleThroughToolTip = new ToolTip(); cycleThroughToolTip.SetToolTip(cycleThroughComboBox, SettingsStrings.cycleThroughTooltip); // Settings - Update includeBetaVersionsCheckBox.Checked = AppModel.Instance.IncludeBetaVersions; switch (AppModel.Instance.UpdateMode) { case UpdateMode.Silent: updateSilentRadioButton.Checked = true; break; case UpdateMode.Notify: updateNotifyRadioButton.Checked = true; break; case UpdateMode.Never: updateNeverRadioButton.Checked = true; break; default: throw new ArgumentOutOfRangeException(); } var updateSilentToolTip = new ToolTip(); updateSilentToolTip.SetToolTip(updateSilentRadioButton, SettingsStrings.updateInstallAutomaticallyTooltip); var updateNotifyToolTip = new ToolTip(); updateNotifyToolTip.SetToolTip(updateNotifyRadioButton, SettingsStrings.updateNotifyTooltip); var updateNeverToolTip = new ToolTip(); updateNeverToolTip.SetToolTip(updateNeverRadioButton, SettingsStrings.updateNeverTooltip); var includeBetaVersionsToolTip = new ToolTip(); includeBetaVersionsToolTip.SetToolTip(includeBetaVersionsCheckBox, SettingsStrings.updateIncludeBetaVersionsTooltip); // Settings - Language new LanguageFactory().ConfigureListControl(languageComboBox); languageComboBox.SelectedValue = AppModel.Instance.Language; muteHotKey.Visible = false; muteHotKeyCheckbox.Visible = false; toggleMuteLabel.Visible = false; PopulateSettings(); _loaded = true; }
public SettingsForm() { // Form itself InitializeComponent(); Icon = RessourceSettingsIcon; Text = AssemblyUtils.GetReleaseState() == AssemblyUtils.ReleaseState.Beta ? $"{SettingsStrings.settings} {AssemblyUtils.GetReleaseState()}" : SettingsStrings.settings; LocalizeForm(); var closeToolTip = new ToolTip(); closeToolTip.SetToolTip(closeButton, SettingsStrings.closeTooltip); hotkeysTextBox.Text = AppConfigs.Configuration.PlaybackHotKeys.Display(); hotkeysTextBox.Tag = new Tuple <DataFlow, HotKeys>(DataFlow.Render, AppConfigs.Configuration.PlaybackHotKeys); hotkeysTextBox.Enabled = hotkeysCheckBox.Checked = AppConfigs.Configuration.PlaybackHotKeys.Enabled; hotkeysTextBox.KeyDown += (sender, args) => SetHotkey(args); var hotkeysToolTip = new ToolTip(); hotkeysToolTip.SetToolTip(hotkeysCheckBox, SettingsStrings.hotkeysTooltip); // Settings - Basic startWithWindowsCheckBox.Checked = AppModel.Instance.RunAtStartup; keepSystemTrayIconCheckBox.Checked = AppConfigs.Configuration.KeepSystrayIcon; var keepSystemTrayIconToolTip = new ToolTip(); keepSystemTrayIconToolTip.SetToolTip(keepSystemTrayIconCheckBox, SettingsStrings.keepSystemTrayIconTooltip); // Settings - Audio switchCommunicationDeviceCheckBox.Checked = AppModel.Instance.SetCommunications; var switchCommunicationsDeviceToolTip = new ToolTip(); switchCommunicationsDeviceToolTip.SetToolTip(switchCommunicationDeviceCheckBox, SettingsStrings.communicationsDeviceTooltip); var notificationToolTip = new ToolTip(); notificationToolTip.SetToolTip(notificationComboBox, SettingsStrings.notificationTooltip); var notificationFactory = new NotificationFactory(); notificationFactory.ConfigureListControl(notificationComboBox); notificationComboBox.SelectedValue = AppModel.Instance.NotificationSettings; selectSoundFileDialog.Filter = SettingsStrings.audioFiles + @" (*.wav;*.mp3)|*.wav;*.mp3;*.aiff"; selectSoundFileDialog.FileOk += SelectSoundFileDialogOnFileOk; selectSoundFileDialog.CheckFileExists = true; selectSoundFileDialog.CheckPathExists = true; var soundSupported = notificationFactory.Get(AppModel.Instance.NotificationSettings).SupportCustomSound() != NotificationCustomSoundEnum.NotSupported; selectSoundButton.Visible = soundSupported; var removeCustomSoundToolTip = new ToolTip(); removeCustomSoundToolTip.SetToolTip(deleteSoundButton, SettingsStrings.disableCustomSoundTooltip); try { deleteSoundButton.Visible = soundSupported && AppModel.Instance.CustomNotificationSound != null; } catch (CachedSoundFileNotExistsException) { } var selectSoundButtonToolTip = new ToolTip(); selectSoundButtonToolTip.SetToolTip(selectSoundButton, SettingsStrings.selectSoundButtonTooltip); new TooltipInfoFactory().ConfigureListControl(tooltipInfoComboBox); tooltipInfoComboBox.SelectedValue = TooltipInfoManager.CurrentTooltipInfo; new DeviceCyclerFactory().ConfigureListControl(cycleThroughComboBox); cycleThroughComboBox.SelectedValue = DeviceCyclerManager.CurrentCycler; var cycleThroughToolTip = new ToolTip(); cycleThroughToolTip.SetToolTip(cycleThroughComboBox, SettingsStrings.cycleThroughTooltip); foregroundAppCheckbox.Checked = AppModel.Instance.SwitchForegroundProgram; var foregroundAppToolTip = new ToolTip(); foregroundAppToolTip.SetToolTip(foregroundAppCheckbox, SettingsStrings.foregroundAppTooltip); // Settings - Update includeBetaVersionsCheckBox.Checked = AppModel.Instance.IncludeBetaVersions; switch (AppModel.Instance.UpdateMode) { case UpdateMode.Silent: updateSilentRadioButton.Checked = true; break; case UpdateMode.Notify: updateNotifyRadioButton.Checked = true; break; case UpdateMode.Never: updateNeverRadioButton.Checked = true; break; default: throw new ArgumentOutOfRangeException(); } var updateSilentToolTip = new ToolTip(); updateSilentToolTip.SetToolTip(updateSilentRadioButton, SettingsStrings.updateInstallAutomaticallyTooltip); var updateNotifyToolTip = new ToolTip(); updateNotifyToolTip.SetToolTip(updateNotifyRadioButton, SettingsStrings.updateNotifyTooltip); var updateNeverToolTip = new ToolTip(); updateNeverToolTip.SetToolTip(updateNeverRadioButton, SettingsStrings.updateNeverTooltip); var includeBetaVersionsToolTip = new ToolTip(); includeBetaVersionsToolTip.SetToolTip(includeBetaVersionsCheckBox, SettingsStrings.updateIncludeBetaVersionsTooltip); // Settings - Language languageComboBox.Items.AddRange(Enum.GetNames(typeof(Language))); languageComboBox.SelectedIndex = (int)AppConfigs.Configuration.Language; // Playback and Recording using (var audioDeviceLister = new CachedAudioDeviceLister(DeviceState.All)) { PopulateAudioList(playbackListView, AppModel.Instance.SelectedDevices, audioDeviceLister.PlaybackDevices); PopulateAudioList(recordingListView, AppModel.Instance.SelectedDevices, audioDeviceLister.RecordingDevices); } _loaded = true; }