protected override void OnStartup(StartupEventArgs e) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); Configuration = builder.Build(); var serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); ServiceProvider = serviceCollection.BuildServiceProvider(); LanguageChanged += App_LanguageChanged; Languages.Clear(); Languages.Add(new CultureInfo("en-US")); Languages.Add(new CultureInfo("ru-RU")); Language = LearningDataStorage.Properties.Settings.Default.DefaultLanguage; var mainWindow = ServiceProvider.GetRequiredService <MainWindow>(); mainWindow.Show(); }
/// <summary> /// Clears all the global /// </summary> public static void ClearValues() { AccountingGroups.Clear(); CostProfileGroups.Clear(); CountriesOfOrigin.Clear(); CustomerIdConversions.Clear(); ExternalIdTypes.Clear(); ItemCategories.Clear(); ItemGroups.Clear(); ItemIds.Clear(); ItemIdSuffixes.Clear(); ItemRecords.Clear(); Languages.Clear(); Licenses.Clear(); LocalItemIds.Clear(); MetaDescriptions.Clear(); PricingGroups.Clear(); ProductCategories.Clear(); ProductFormats.Clear(); ProductGoups.Clear(); ProductLines.Clear(); Properties.Clear(); PsStatuses.Clear(); RequestStatus.Clear(); SpecialCharacters.Clear(); TariffCodes.Clear(); Territories.Clear(); ToolTips.Clear(); UpcProductFormatExceptions.Clear(); Upcs.Clear(); UserNames.Clear(); UserRoles.Clear(); WebCategoryList.Clear(); }
public App() { App.LanguageChanged += App_LanguageChanged; Languages.Clear(); Languages.Add(new CultureInfo("en-US")); Languages.Add(new CultureInfo("ru-RU")); }
private void ReloadLanguages() { Languages.Clear(); foreach (var language in _languageService.Languages) { Languages.Add(language); } }
private void LoadLanguages(string content) { var reader = string.IsNullOrEmpty(Delimiter) ? new CsvFileReader(content) : new CsvFileReader(content, Delimiter[0]); Languages.Clear(); MakeDictionary(reader); FillDictionary(reader); ClearDictionary(); }
/// <summary> /// 卸载所有本地化配置表 /// </summary> public void Unload() { OnLanguageChangedReRead -= OnLanguageRead; Languages.Clear(); //xmlDocument = null; //Array.Clear(allCSVFiles, 0, allCSVFiles.Length); LanguagesCSVFiles.Clear(); LocalizeDataTable.Clear(); }
public App() { // if (!Directory.Exists("DigimonPic")) // Directory.CreateDirectory("DigimonPic"); Languages.Clear(); Languages.Add(new CultureInfo("en-US")); //Нейтральная культура для этого проекта Languages.Add(new CultureInfo("ru-RU")); LanguageChanged += App_LanguageChanged; }
private async Task LoadLanguagesAsync() { Languages.Clear(); var lookup = await _languageLookupDataService.GetLanguageLookupAsync(); foreach (var item in lookup) { Languages.Add(item); } }
private void fillSupportedLanguages(string[] languages) { Languages.Clear(); foreach (var language in BodyArchitect.Service.V2.Model.Language.Languages) { if (languages.Contains(language.Shortcut)) { Languages.Add(language); } } SelectedLanguage = Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName; }
public void CancelEdit() { if (!_isEditing) { return; } Donated = _mDonated; CheckUpdates = _mCheckUpdates; CurrentLanguage = _mCurrentLanguage; Delimiters = _mDelimiters; Tasks.Clear(); foreach (Task task in _mTtasks) { Tasks.Add(task); task.CancelEdit(); } Profiles.Clear(); foreach (Profile profile in _mProfiles) { Profiles.Add(profile); profile.CancelEdit(); } MoveList.Clear(); foreach (PositionTransform positionTransform in _mMoveList) { MoveList.Add(positionTransform); positionTransform.CancelEdit(); } CopyList.Clear(); foreach (PositionTransform positionTransform in _mCopyList) { CopyList.Add(positionTransform); positionTransform.CancelEdit(); } Languages.Clear(); foreach (Language language in _mLanguages) { Languages.Add(language); language.CancelEdit(); } _mProfiles.Clear(); _mMoveList.Clear(); _mCopyList.Clear(); _mLanguages.Clear(); _mTtasks.Clear(); _isEditing = false; }
public void Clear() { Languages.Clear(); Currencies.Clear(); StoreMappings.Clear(); CustomerRoleMappings.Clear(); Manufacturers.Clear(); Categories.Clear(); DeliveryTimes.Clear(); Translations.Clear(); CustomProperties.Clear(); }
protected override void LoadLanguages() { if (Languages.Count > 0) { return; } using (var client = GetHttpClient()) { client.DefaultRequestHeaders.Add("Accept-Language", "en"); var builder = GetUriBuilder("languages"); try { var query = HttpUtility.ParseQueryString(builder.Query); query["scope"] = "translation"; builder.Query = query.ToString(); var url = builder.ToString(); var result = client.GetStringAsync(url).Result; // { // "translation": // { // "af": // { // "name":"Afrikaans", // "nativeName":"Afrikaans", // "dir":"ltr" // }, // ... // } // } var root = JObject.Parse(result); var translations = (JObject)root["translation"]; foreach (var item in translations) { JObject language = (JObject)item.Value; Languages.Add(new Language { Id = MicrosoftIdToId(item.Key), Name = language["name"].Value <string>() }); } } catch (Exception) { Languages.Clear(); } } }
private void UpdateParserLibs(NitraClient client) { try { RemoveDuplicates(ParserLibs, pl => ToFullSuitePath(pl.Path)); var libsArray = ParserLibs.Select(vm => ToFullSuitePath(vm.Path)).ToImmutableArray(); client.Send(new ClientMessage.GetLibsMetadata(libsArray)); var libsMetadata = client.Receive <ServerMessage.LibsMetadata>().metadatas; client.Send(new ClientMessage.GetLibsSyntaxModules(libsArray)); var libsSyntaxModules = client.Receive <ServerMessage.LibsSyntaxModules>().modules; client.Send(new ClientMessage.GetLibsProjectSupports(libsArray)); var libsProjectSupports = client.Receive <ServerMessage.LibsProjectSupports>().libs; Languages.Clear(); DynamicExtensions.Clear(); ProjectSupports.Clear(); for (int i = 0; i < libsMetadata.Length; i++) { var languages = libsMetadata[i].Languages; var syntaxModules = libsSyntaxModules[i].Modules; var projectSupports = libsProjectSupports[i].ProjectSupports; foreach (var language in languages) { Languages.Add(language); } if (!Languages.IsEmpty) { SelectedLanguage = Languages[0]; } foreach (var syntaxModule in syntaxModules) { DynamicExtensions.Add(new DynamicExtensionViewModel(syntaxModule)); } foreach (var projectSupport in projectSupports) { ProjectSupports.Add(new ProjectSupportViewModel(projectSupport.Caption, projectSupport.Path, projectSupport)); } } } catch (Exception e) { Debug.WriteLine("Failed to update parser lib metadata" + Environment.NewLine + e); } }
public async Task GetLangueges() { var dowloader = new AsynchronousDowloader(); var json = await dowloader.Get("http://private-9d572-asynchronoustasks.apiary-mock.com/basic"); var languages = new Parser().Parse(json).Languages; Languages.Clear(); foreach (var language in languages) { Languages.Add(language); } CanDownload = true; }
private void InitWindow() { switch (InputMode) { case InputMode.ByCard: { Cards.Clear(); Cards.AddRange(_allCardSorted.Keys); Editions.Clear(); EditionSelected = null; CardSelectedName = null; break; } case InputMode.ByEdition: { Cards.Clear(); IEdition save = EditionSelected; Editions.Clear(); Editions.AddRange(_allEditions); CardSelectedName = null; EditionSelected = save; break; } case InputMode.None: Cards.Clear(); Editions.Clear(); EditionSelected = null; CardSelectedName = null; break; } Languages.Clear(); CurrentCollectionDetail = null; LanguageSelected = null; Count = _defaultQuantity; IsFoil = false; IsAltArt = false; ResetFocus(); }
public static void RefreshLanguages(bool includeIncomplete) { // Clear the collection Languages.Clear(); // Add complete languages Languages.AddRange(new CultureInfo[] { DefaultCulture, // Dutch (Netherlands) new CultureInfo("nl-NL"), // Italian (Italy) new CultureInfo("it-IT"), // Polish (Poland) new CultureInfo("pl-PL"), // Portuguese (Portugal) new CultureInfo("pt-PT"), // Russian (Russia) new CultureInfo("ru-RU"), }); if (includeIncomplete) { // Add incomplete languages Languages.AddRange(new CultureInfo[] { // Serbian (Cyrillic) new CultureInfo("sr-Cyrl"), // Spanish (Mexico) new CultureInfo("es-MX"), // Spanish (Spain) new CultureInfo("es-ES"), // Swedish (Sweden) new CultureInfo("sv-SE"), }); } }
private void UpdateBaseInfo() { if (this.Capital == null || this.Continent == null || this.CurrencyCode == null || this._flagUrl == null || this.Languages == null || this.PhoneCode == 0 || this.Name == null) { var countryInfo = _webService.GetFullCoutryInfo(this.IsoCode2Letters); this.Name = countryInfo.sName; this.Capital = countryInfo.sCapitalCity; this.Continent = Continent.GetContinent(countryInfo.sContinentCode); this.CurrencyCode = countryInfo.sCurrencyISOCode; this._flagUrl = countryInfo.sCountryFlag; try { this.PhoneCode = int.Parse(countryInfo.sPhoneCode); } catch (FormatException) { this.PhoneCode = 0; } if (this.Languages != null) { Languages.Clear(); } this.Languages = new List <Language>(); foreach (var lang in countryInfo.Languages) { this.Languages.Add(new Language { IsoCode = lang.sISOCode, LanguageName = lang.sName }); } //notify listeners (if there is any) that base info has changed if (OnCountryInfoUpdated != null) { OnCountryInfoUpdated(this, new InfoUpdateEventArgs(InfoUpdateEventArgs.InfoParts.BaseInfo)); } } }
protected override void OnStartup(StartupEventArgs e) { ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(A3ServerTool.Properties.Settings.Default.AccentColor), ThemeManager.GetAppTheme(A3ServerTool.Properties.Settings.Default.BackgroundTheme)); ApplyControlBackground(); base.OnStartup(e); Languages.Clear(); Languages.Add(new CultureInfo("en-US")); Languages.Add(new CultureInfo("de-DE")); Languages.Add(new CultureInfo("ru-RU")); LanguageChanged += App_LanguageChanged; BackgroundThemeChanged += App_BackgroundThemeChanged; AccentColorChanged += App_AccentColorChanged; Language = A3ServerTool.Properties.Settings.Default.Language; Bindings.Register(); }
private void Load_LocalizationCSVConfig(string _strConfigPath) { ScpReader LocalizationConfigReader = new ScpReader(_strConfigPath, true, 2); var d = ULanguageInfo.zhCn; Languages.Clear(); for (int i = 0; i < LocalizationConfigReader.GetRecordCount(); ++i) { int id = LocalizationConfigReader.GetInt(i, (int)ELocalizationConfig.ELC_ID, -1); string strABBName = LocalizationConfigReader.GetString(i, (int)ELocalizationConfig.ELC_ABB, string.Empty); if (id != -1 && id < 1000) { var language = new ULanguageInfo(strABBName); Languages.Add(language); //是否是默认语言 if (LocalizationConfigReader.GetInt(i, (int)ELocalizationConfig.ELC_DEF, 0) == 1) { d = language; } } else if (id != -1 && id >= 1000) { if (!LanguagesCSVFiles.Contains(strABBName)) { LanguagesCSVFiles.Add(strABBName); } else { Trace.LogWarning("本地化文件配置里有重复文件名:" + strABBName); } } } Language = d; }
private void RefreshDisplayedData(InputMode modifyData) { UpdateCurrentCollectionDetailAndTranslate(); //None one the key changed, nothing to recompute if (modifyData == InputMode.None) { return; } //Change one of the key but no the reference one if (InputMode != modifyData) { Languages.Clear(); IEdition editionSelected = EditionSelected; ICard cardNameSelected = _cardSelected; if (editionSelected == null || cardNameSelected == null) { return; } ICardAllDbInfo cardAllDbInfo = _allCardInfos.First(cadi => cadi.Edition == editionSelected && cadi.Card == cardNameSelected); if (cardAllDbInfo == null) { return; } foreach (ILanguage language in _magicDatabase.GetLanguages(cardAllDbInfo.IdGatherer)) { Languages.Add(language); } if (Languages.Count > 0) { if (_inputLanguage != null && Languages.Contains(_inputLanguage)) { LanguageSelected = _inputLanguage; } else { LanguageSelected = Languages[0]; } } } else { //Change the reference switch (InputMode) { case InputMode.ByEdition: IEdition editionSelected = EditionSelected; Cards.Clear(); Languages.Clear(); if (editionSelected == null) { return; } List <string> sorted = new List <string>(); //Could not call directly GetAllCardsOrderByTranslation because the key must be the same as in all card even if there is no duplicate traduction in the subset foreach (KeyValuePair <string, ICard> kv in _allCardInfos.Where(cadi => cadi.Edition == editionSelected).GetAllCardWithTranslation(_inputLanguage)) { //Normal case if (_allCardSorted.ContainsKey(kv.Key)) { sorted.Add(kv.Key); } else { //Key was changed because of duplicate traduction, we need to look for the card sorted.Add(_allCardSorted.First(acsKv => kv.Value == acsKv.Value).Key); } } sorted.Sort(); Cards.AddRange(sorted); break; case InputMode.ByCard: ICard cardNameSelected = _cardSelected; Editions.Clear(); Languages.Clear(); if (cardNameSelected == null) { return; } foreach (IEdition edition in _allCardInfos.GetAllEditionIncludingCardOrdered(cardNameSelected)) { Editions.Add(edition); } if (Editions.Count > 0) { EditionSelected = Editions[0]; } break; } } }
private void InitializeSettings() { // Refresh rate RefreshRates.Clear(); RefreshRates.Add(new RefreshRateStruct() { Name = LanguageController.Translation("5_SECONDS"), Seconds = 5000 }); RefreshRates.Add(new RefreshRateStruct() { Name = LanguageController.Translation("10_SECONDS"), Seconds = 10000 }); RefreshRates.Add(new RefreshRateStruct() { Name = LanguageController.Translation("30_SECONDS"), Seconds = 30000 }); RefreshRates.Add(new RefreshRateStruct() { Name = LanguageController.Translation("60_SECONDS"), Seconds = 60000 }); RefreshRates.Add(new RefreshRateStruct() { Name = LanguageController.Translation("5_MINUTES"), Seconds = 300000 }); RefreshRatesSelection = RefreshRates.FirstOrDefault(x => x.Seconds == Settings.Default.RefreshRate); Languages.Clear(); foreach (var langInfos in LanguageController.LanguageFiles) { Languages.Add(new LanguageController.FileInfo() { FileName = langInfos.FileName }); } LanguagesSelection = Languages.FirstOrDefault(x => x.FileName == LanguageController.CurrentCultureInfo.TextInfo.CultureName); // Update item list by days UpdateItemListByDays.Clear(); UpdateItemListByDays.Add(new UpdateItemListStruct() { Name = LanguageController.Translation("EVERY_DAY"), Value = 1 }); UpdateItemListByDays.Add(new UpdateItemListStruct() { Name = LanguageController.Translation("EVERY_3_DAYS"), Value = 3 }); UpdateItemListByDays.Add(new UpdateItemListStruct() { Name = LanguageController.Translation("EVERY_7_DAYS"), Value = 7 }); UpdateItemListByDays.Add(new UpdateItemListStruct() { Name = LanguageController.Translation("EVERY_14_DAYS"), Value = 14 }); UpdateItemListByDays.Add(new UpdateItemListStruct() { Name = LanguageController.Translation("EVERY_28_DAYS"), Value = 28 }); UpdateItemListByDaysSelection = UpdateItemListByDays.FirstOrDefault(x => x.Value == Settings.Default.UpdateItemListByDays); ItemListSourceUrl = Settings.Default.ItemListSourceUrl; IsOpenItemWindowInNewWindowChecked = Settings.Default.IsOpenItemWindowInNewWindowChecked; ShowInfoWindowOnStartChecked = Settings.Default.ShowInfoWindowOnStartChecked; FullItemInformationUpdateCycleDays = Settings.Default.FullItemInformationUpdateCycleDays; }
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 }