private void InsertWaste(WasteBinType wasteBinType, Control listBoxControl, Control pgBarControl) { if (_game.IsExpired) { return; } if (SelectedWaste.WasteBinType != wasteBinType) { return; } var wastebin = WasteBins.First(x => x.WasteBinType == wasteBinType); if (wastebin.Insert(SelectedWaste)) { var lBox = (ListBox)listBoxControl; lBox.Items.Add($"{SelectedWaste.Name} ({SelectedWaste.Volume})"); var pgBar = (ProgressBar)pgBarControl; pgBar.Value = wastebin.FullRate; _game.AddScore(SelectedWaste.Volume); ChangePicture(); } else { if (wastebin.FullVolume >= wastebin.ClearVolume) { MessageBox.Show(Messages.PleaseClear); } } }
private void ClearWaste(WasteBinType wasteBinType, Control listBoxControl, Control pgBarControl) { if (_game.IsExpired) { return; } var wastebin = WasteBins.First(x => x.WasteBinType == wasteBinType); if (wastebin.Clear()) { var lBox = (ListBox)listBoxControl; lBox.Items.Clear(); var pgBar = (ProgressBar)pgBarControl; pgBar.Value = wastebin.FullRate; _game.AddScore(wastebin.UnloadingScore); _game.AddTime(wastebin.UnloadingTime); } }