private void SetupGridsAndTables() { double rowHeight = 17.8; BoatData.SetupPortDataTable(leftPort.PortName); BoatData.SetupPortDataTable(rightPort.PortName); BoatData.SetupWaitingBoatsDataTable(); leftPortGrid.ItemsSource = BoatData.BoatDataViewer(leftPort.PortName); leftPortGrid.RowHeight = rowHeight; leftPortGrid.IsReadOnly = true; rightPortGrid.ItemsSource = BoatData.BoatDataViewer(rightPort.PortName); rightPortGrid.RowHeight = rowHeight; rightPortGrid.IsReadOnly = true; waitingBoatsGrid.ItemsSource = BoatData.BoatDataViewer("WaitingBoats"); waitingBoatsGrid.IsReadOnly = true; BoatData.Update(leftPort); BoatData.Update(rightPort); BoatData.UpdateVisitors(waitingBoats); }
private void ClearSave_Clicked(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Är du säker?", "WARNING!", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { SaveFileManager.DeleteSaves(); leftPort = new Port("LeftPort"); rightPort = new Port("RightPort"); harbour.ReplacePort(leftPort); harbour.ReplacePort(rightPort); waitingBoats.Clear(); Simulate.AddToWaiting(5); UpdateWaitingBoats(); BoatData.ClearTable(leftPort.PortName); BoatData.ClearTable(rightPort.PortName); BoatData.ClearTable("WaitingBoats"); BoatData.UpdateVisitors(waitingBoats); BoatData.Update(leftPort); BoatData.Update(rightPort); Simulate.DaysPassed = 0; Simulate.BoatsRejected = 0; Simulate.BoatsAccepted = 0; UpdateLabels(); } }