private void CashDeskWork(CashDesk desk, int sleep) { while (isWorking) { if (desk.Count > 0) { desk.Dequeue(); Thread.Sleep(sleep); } } }
private void CreateCart(int customerCount, int sleep) { while (isWorking) { var customers = Generator.GenNewCustomers(customerCount); foreach (var customer in customers) { Cart newCart = new Cart(customer); foreach (Product product in Generator.GetRandomProducts(10, 30)) { newCart.Add(product); } CashDesk cash = CashDesks[rnd.Next(CashDesks.Count)]; cash.Enqueue(newCart); } Thread.Sleep(sleep); } }