コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 private void ButtonCancel_Click(object sender, RoutedEventArgs e)
 {
     SettingsDismissed?.Invoke(this,
                               new SettingsDismissedEventArgs(DismissType.Cancel));
 }