This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<StackLayout VerticalOptions="Center" HorizontalOptions="Center"> | |
<Entry x:Name="EntryEmail" Placeholder="Enter Email"/> | |
<Label x:Name="LabelError" TextColor="Red"/> | |
<Button Text="Lets Validate" Clicked="Validar" | |
BackgroundColor="SeaGreen" TextColor="Wheat"/> | |
</StackLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Validar(Object sender, EventArgs e) | |
{ | |
var email = EntryEmail.Text; | |
var emailPattern = "^([\\w\\.\\-]+)@([\\w\\-]+)((\\.(\\w){2,3})+)$"; | |
if (!String.IsNullOrWhiteSpace(email) && !(Regex.IsMatch(email, emailPattern))) | |
{ | |
LabelError.Text = "EmailVerification Failed"; | |
} | |
else | |
{ | |
LabelError.Text = ""; | |
} | |
} |
No comments:
Post a Comment