Example #1
0
        private async Task ExecuteSearchCheesesCommand(string s)
        {
            try {
                SearchCheesesCommand.ChangeCanExecute();

                var searchedCheese = await _dataService.SearchCheeseAsync(s.ToString());

                Cheeses.Clear();

                foreach (var cheese in searchedCheese)
                {
                    Cheeses.Add(cheese);
                }
            } catch (NoInternetException) {
                await Page.DisplayAlert("No Internet!", "Cannot Access The Internet!", "Darn!");
            } finally {
                SearchCheesesCommand.ChangeCanExecute();
            }
        }
Example #2
0
        private async Task ExecuteGetRecentCheesesCommand()
        {
            try {
                GetRecentCheesesCommand.ChangeCanExecute();

                var recentCheese = await _dataService.GetRecentCheesesAsync();

                Cheeses.Clear();

                foreach (var cheese in recentCheese)
                {
                    Cheeses.Add(cheese);
                }
            } catch (NoInternetException) {
                await Page.DisplayAlert("No Internet!", "Cannot Access The Internet!", "Darn!");
            } finally {
                GetRecentCheesesCommand.ChangeCanExecute();
            }
        }