public async void CheckEmailCorrectness() { if (Email != null && Email != "") { string emailPattern = @"^(?("")(""[^""]+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" + @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,17}))$"; if (Email.Length > 255) { EmailError = "Email should be no longer than 255 characters"; EmailIsCorrect = false; } else if (!Regex.IsMatch(Email, emailPattern, RegexOptions.CultureInvariant)) { EmailError = "Enter a valid email address"; EmailIsCorrect = false; } else if (!await serverWorker.TaskCheckEmail(Email)) { EmailError = "This email is already used"; EmailIsCorrect = false; } else { EmailError = " "; EmailIsCorrect = true; } } else { EmailError = "Please, enter your email"; EmailIsCorrect = false; } }