in Silverlight we do Async Calls
So the first part when calling the service after you generated a Proxy should something like this
business.AddContactNumberAsync(model);
business.AddContactNumberCompleted += new EventHandler<AddContactNumberCompletedEventArgs>(business_AddContactNumberCompleted);
and this(AddContactNumberCompletedEventArgs) will be generated for you and to do error handling on it or bring the error from the service it should be something like this
void business_AddContactNumberCompleted(object sender, AddContactNumberCompletedEventArgs e)
{
if (e.Error == null)
{
if (e.Result == "")
{
MessageBox.Show("Successfully Added");
this.DialogResult = true;
}
else
{
MessageBox.Show("Contact was not Added");
}
}
else
{
MessageBox.Show("Service not Available");
}
}
as you can see we check if the Error property is null, if its not null we show some generic error and probably log the error
Thank you for posting at Dotnetfunda
[Administrator]
Santoshkumar, if this helps please login to Mark As Answer. | Alert Moderator