public void AddNewOrderItem(ItemSelectedArgs args) { if (_order.OrderStatus == OrderStatus.Closed) return; var item = args.Item; var existingItem = _order.OrderItems.SingleOrDefault(o => o.ItemName.Equals(item.ItemName)); if (existingItem == null) _order.OrderItems.Add(new OrderItem(item.ItemName, item.Price)); else existingItem.Quantity++; }
private ItemSelectedArgs GetSelectedItemArgs() { FileSystemObject item = GetSelectedItem(); if (item != null) { ItemSelectedArgs args = new ItemSelectedArgs(item); return(new ItemSelectedArgs(item)); } return(null); }
private void listview_DoubleClick(object sender, EventArgs e) { if (ItemDoubleClicked == null) { return; } ItemSelectedArgs args = GetSelectedItemArgs(); if (args == null) { return; } ItemDoubleClicked(this, args); }
private void listview_SelectedIndexChanged(object sender, EventArgs e) { if (ItemSelected == null) { return; } ItemSelectedArgs args = GetSelectedItemArgs(); if (args == null) { return; } ItemSelected(this, args); }
private void SelectionLogic_ItemSelected(object sender, ItemSelectedArgs e) { try { ShipViewerWindow viewer = null; if (chkShowViewerOnSelect.IsChecked.Value && e.Item is Swimbot) { viewer = ShowShipViewer((Swimbot)e.Item, e.ClickPoint); } e.Requested_SelectedItem_Instance = new SelectedItemSwimbots(e.Item, e.Offset, viewer, grdViewPort, _viewport, pnlSelectionVisuals, _camera, e.ShouldMoveItemWithSpring, e.ShouldSpringCauseTorque, e.SpringColor); } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }