private void InitializeSettings() { #region Refrash rate RefreshRates.Clear(); RefreshRates.Add(new FileSettingInformation() { Name = LanguageController.Translation("5_SECONDS"), Value = 5000 }); RefreshRates.Add(new FileSettingInformation() { Name = LanguageController.Translation("10_SECONDS"), Value = 10000 }); RefreshRates.Add(new FileSettingInformation() { Name = LanguageController.Translation("30_SECONDS"), Value = 30000 }); RefreshRates.Add(new FileSettingInformation() { Name = LanguageController.Translation("60_SECONDS"), Value = 60000 }); RefreshRates.Add(new FileSettingInformation() { Name = LanguageController.Translation("5_MINUTES"), Value = 300000 }); RefreshRatesSelection = RefreshRates.FirstOrDefault(x => x.Value == Settings.Default.RefreshRate); #endregion #region Language Languages.Clear(); foreach (var langInfo in LanguageController.LanguageFiles) { try { var cultureInfo = CultureInfo.CreateSpecificCulture(langInfo.FileName); Languages.Add(new FileInformation(langInfo.FileName, string.Empty) { EnglishName = cultureInfo.EnglishName, NativeName = cultureInfo.NativeName }); } catch (CultureNotFoundException e) { Log.Error(nameof(InitializeSettings), e); } } LanguagesSelection = Languages.FirstOrDefault(x => x.FileName == LanguageController.CurrentCultureInfo.TextInfo.CultureName); #endregion #region Update item list by days UpdateItemListByDays.Clear(); UpdateItemListByDays.Add(new FileSettingInformation() { Name = LanguageController.Translation("EVERY_DAY"), Value = 1 }); UpdateItemListByDays.Add(new FileSettingInformation() { Name = LanguageController.Translation("EVERY_3_DAYS"), Value = 3 }); UpdateItemListByDays.Add(new FileSettingInformation() { Name = LanguageController.Translation("EVERY_7_DAYS"), Value = 7 }); UpdateItemListByDays.Add(new FileSettingInformation() { Name = LanguageController.Translation("EVERY_14_DAYS"), Value = 14 }); UpdateItemListByDays.Add(new FileSettingInformation() { Name = LanguageController.Translation("EVERY_28_DAYS"), Value = 28 }); SettingByDaysSelection = UpdateItemListByDays.FirstOrDefault(x => x.Value == Settings.Default.UpdateItemListByDays); ItemListSourceUrl = Settings.Default.ItemListSourceUrl; IsOpenItemWindowInNewWindowChecked = Settings.Default.IsOpenItemWindowInNewWindowChecked; ShowInfoWindowOnStartChecked = Settings.Default.ShowInfoWindowOnStartChecked; FullItemInformationUpdateCycleDays = Settings.Default.FullItemInformationUpdateCycleDays; #endregion #region Alert Sounds AlertSounds.Clear(); foreach (var sound in SoundController.AlertSounds) { AlertSounds.Add(new FileInformation(sound.FileName, sound.FilePath)); } AlertSoundSelection = AlertSounds.FirstOrDefault(x => x.FileName == Settings.Default.SelectedAlertSound); #endregion }
private void InitializeSettings() { #region Refrash rate RefreshRates.Clear(); RefreshRates.Add(new FileSettingInformation() { Name = LanguageController.Translation("5_SECONDS"), Value = 5000 }); RefreshRates.Add(new FileSettingInformation() { Name = LanguageController.Translation("10_SECONDS"), Value = 10000 }); RefreshRates.Add(new FileSettingInformation() { Name = LanguageController.Translation("30_SECONDS"), Value = 30000 }); RefreshRates.Add(new FileSettingInformation() { Name = LanguageController.Translation("60_SECONDS"), Value = 60000 }); RefreshRates.Add(new FileSettingInformation() { Name = LanguageController.Translation("5_MINUTES"), Value = 300000 }); RefreshRatesSelection = RefreshRates.FirstOrDefault(x => x.Value == Settings.Default.RefreshRate); #endregion #region Language Languages.Clear(); foreach (var langInfo in LanguageController.LanguageFiles) { Languages.Add(new FileInformation() { FileName = langInfo.FileName }); } LanguagesSelection = Languages.FirstOrDefault(x => x.FileName == LanguageController.CurrentCultureInfo.TextInfo.CultureName); #endregion #region Update item list by days UpdateItemListByDays.Clear(); UpdateItemListByDays.Add(new FileSettingInformation() { Name = LanguageController.Translation("EVERY_DAY"), Value = 1 }); UpdateItemListByDays.Add(new FileSettingInformation() { Name = LanguageController.Translation("EVERY_3_DAYS"), Value = 3 }); UpdateItemListByDays.Add(new FileSettingInformation() { Name = LanguageController.Translation("EVERY_7_DAYS"), Value = 7 }); UpdateItemListByDays.Add(new FileSettingInformation() { Name = LanguageController.Translation("EVERY_14_DAYS"), Value = 14 }); UpdateItemListByDays.Add(new FileSettingInformation() { Name = LanguageController.Translation("EVERY_28_DAYS"), Value = 28 }); SettingByDaysSelection = UpdateItemListByDays.FirstOrDefault(x => x.Value == Settings.Default.UpdateItemListByDays); ItemListSourceUrl = Settings.Default.ItemListSourceUrl; IsOpenItemWindowInNewWindowChecked = Settings.Default.IsOpenItemWindowInNewWindowChecked; ShowInfoWindowOnStartChecked = Settings.Default.ShowInfoWindowOnStartChecked; FullItemInformationUpdateCycleDays = Settings.Default.FullItemInformationUpdateCycleDays; #endregion #region Alert Sounds AlertSounds.Clear(); foreach (var sound in SoundController.AlertSounds) { AlertSounds.Add(new FileInformation() { FileName = sound.FileName, FilePath = sound.FilePath }); } AlertSoundSelection = AlertSounds.FirstOrDefault(x => x.FileName == Settings.Default.SelectedAlertSound); #endregion }