Пример #1
0
        public CocktailViewModel()
        {
            GetGlasses();
            GetDrinksWithAPICommand = new Command(async() =>
            {
                if (networkAccess == NetworkAccess.Internet)
                {
                    Drinks = new ObservableCollection <Drink>(await _cocktailServices.GetDrinksByCocktailGlass(CocktailGlass));
                }
                else
                {
                    await App.Current.MainPage.DisplayAlert(ErrorConnection, ErrorMessage, "Cancel");
                }
                IsApiService   = true;
                IsRefitService = false;
                ApiColor       = SelectedColor;
                RefitColor     = DefaultColor;
            });
            GetDrinksWithRefitCommand = new Command(async() =>
            {
                if (networkAccess == NetworkAccess.Internet)
                {
                    GetDrinksWithRefit();
                }
                else
                {
                    await App.Current.MainPage.DisplayAlert(ErrorConnection, ErrorMessage, "Cancel");
                }

                IsApiService   = false;
                IsRefitService = true;
                ApiColor       = DefaultColor;
                RefitColor     = SelectedColor;
            });
        }