예제 #1
0
        public GeneralSettings(IConfig currentConfig, ILanguageProvider languageProvider)
        {
            var langs = languageProvider.AvailableLanguages.ToList();

            for (int i = 0; i < langs.Count; ++i)
            {
                if (langs[i].Equals(CultureInfo.InvariantCulture))
                {
                    langs[i] = CultureInfo.CreateSpecificCulture("en-US");
                }
            }

            var neutrals = langs.Where(l => l.IsNeutralCulture).ToArray();

            foreach (var neutral in neutrals.Where(neutral => langs.Any(l => neutral.Equals(l.Parent))))
            {
                langs.Remove(neutral);
            }

            AvailableLanguages = langs.Distinct().OrderBy(l => l.NativeName).ToList();

            AvailableFetchCounts = new[] { 20, 50, 100, 200 };

            var english = AvailableLanguages.FirstOrDefault(IsEnglish);

            RealtimeStreaming        = currentConfig.General.RealtimeStreaming;
            SelectedLanguage         = AvailableLanguages.SingleOrDefault(l => l.Name == currentConfig.General.Language) ?? english;
            CheckForUpdates          = currentConfig.General.CheckForUpdates;
            IncludePrereleaseUpdates = currentConfig.General.IncludePrereleaseUpdates;
            TweetFetchCount          = currentConfig.General.TweetFetchCount;
            FilterSensitiveTweets    = currentConfig.General.FilterSensitiveTweets;
            SendVersionStats         = currentConfig.General.SendVersionStats;
        }
 /// <summary>
 /// Initializes a new instance of the SettingsViewModel class.
 /// </summary>
 public SettingsViewModel()
 {
     AvailableLanguages = Configurator.returnAllLanguages();
     selectedLanguage   = AvailableLanguages.SingleOrDefault(l => l.FileName ==
                                                             Configurator.getLanguage());
     FindCommand = new RelayCommand(SelectGameFolder);
     if (!Configurator.getFirstStart())
     {
         Message = LocalizationHelper.getValueForKey("First_Start");
     }
     else
     {
         Message = "";
     }
 }