public void OnPurchaseDelivered(Purchase purchase, DeliveryMan deliverer) { textBoxDepartments.Invoke(new Action(() => { textBoxDepartments.Text += $"{deliverer} доставил покупку {purchase} по адресу {purchase.PurchaseAddress}.\n"; DrawDelivery(purchase); })); }
protected Department() { contractor = CreateContractor(); deliverer = CreateDeliverer(); Animals = CreateAnimals(); Houses = CreateHouses(); //изначально в отделе максимальное к-во товаров Animals.SetMax(); Houses.SetMax(); contractor.ContractionCompleted += (purchase, contractor) => ContractionFinished?.Invoke(purchase, contractor); deliverer.Delivered += (purchase, deliverer) => PurchaseDelivered?.Invoke(purchase, deliverer); }