Пример #1
0
		private async void itemSelected(object sender, SelectedItemChangedEventArgs e)
		{
			var item = ((ListView)sender).SelectedItem as ProductViewModel; 
			if (item != null)
			{
				((ListView)sender).SelectedItem = null;
				var productDetails = new ProductDetailsPage(item.Product);
				await this.Navigation.PushAsync(productDetails);
			}
		}
Пример #2
0
		public SaveProductPage(IProduct product, IStore parentStore)
		{
			this.ViewModel = MvxToolbox.LoadViewModel<SaveProductViewModel>();
			this.ViewModel.CurrentProduct = product;
			this.ViewModel.Store = parentStore;

			InitializeComponent();
			setupPickers();
			this.ToolbarItems.Add(new ToolbarItem(AppResources.ButtonClose, "", async () =>
					{
						await this.Navigation.PopModalAsync();
					}));
			this.ViewModel.CurrentProduct = product;

			this.mainImageControl.ViewModel = this.ViewModel.MainImage;
			this.ViewModel.ShowAlert = (t, m, accept) =>
			{
				this.DisplayAlert(t, m, accept);
			};
			
			this.ViewModel.DidSaveProductAction = async (savedProduct, isNew) =>
			{
				if (isNew)
				{
					await this.Navigation.PopModalAsync();
					var productInfoPage = new ProductDetailsPage(savedProduct, ContentMode.Edit);
					productInfoPage.ToolbarItems.Add(new ToolbarItem(AppResources.ButtonClose, "", async () =>
							{
								await productInfoPage.Navigation.PopModalAsync();
							}));
					FormsApp.Current.MainPage.Navigation.PushModalAsync(new NavigationPage(productInfoPage));
				}
				else
				{
					await this.Navigation.PopAsync();
				}
			};

			this.multiImagePicker.ImageFactory = this.ViewModel.ImageViewModelFactory;
		}