예제 #1
0
 private void OnSimulationStartClick(object sender, RoutedEventArgs e)
 {
     if (UserInterface.HasSimulationEnded && UserInterface.IsSimulationReady)
     {
         Thread thread = new Thread(() =>
         {
             if (_loadingWindow == null)
             {
                 _loadingWindow = new LoadingWindow();
             }
             _loadingWindow.StartAnimation();
             System.Windows.Threading.Dispatcher.Run();
         });
         thread.SetApartmentState(ApartmentState.STA);
         thread.Start();
         UserInterface.HasSimulationEnded = false;
         _parentWindow.ControlPanelControl.UserControlTabPanel.SelectedIndex = 1;
         _parentWindow.TheUserInterface.SimulationStart(
             _parentWindow.ControlPanelControl.SimulationStats.HeatmapToggle.IsChecked != null &&
             (bool)_parentWindow.ControlPanelControl.SimulationStats.HeatmapToggle.IsChecked,
             new AStar(_parentWindow.TheUserInterface.LocalFloorPlan), (int)_parentWindow.ControlPanelControl.SimulationStats.SimulationSpeed.Value);
     }
     else
     {
         _parentWindow.ControlPanelControl.UserControlTabPanel.SelectedIndex = 1;
         _parentWindow.TheUserInterface.SimulationStart(
             _parentWindow.ControlPanelControl.SimulationStats.HeatmapToggle.IsChecked != null &&
             (bool)_parentWindow.ControlPanelControl.SimulationStats.HeatmapToggle.IsChecked,
             new AStar(_parentWindow.TheUserInterface.LocalFloorPlan), (int)_parentWindow.ControlPanelControl.SimulationStats.SimulationSpeed.Value);
     }
 }
예제 #2
0
 private void OnResetButtonClick(object sender, RoutedEventArgs e)
 {
     //Makes a new thread and loads the loadingwindow, and starts the animation.
     Thread thread = new Thread(() =>
     {
         if (_loadingWindow == null)
         {
             _loadingWindow = new LoadingWindow();
         }
         _loadingWindow.StartAnimation();
         System.Windows.Threading.Dispatcher.Run();
     });
     thread.SetApartmentState(ApartmentState.STA);
     thread.Start();
     UserInterface.ResetButtonClicked = true;
     ChangeSimulationControlsOnEnd();
     UserInterface.IsSimulationPaused = false;
     PauseSimulationButton.Content = "Pause";
     UserInterface.HasSimulationEnded = true;
     OnStopLoadingWindow?.Invoke(this, null);
 }