async Task <ObservableCollection <Speaker> > GetSpeakers() { var speakers = new ObservableCollection <Speaker>(); try { Loader.IsVisible = true; Loader.IsRunning = true; var service = new AzureService(); var items = await service.GetSpeakers(); speakers.Clear(); foreach (var item in items) { speakers.Add(item); } } catch (Exception ex) { Debug.WriteLine("Error: " + ex); await Application.Current.MainPage.DisplayAlert("Error!", ex.Message, "OK"); } finally { Loader.IsVisible = false; Loader.IsRunning = false; } return(speakers); }
//Add a New User async Task AddUser() { try { Loader.IsVisible = true; Loader.IsRunning = true; var service = new AzureService(); await service.AddSpeaker(Speaker); } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Error", ex.Message, "OK"); } finally { Loader.IsVisible = false; Loader.IsRunning = false; } }