Exemplo n.º 1
0
 async Task ShowTypeAsync(string type)
 {
     if (IsBusy)
     {
         return;
     }
     try
     {
         IsBusy = true;
         ListingShrooms.Clear();
         foreach (var m in Shrooms)
         {
             if (m.Usage.Equals(type))
             {
                 ListingShrooms.Add(m);
             }
         }
     }catch (Exception e)
     {
         Debug.WriteLine($"Error retieving shrooms: {e.Message}");
         await Application.Current.MainPage.DisplayAlert("Error", e.Message, "Ok");
     }
     finally
     {
         IsBusy = false;
     }
 }
Exemplo n.º 2
0
        async Task GetShroomsAsync()
        {
            if (IsBusy)
            {
                return;
            }
            try
            {
                IsBusy = true;
                var mushies = await DataService.GetMushroomsAsync();

                Shrooms.Clear();
                ListingShrooms.Clear();
                foreach (var mushroom in mushies)
                {
                    Shrooms.Add(mushroom);
                    ListingShrooms.Add(mushroom);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error retieving shrooms: {e.Message}");
                await Application.Current.MainPage.DisplayAlert("Error", e.Message, "Ok");
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 3
0
 async Task GetAllAsync()
 {
     ListingShrooms.Clear();
     try
     {
         foreach (var m in Shrooms)
         {
             ListingShrooms.Add(m);
         }
     }catch (Exception e)
     {
         Debug.WriteLine($"Error retieving shrooms: {e.Message}");
         await Application.Current.MainPage.DisplayAlert("Error", e.Message, "Ok");
     }
 }