private void AcceptButton_Click(object sender, RoutedEventArgs e) { App.Settings.GamePath = !string.IsNullOrEmpty(ViewModel.GamePath) ? new DirectoryInfo(ViewModel.GamePath) : null; App.Settings.PatchPath = !string.IsNullOrEmpty(ViewModel.PatchPath) ? new DirectoryInfo(ViewModel.PatchPath) : null; App.Settings.IsDx11 = Dx11RadioButton.IsChecked == true; App.Settings.Language = (ClientLanguage)LanguageComboBox.SelectedIndex; App.Settings.AddonList = (List <AddonEntry>)AddonListView.ItemsSource; App.Settings.UniqueIdCacheEnabled = UidCacheCheckBox.IsChecked == true; App.Settings.EncryptArguments = EncryptedArgumentsCheckbox.IsChecked == true; App.Settings.AskBeforePatchInstall = AskBeforePatchingCheckBox.IsChecked == true; App.Settings.InGameAddonEnabled = EnableHooksCheckBox.IsChecked == true; var featureConfig = DalamudSettings.DiscordFeatureConfig; featureConfig.Token = DiscordBotTokenTextBox.Text; featureConfig.CheckForDuplicateMessages = CheckForDuplicateMessagesCheckBox.IsChecked == true; if (int.TryParse(ChatDelayTextBox.Text, out var parsedDelay)) { featureConfig.ChatDelayMs = parsedDelay; } featureConfig.DisableEmbeds = DisableEmbedsCheckBox.IsChecked == true; DalamudSettings.DiscordFeatureConfig = featureConfig; App.Settings.SteamIntegrationEnabled = SteamIntegrationCheckBox.IsChecked == true; DalamudSettings.OptOutMbUpload = MbUploadOptOutCheckBox.IsChecked == true; App.Settings.AdditionalLaunchArgs = LaunchArgsTextBox.Text; SettingsDismissed?.Invoke(this, null); App.Settings.SpeedLimitBytes = (long)(SpeedLimiterUpDown.Value * BYTES_TO_MB); }
private void AcceptButton_Click(object sender, RoutedEventArgs e) { if (ViewModel.GamePath == ViewModel.PatchPath) { CustomMessageBox.Show(Loc.Localize("SettingsGamePatchPathError", "Game and patch download paths cannot be the same.\nPlease make sure to choose distinct game and patch download paths."), "XIVLauncher Error", MessageBoxButton.OK, MessageBoxImage.Error, parentWindow: Window.GetWindow(this)); return; } App.Settings.GamePath = !string.IsNullOrEmpty(ViewModel.GamePath) ? new DirectoryInfo(ViewModel.GamePath) : null; App.Settings.PatchPath = !string.IsNullOrEmpty(ViewModel.PatchPath) ? new DirectoryInfo(ViewModel.PatchPath) : null; App.Settings.IsDx11 = Dx11RadioButton.IsChecked == true; App.Settings.Language = (ClientLanguage)LanguageComboBox.SelectedIndex; // Keep the notice visible if LauncherLanguage has changed if (App.Settings.LauncherLanguage == (LauncherLanguage)LauncherLanguageComboBox.SelectedIndex) { LauncherLanguageNoticeTextBlock.Visibility = Visibility.Hidden; } App.Settings.LauncherLanguage = (LauncherLanguage)LauncherLanguageComboBox.SelectedIndex; App.Settings.AddonList = (List <AddonEntry>)AddonListView.ItemsSource; App.Settings.UniqueIdCacheEnabled = UidCacheCheckBox.IsChecked == true; App.Settings.EncryptArguments = EncryptedArgumentsCheckbox.IsChecked == true; App.Settings.ExitLauncherAfterGameExit = ExitLauncherAfterGameExitCheckbox.IsChecked == true; App.Settings.TreatNonZeroExitCodeAsFailure = TreatNonZeroExitCodeAsFailureCheckbox.IsChecked == true; App.Settings.AskBeforePatchInstall = AskBeforePatchingCheckBox.IsChecked == true; App.Settings.KeepPatches = KeepPatchesCheckBox.IsChecked == true; App.Settings.PatchAcquisitionMethod = (AcquisitionMethod)PatchAcquisitionComboBox.SelectedIndex; App.Settings.InGameAddonEnabled = EnableHooksCheckBox.IsChecked == true; if (InjectionDelayUpDown.Value.HasValue) { App.Settings.DalamudInjectionDelayMs = InjectionDelayUpDown.Value.Value; } if (DllInjectDalamudLoadMethodRadioButton.IsChecked == true) { App.Settings.InGameAddonLoadMethod = DalamudLoadMethod.DllInject; } else { App.Settings.InGameAddonLoadMethod = DalamudLoadMethod.EntryPoint; } App.Settings.OtpServerEnabled = OtpServerCheckBox.IsChecked == true; App.Settings.AdditionalLaunchArgs = LaunchArgsTextBox.Text; App.Settings.DpiAwareness = (DpiAwareness)DpiAwarenessComboBox.SelectedIndex; SettingsDismissed?.Invoke(this, null); App.Settings.SpeedLimitBytes = (long)(SpeedLimiterUpDown.Value * BYTES_TO_MB); App.Settings.IsFt = this.IsFreeTrialCheckbox.IsChecked == true; Transitioner.MoveNextCommand.Execute(null, null); }
private void AcceptButton_Click(object sender, RoutedEventArgs e) { App.Settings.GamePath = !string.IsNullOrEmpty(ViewModel.GamePath) ? new DirectoryInfo(ViewModel.GamePath) : null; App.Settings.PatchPath = !string.IsNullOrEmpty(ViewModel.PatchPath) ? new DirectoryInfo(ViewModel.PatchPath) : null; App.Settings.IsDx11 = Dx11RadioButton.IsChecked == true; App.Settings.Language = (ClientLanguage)LanguageComboBox.SelectedIndex; // Keep the notice visible if LauncherLanguage has changed if (App.Settings.LauncherLanguage == (LauncherLanguage)LauncherLanguageComboBox.SelectedIndex) { LauncherLanguageNoticeTextBlock.Visibility = Visibility.Hidden; } App.Settings.LauncherLanguage = (LauncherLanguage)LauncherLanguageComboBox.SelectedIndex; App.Settings.AddonList = (List <AddonEntry>)AddonListView.ItemsSource; App.Settings.UniqueIdCacheEnabled = UidCacheCheckBox.IsChecked == true; App.Settings.EncryptArguments = EncryptedArgumentsCheckbox.IsChecked == true; App.Settings.AskBeforePatchInstall = AskBeforePatchingCheckBox.IsChecked == true; App.Settings.KeepPatches = KeepPatchesCheckBox.IsChecked == true; App.Settings.InGameAddonEnabled = EnableHooksCheckBox.IsChecked == true; if (InjectionDelayUpDown.Value.HasValue) { App.Settings.DalamudInjectionDelayMs = InjectionDelayUpDown.Value.Value; } App.Settings.SteamIntegrationEnabled = SteamIntegrationCheckBox.IsChecked == true; App.Settings.OtpServerEnabled = OtpServerCheckBox.IsChecked == true; App.Settings.OptOutMbCollection = MbUploadOptOutCheckBox.IsChecked == true; App.Settings.AdditionalLaunchArgs = LaunchArgsTextBox.Text; SettingsDismissed?.Invoke(this, null); App.Settings.SpeedLimitBytes = (long)(SpeedLimiterUpDown.Value * BYTES_TO_MB); }
private void ButtonSave_Click(object sender, RoutedEventArgs e) { new Thread(delegate() { Application.Current.Dispatcher.Invoke(delegate { SettingsCheckStarted?.Invoke(this, new EventArgs()); TextBoxEndpoint.IsEnabled = false; ButtonCancel.IsEnabled = false; }); try { // Request AWS info to check entered URL is valid string awsInfoUrl = null; Application.Current.Dispatcher.Invoke(delegate { awsInfoUrl = Path .Combine(TextBoxEndpoint.Text + "/", "data/aws-info.php"); }); string awsInfoData = Helpers.RequestURL(awsInfoUrl); if (awsInfoData == "1") { throw new Exception("Server-side error"); } AWSInfo awsInfoJson = JsonConvert.DeserializeObject <AWSInfo>( awsInfoData, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); Application.Current.Dispatcher.Invoke(delegate { Properties.Settings.Default.DataEndpoint = TextBoxEndpoint.Text; }); Properties.Settings.Default.AWSTimeZone = awsInfoJson.TimeZone; Properties.Settings.Default.IsFirstRun = false; Properties.Settings.Default.Save(); Application.Current.Dispatcher.Invoke(delegate { SettingsCheckCompleted?.Invoke(this, new EventArgs()); SettingsDismissed?.Invoke(this, new SettingsDismissedEventArgs(DismissType.Save)); }); } catch { Application.Current.Dispatcher.Invoke(delegate { TextBoxEndpoint.IsEnabled = true; TextBoxEndpoint.Focus(); TextBoxEndpoint.SelectAll(); if (!IsSetupMode) { ButtonCancel.IsEnabled = true; } SettingsCheckCompleted?.Invoke(this, new EventArgs()); }); } }).Start(); }
private void ButtonCancel_Click(object sender, RoutedEventArgs e) { SettingsDismissed?.Invoke(this, new SettingsDismissedEventArgs(DismissType.Cancel)); }