private void ImageProductInCart_MouseDown(object sender, MouseButtonEventArgs e) { DetailCakeScreen screen = new DetailCakeScreen(this.ItemCart); screen.Owner = this; screen.ShowDialog(); BackstageTabItem_MouseLeftButtonDown(CartItem, null); }
private void ItemProductPreview_MouseDown(object sender, MouseButtonEventArgs e) { var selectedProduct = (Grid)sender; //Get current item. //var senderStackPanel = (StackPanel)((Grid)((Border)((Canvas)((StackPanel)(selectedProductImg).Parent).Parent).Parent).Parent).Parent; var senderStackPanel = (StackPanel)(selectedProduct.Parent); //Get TextBlock contain item's id. var ID_Product = ((TextBlock)VisualTreeHelper.GetChild(senderStackPanel, 2)).Text as string; //var nameProduct = ((TextBlock)VisualTreeHelper.GetChild(senderStackPanel, 1)).Text as string; //MessageBox.Show($"> Name: {nameProduct} - ID: {ID_Product}"); // get Product by that ID Product product = QueryDB.Instance.findProductByID(Int32.Parse(ID_Product)); DetailCakeScreen screen = new DetailCakeScreen(product); screen.Owner = this; screen.ShowDialog(); BackstageTabItem_MouseLeftButtonDown(CartItem, null); }
private void ListViewItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var item = sender as ListViewItem; if (item != null && item.IsSelected) { switch (this.RibbonItem) { case ConstantVariable.RIBBON_TYPECAKE: { dynamic selectedItem = typeCakeListViewRibbon.SelectedItem; //MessageBox.Show($"{selectedItem.NameTypeCake}"); TypeCake typeCake = new TypeCake(); typeCake.ID = selectedItem.ID; typeCake.NameTypeCake = selectedItem.NameTypeCake; var screen = new DialogTypeCake(typeCake, ConstantVariable.UPDATE_TYPECAKE); screen.handler += this.ObjectWindowHandler; screen.Owner = this; screen.ShowDialog(); } break; case ConstantVariable.RIBBON_CAKE: { dynamic selectedItem = cakeListViewRibbon.SelectedItem; //MessageBox.Show($"{selectedItem.NameTypeCake}"); Product product = new Product(); product.ID = selectedItem.ID; product.Name = selectedItem.NameCake; product.Price = selectedItem.Price; product.IDTypeCake = selectedItem.Type; product.Description = selectedItem.Description; var screen = new DialogCake(product, ConstantVariable.UPDATE_CAKE); screen.handler += this.ObjectWindowHandler; screen.Owner = this; screen.ShowDialog(); } break; case ConstantVariable.RIBBON_CAKEIMPORT: { dynamic selectedItem = cakeImportOrderListViewRibbon.SelectedItem; //MessageBox.Show($"{selectedItem.NameTypeCake}"); CakeImportOrder cakeImportOrder = new CakeImportOrder(); cakeImportOrder.ID = selectedItem.ID; cakeImportOrder.ImportOrderName = selectedItem.ImportOrderName; cakeImportOrder.ProductID = selectedItem.ProductID; cakeImportOrder.ImportDate = selectedItem.ImportDate; cakeImportOrder.ExpirationDate = selectedItem.ExpirationDate; cakeImportOrder.Quantity = selectedItem.Quantity; cakeImportOrder.ImportPrice = selectedItem.ImportPrice; cakeImportOrder.Total = selectedItem.Total; var screen = new DialogCakeImport(cakeImportOrder, ConstantVariable.UPDATE_CAKEIMPORT); screen.handler += this.ObjectWindowHandler; screen.Owner = this; screen.ShowDialog(); } break; case ConstantVariable.RIBBON_PAYMENT: { dynamic selectedItem = detailCartListViewRibbon.SelectedItem; Product product = QueryDB.Instance.findProductByID(selectedItem.ID_Product); DetailCakeScreen screen = new DetailCakeScreen(product); screen.Owner = this; screen.ShowDialog(); BackstageTabItem_MouseLeftButtonDown(CartItem, null); } break; } } }