private async void CreateUserAccountForm_Load(object sender, EventArgs e) { languagesCBox.DisplayMember = nameof(LanguageViewModel.Name); languagesCBox.DataSource = Mapper.Map <IEnumerable <LanguageModel>, IEnumerable <LanguageViewModel> >(await _languagesService.GetLanguages()).ToArray(); _requaredTextBoxes = userProfilePanel.Controls.OfType <TextBox>().Except(new[] { countryTBox, companyTBox }).ToArray(); _errorLabels = userProfilePanel.Controls.OfType <Label>().Where(_ => _.Name.StartsWith("error")).ToArray(); }
private async void UserAccountForm_Load(object sender, EventArgs e) { _passwordInputTextBoxes = passwordPanel.Controls.OfType <TextBox>().ToList(); Func <Label, bool> errorLambda = _ => _.Name.StartsWith("error"); _errorPasswordLabels = passwordPanel.Controls.OfType <Label>().Where(errorLambda).ToList(); _errorLabels = userProfilePanel.Controls.OfType <Label>().Where(errorLambda) .Union(_errorPasswordLabels) .ToArray(); languagesCBox.DisplayMember = nameof(LanguageViewModel.Name); languagesCBox.DataSource = Mapper.Map <IEnumerable <LanguageModel>, IEnumerable <LanguageViewModel> >(await _languagesService.GetLanguages()).ToArray(); SetCurrentUserValues(); }