private async void showSkills(int?ClassID) { SkillRepository s = new SkillRepository(); try { List <Skill> skills; if (ClassID.GetValueOrDefault() > 0) { skills = await s.GetSkillByClass(ClassID.GetValueOrDefault()); } else { skills = await s.GetSkills(); } skillList.ItemsSource = skills; skillList.IsVisible = true; } catch (Exception ex) { if (ex.InnerException != null) { if (ex.GetBaseException().Message.Contains("connection with the server")) { await DisplayAlert("Error", "No connection with the server. Check that the Web Service is running and available and then click the Refresh button.", "Ok"); } else { await DisplayAlert("Error", "If the problem persists, please call your system administrator.", "Ok"); } } else { await DisplayAlert("General Error", "If the problem persists, please call your system administrator.", "Ok"); } } }