public ClassController() { _db = WaffleContext.CreateDb(); repo = ClassRepository.CreateRepo(); cat = ClassCategoryRepository.CreateRepo(); levels = ClassLevelRepository.CreateRepo(); types = ClassTypeRepository.CreateRepo(); }
private async void refreshClasses() { thisApp = Application.Current as App; showClasses(); classResult.Text = "All Classes"; ClassTypeRepository ct = new ClassTypeRepository(); try { classTypes.Add(new ClassType { ID = 0, Name = "All Class Types" }); thisApp.AllClassTypes = await ct.GetClassTypes(); foreach (ClassType c in thisApp.AllClassTypes.OrderBy(n => n.Name)) { classTypes.Add(c); } // I decide not to have a picker on class view but buttons } 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 { if (ex.Message.Contains("NameResolutionFailure")) { await DisplayAlert("Internet Access Error ", "Cannot resolve the Uri: " + Jeeves.DBUri.ToString(), "Ok"); } else { await DisplayAlert("General Error ", ex.Message, "Ok"); } } } }