public List <BindingWrapper <ModuleType> > GetModuleTypes(ConnectionType connectionType) { List <BindingWrapper <ModuleType> > moduleTypes = new List <BindingWrapper <ModuleType> >(); if (connectionType != null && connectionType.ModuleTypes != null && connectionType.ModuleTypes.Any()) { foreach (ModuleType moduleType in connectionType.ModuleTypes) { BindingWrapper <ModuleType> wrapper = new BindingWrapper <ModuleType>( moduleType, m => { i18n localeItem = m.Locales.FirstOrDefault( l => l.Language == Settings.InterfaceLanguage ); string displayName = localeItem != null ? localeItem.Text : m.Id; return(displayName.RemoveWhitespaces()); } ); moduleTypes.Add(wrapper); } } return(moduleTypes); }
// Start is called before the first frame update void Start() { converter = new i18n(language, "fsm"); gameTimer = new Timer(); firstButton.Select(); setTestStateOne(); }
public BindingWrapper <ConnectionType> GetConnectionType(QuerySource dbType) { ConnectionType[] connectionTypes = Settings.SystemSettings.ConnectionTypes; if (connectionTypes != null) { foreach (ConnectionType connectionType in connectionTypes) { QuerySource querySource; if (Enum.TryParse(connectionType.Id, true, out querySource)) { if (querySource == dbType) { return(new BindingWrapper <ConnectionType>( connectionType, ct => { i18n localeItem = ct.Locales.FirstOrDefault( l => l.Language == Settings.InterfaceLanguage ); string displayName = localeItem != null ? localeItem.Text : ct.Id; return displayName.RemoveWhitespaces(); } )); } } } } return(null); }
private void setModuleTypeItems(DBType selectedDbType) { if (selectedDbType != null && selectedDbType.ModuleTypes != null && selectedDbType.ModuleTypes.Count() > 0) { List <KeyValuePair <string, string> > moduleTypes = new List <KeyValuePair <string, string> >(); foreach (ModuleType currentModuleType in selectedDbType.ModuleTypes) { i18n localeItem = currentModuleType.Locales.FirstOrDefault( l => l.Language == Program.Model.Settings.InterfaceLanguage); string localeText = localeItem != null ? localeItem.Text : currentModuleType.Id; moduleTypes.Add(new KeyValuePair <string, string>(localeText, currentModuleType.Id)); } cbModuleType.DataSource = moduleTypes; cbModuleType.Enabled = true; } else { cbModuleType.Enabled = false; } }
// Start is called before the first frame update void Start() { converter = new i18n(language, "helpers"); }
private void MatchTagHelper( int expected, string lhs, string rhs, i18n.LanguageTag.MatchGrade matchGrade = i18n.LanguageTag.MatchGrade.LanguageMatch) { MatchTagHelper1(expected, lhs, rhs, matchGrade); // If PrivateUse subtag not present in either tag...append such a subtag equally to both sides // and test again. This should have no effect on the result. if (-1 == lhs.IndexOf("-x-", StringComparison.OrdinalIgnoreCase) && -1 == rhs.IndexOf("-x-", StringComparison.OrdinalIgnoreCase)) { MatchTagHelper1(expected, lhs + "-x-abcd", rhs + "-x-abcd", matchGrade); } }
private void MatchTagHelper1( int expected, string lhs, string rhs, i18n.LanguageTag.MatchGrade matchGrade = i18n.LanguageTag.MatchGrade.LanguageMatch) { Assert.AreEqual(expected, (new i18n.LanguageTag(lhs).Match(new i18n.LanguageTag(rhs), matchGrade))); Assert.AreEqual(expected, (new i18n.LanguageTag(rhs).Match(new i18n.LanguageTag(lhs), matchGrade))); }
// Start is called before the first frame update void Start() { converter = new i18n(defaultLanguage, "savegame"); currentPlayerData.testString = "ASDF"; }
// Start is called before the first frame update void Start() { converter = new i18n(language, "helpers"); gameTimer = new Timer(); }
/// <summary> /// The load settings. /// </summary> private void LoadSettings() { List <DBType> dataBaseTypes = new List <DBType>(); if (Program.Model.Settings.SystemSettings.ConnectionTypes != null) { foreach (ConnectionType currentModuleType in Program.Model.Settings.SystemSettings.ConnectionTypes) { QuerySource currentSource; if (Enum.TryParse(currentModuleType.Id, true, out currentSource)) { i18n localeItem = currentModuleType.Locales.FirstOrDefault( l => l.Language == Program.Model.Settings.InterfaceLanguage); string localeText = localeItem != null ? localeItem.Text : currentModuleType.Id; dataBaseTypes.Add(new DBType() { Id = currentSource, Name = localeText, ModuleTypes = currentModuleType.ModuleTypes }); } } } this.dataBaseTypeBindingSource.DataSource = dataBaseTypes; if (this.cbDataBaseType.Items.Count > 0) { if (!string.IsNullOrEmpty(Program.Model.Settings.LastSelectedDataBaseType)) { DBType selItem = dataBaseTypes.FirstOrDefault(d => d.Name == Program.Model.Settings.LastSelectedDataBaseType); if (selItem != null) { this.cbDataBaseType.SelectedItem = selItem; setModuleTypeItems(selItem); } else { this.cbDataBaseType.SelectedItem = 0; } } else { this.cbDataBaseType.SelectedItem = 0; } } cbConnectionUpdate(); if (cbModuleType.Items.Count > 0) { if (!string.IsNullOrEmpty(Program.Model.Settings.LastSelectedTemplateType)) { List <KeyValuePair <string, string> > moduleTypes = cbModuleType.DataSource as List <KeyValuePair <string, string> >; KeyValuePair <string, string> selItem = moduleTypes.FirstOrDefault(m => m.Value == Program.Model.Settings.LastSelectedTemplateType); if (selItem.Value != null) { this.cbModuleType.SelectedItem = selItem; } else { this.cbModuleType.SelectedItem = 0; } } else { this.cbModuleType.SelectedItem = 0; } } if (!string.IsNullOrEmpty(Program.Model.Settings.LastSelectedTemplateId) && this.cbTemplate.Items.Cast <Template>() .Any(x => x.Id == Program.Model.Settings.LastSelectedTemplateId)) { this.cbTemplate.SelectedValue = Program.Model.Settings.LastSelectedTemplateId; } UpdateAddConnectionButtonState(); }
private void InitializeBindings() { // retrieve connection type ConnectionType connectionType = null; InstanceInfo firstInstance = this._connectionGroup.Connections.FirstOrDefault(); if (firstInstance != null) { BindingWrapper <ConnectionType> typeWrapper = this._model.GetConnectionType(firstInstance.Type); if (typeWrapper != null) { connectionType = typeWrapper.Item; cmbDataBaseType.DataSource = Lists.Of(typeWrapper); } } Template template = null; if (this._connectionGroup.IsExternal) { this.optOpenTemplateFromFile.Checked = true; string path = Path.Combine( this._connectionGroup.TemplateDir, this._connectionGroup.TemplateFileName ); this.cmbPathToFile.DataSource = Lists.Of(path); XmlSerializer serializer = new XmlSerializer(typeof(Template)); XmlDocument docTemplate = new XmlDocument(); docTemplate.Load(path); using (XmlNodeReader nodeReader = new XmlNodeReader(docTemplate)) { using (XmlReader xmlReader = XmlReader.Create(nodeReader, XmlUtils.GetXmlReaderSettings())) { template = (Template)serializer.Deserialize(xmlReader); } } } else { this.optSelectExistTemplate.Checked = true; template = this._templates.Value.FirstOrDefault(t => t.Id == this._connectionGroup.TemplateId); if (template != null) { TemplateNodeLocaleInfo locale = template.Locales.FirstOrDefault( l => l.Language == Settings.InterfaceLanguage ); string templateName = (locale ?? template.Locales.First()).Text; this.cmbTemplate.DataSource = Lists.Of(templateName.RemoveWhitespaces()); } } if (template != null && connectionType != null) { string templateType = template.Type; ModuleType moduleType = connectionType.ModuleTypes.FirstOrDefault( m => m.Id == templateType ); if (moduleType != null) { BindingWrapper <ModuleType> moduleWrapper = new BindingWrapper <ModuleType>( moduleType, module => { i18n localeItem = module.Locales.FirstOrDefault( l => l.Language == Settings.InterfaceLanguage); string displayName = localeItem != null ? localeItem.Text : module.Id; return(displayName.RemoveWhitespaces()); } ); cmbModuleTypes.DataSource = Lists.Of(moduleWrapper); } FillConnections(connectionType); SelectCurrentGroup(); txtGroupName.Text = this._connectionGroup.Name; } }
// Start is called before the first frame update void Start() { converter = new i18n(defaultLanguage, "i18n"); languageGermanButton.Select(); }