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; } }
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; } }
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"); } }