internal void Work() { Task.Run(() => { if (SelectedOption == MainWindow.Presets.BusLoad) { Task.Run(() => { Thread.Sleep(20000 / mainWindow.Speed); for (int i = 0; i < 15; i++) { bar.waitingGuests.Enqueue(new Patron(bar, mainWindow)); } mainWindow.PatronLog("Oh shit, en busslast med idioter!"); }); } while (bar.IsOpen) { LetInPatron(); if (!bar.IsOpen) { break; } } mainWindow.PatronLog(" Bouncern ragequitta"); }); }
private void LeaveBar() { bar.dirtyGlasses.Add(drinkingGlass); drinkingGlass = null; if (seat != null) { bar.chairs.Enqueue(seat); } seat = null; mainWindow.PatronLog($" {this.name} leaves the Bar."); bar.servedPatrons.TryRemove(this, out Patron patron); }
private void EnterBar(Bar bar, MainWindow mainWindow) { Task.Run(() => { name = nameArray[nameRandomizer.Next(0, nameArray.Length)]; mainWindow.PatronLog($" {this.name} entered Ye Ol' Crusty Sock"); Thread.Sleep(1000 / mainWindow.Speed); LookForChair(); while (drinkingGlass == null) { Thread.Sleep(100); } DrinkBeer(); LeaveBar(); }); }