Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 //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;
     }
 }