Esempio n. 1
0
        /// <summary>
        /// Updates the dialog settings display
        /// </summary>
        private void UpdateDialogSettings()
        {
            // Check to see that we can update things
            if (!this.settingsLoaded)
            {
                return;
            }

            // Build language combo box
            this.languageComboBox.Items.Clear();

            // Read the languages from the config file
            ComboBoxItem[] languages = Config.Settings.Default.GameLanguages.Split(',').Select(iso =>
            {
                CultureInfo ci = new CultureInfo(iso.ToUpperInvariant(), true);
                return(new ComboBoxItem()
                {
                    Value = ci.EnglishName, DisplayName = ci.DisplayName
                });                                                                                                // to keep EnglishName as baseline value
            }).OrderBy(cb => cb.DisplayName).ToArray();

            // Reading failed so we default to English
            if (!languages.Any())
            {
                languages = new ComboBoxItem[] { new ComboBoxItem()
                                                 {
                                                     Value = "English", DisplayName = "English"
                                                 } }
            }
            ;

            this.languageComboBox.Items.AddRange(languages);

            this.vaultPathTextBox.Text                              = this.VaultPath;
            this.skipTitleCheckBox.Checked                          = this.skipTitle;
            this.allowItemEditCheckBox.Checked                      = this.allowItemEdit;
            this.allowItemCopyCheckBox.Checked                      = this.allowItemCopy;
            this.characterEditCheckBox.Checked                      = this.allowCharacterEdit;
            this.loadLastCharacterCheckBox.Checked                  = this.loadLastCharacter;
            this.loadLastVaultCheckBox.Checked                      = this.loadLastVault;
            this.detectLanguageCheckBox.Checked                     = this.detectLanguage;
            this.detectGamePathsCheckBox.Checked                    = this.detectGamePath;
            this.immortalThronePathTextBox.Text                     = this.immortalThronePath;
            this.immortalThronePathTextBox.Enabled                  = !this.detectGamePath;
            this.immortalThronePathBrowseButton.Enabled             = !this.detectGamePath;
            this.titanQuestPathTextBox.Text                         = this.titanQuestPath;
            this.titanQuestPathTextBox.Enabled                      = !this.detectGamePath;
            this.titanQuestPathBrowseButton.Enabled                 = !this.detectGamePath;
            this.loadAllFilesCheckBox.Checked                       = this.loadAllFiles;
            this.suppressWarningsCheckBox.Checked                   = this.suppressWarnings;
            this.playerReadonlyCheckbox.Checked                     = this.playerReadonly;
            this.EnableDetailedTooltipViewCheckBox.Checked          = this.enableDetailedTooltipView;
            this.ItemBGColorOpacityTrackBar.Value                   = this.itemBGColorOpacity;
            this.EnableCharacterRequierementBGColorCheckBox.Checked = this.enableCharacterRequierementBGColor;

            this.enableCustomMapsCheckBox.Checked = this.enableMods;

            var lst   = this.mapListComboBox.Items.Cast <GamePathEntry>();
            var found = lst.Where(m => m.Path == this.customMap).FirstOrDefault();

            this.mapListComboBox.SelectedItem = found;

            this.mapListComboBox.Enabled = this.enableMods;

            this.languageComboBox.SelectedItem = languages.FirstOrDefault(cb => cb.Value.Equals(this.titanQuestLanguage, StringComparison.InvariantCultureIgnoreCase));

            this.languageComboBox.Enabled = !this.detectLanguage;

            // Build Font combo box
            this.baseFontComboBox.Items.Clear();
            var listItem = Enums.GetMembers <FontFamilyList>()
                           .Select(m => new ComboBoxItem()
            {
                Value       = m.AsString(EnumFormat.Name),
                DisplayName = m.AsString(EnumFormat.Description, EnumFormat.Name)
            }).ToArray();

            this.baseFontComboBox.Items.AddRange(listItem);
            this.baseFontComboBox.SelectedItem = listItem.Where(i => i.Value == this.BaseFont).FirstOrDefault() ?? listItem.First();
        }