public void OnDataChange(object sender, CreateOrderEventArgs args) { if (CreateOrder != null) { CreateOrder(this, args); } }
public void CreateOrder(object sender, CreateOrderEventArgs args) { Order order = new Order(args.orderID, args.client, args.address); order.orderNum = args.orderID; foreach (OrderItem item in args.Items) { order.orderItemList.Add(item); } // 更新窗体控件 if (orders.Contains(order)) { MessageBox.Show($"Add Order Error: Order with id {order.orderNum} already exists!"); } os.orderList.Add(order); }