void Save_Clicked(object sender, EventArgs e)
        {
            //MessagingCenter.Send(this, "AddItem", Item);
            var button = sender as Button;
            var label  = button.Parent.FindByName("CityName") as Label;

            if (!Application.Current.Properties.ContainsKey(label.Text))
            {
                Application.Current.Properties.Add(label.Text, label.Text);
                Application.Current.SavePropertiesAsync();
                DataStore.AddItem(viewModel.FoundCity.FirstOrDefault(x => x.name.Equals(label.Text)));
                Notifier.ShortAlert("Успешно добавлено");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Invoked when the Cart button is clicked.
        /// </summary>
        /// <param name="obj">The Object</param>
        private async void AddToCartClicked(object obj)
        {
            IsBusy = true;
            var result = await DataStore.AddItem(ProductDetail.Id.ToString());

            if (result == true)
            {
                await dialogService.Show("Successful", "Your item has been added to cart", "Go to Cart");

                navigationService.NavigateTo(typeof(CartPageViewModel), string.Empty, string.Empty);
                //TODO: Need to show the display alert
                //TODO: Done navigation to cart page

                //await Shell.Current.DisplayAlert("Success", $"The item {DataStore.SelectedProduct.Name} has been added to cart", "Go to Cart");
                //await Shell.Current.GoToAsync("cart", true);
            }
        }
Exemplo n.º 3
0
        public async void AddMyCity(String cityName)
        {
            var response = await DataStore.requestMaker(cityName);

            if (!response.name.Equals("404"))
            {
                Application.Current.Properties.Add(cityName, cityName);
                await Application.Current.SavePropertiesAsync();

                DataStore.AddItem(response);
                await ExecuteLoadItemsCommand();

                IsLoading = false;
            }
            else
            {
                Notifier.ShortAlert("Ваш город не найден");
                IsLoading = false;
            }
        }