I am working in xamarin cross plateform application,and new one in this domain,have to contend page Login,and main page,after clicking on login user must redirect to main page. here is the code.
async void _client_ValidateUserCompleted(object sender, FypWcf.ValidateUserCompletedEventArgs e)
{
try
{
if (e.Result == true)
{
await Navigation.PushAsync(new MainForm());
}
else
{
await DisplayAlert("Oops", "Credentials are incorrect", "Cancel");
}
}
catch (Exception ex)
{
await DisplayAlert(ex.Message, "Credentials are incorrect", "Cancel");
}
}
private void Button_Clicked_1(object sender, EventArgs e)
{
try
{
var endpoint = new EndpointAddress("http://192.168.43.101/FYP_Admin/webservices/cmsservice.svc");
var binding = new BasicHttpBinding
{
Name = "basicHttpBinding",
MaxBufferSize = 2147483647,
MaxReceivedMessageSize = 2147483647
};
TimeSpan timeout = new TimeSpan(0, 0, 30);
binding.SendTimeout = timeout;
binding.OpenTimeout = timeout;
binding.ReceiveTimeout = timeout;
_client = new FypWcf.CMSServiceClient(binding, endpoint);
string username = usernameEntry.Text.Trim();
string password = passwordEntry.Text.Trim();
_client.ValidateUserAsync(username, password);
_client.ValidateUserCompleted += _client_ValidateUserCompleted;
}
catch (Exception ex)
{
DisplayAlert(ex.Message, "Credentials are incorrect", "Cancel");
}
}
Problem is when login button is clicked,and debug the code its through exception,