Microscopic Traffic Simulator

- Main Page
- Packages
- Classes
- Files

- File List

ConstructionUserControl.xaml.cs
Go to the documentation of this file.
1 using Microscopic_Traffic_Simulator.ViewModels;
2 using Microscopic_Traffic_Simulator.Views.SettingsView;
3 using System.Windows;
4 using System.Windows.Controls;
5 using System.Windows.Data;
6
7 namespace Microscopic_Traffic_Simulator.Views.MainWindowView
8 {
12 public partial class ConstructionUserControl : UserControl
13 {
17 public ConstructionUserControl()
18 {
19 InitializeComponent();
20 }
21
27 private void ButtonInitializeSimulation_Click(object sender, RoutedEventArgs e)
28 {
29 MainWindow mainWindow = Window.GetWindow(this) as MainWindow;
30 mainWindow.canvasUserControl.RoadPreviewer.ClearPreviewOfBuildingOfAnyRoads();
31 ParametersWindow parametersWindow = new ParametersWindow();
32 parametersWindow.DataContext = (mainWindow.DataContext as MainViewModel).GetParametersViewModel();
33 bool? result = parametersWindow.ShowDialog();
34 if (result.HasValue && result.Value)
35 {
36 mainWindow.canvasUserControl.SimulationTrafficRenderer.CellularTopology = (mainWindow
37 .canvasUserControl.DataContext as CanvasViewModel).CellularTopology;
38 mainWindow.canvasUserControl.SimulationTrafficRenderer.AttachEventHandlerFromCellularTopology();
39 }
40 }
41
47 private void RadioButton_SourceUpdated(object sender, DataTransferEventArgs e)
48 {
49 (Window.GetWindow(this) as MainWindow).canvasUserControl.RoadPreviewer.LaneTypeWasChanged();
50 }
51
52 private void generatorBuildingModeButton_Unchecked(object sender, RoutedEventArgs e)
53 {
54 MainWindow mainWindow = Window.GetWindow(this) as MainWindow;
55 if (mainWindow != null)
56 {
57 mainWindow.canvasUserControl.GeneratorPossibleLocationsRenderer.Clear();
58 }
59 }
60
61 private void laneBuildingModeButton_Unchecked(object sender, RoutedEventArgs e)
62 {
63 MainWindow mainWindow = Window.GetWindow(this) as MainWindow;
64 if (mainWindow != null)
65 {
66 mainWindow.canvasUserControl.RoadPreviewer.ClearPreviewOfBuildingOfAnyRoads();
67 }
68 }
69
70 private void generatorBuildingModeButton_Checked(object sender, RoutedEventArgs e)
71 {
72 (Window.GetWindow(this) as MainWindow).canvasUserControl.GeneratorPossibleLocationsRenderer
73 .RenderPossibleLocations();
74 }
75 }
76 }
Microscopic_Traffic_Simulator.Views.MainWindowView.ConstructionUserControl.ConstructionUserControl
ConstructionUserControl()
Initialization of control.
Definition: ConstructionUserControl.xaml.cs:17
System
Microscopic_Traffic_Simulator.Views.SettingsView.ParametersWindow
ParametersWindow
Definition: ParametersWindow.g.cs:40
Microscopic_Traffic_Simulator.Views.SettingsView
Definition: ParametersWindow.g.cs:34
Microscopic_Traffic_Simulator.ViewModels
Definition: CanvasViewModel.cs:8
Microscopic_Traffic_Simulator.Views.MainWindowView.MainWindow
MainWindow
Definition: MainWindow.g.cs:43
Microscopic_Traffic_Simulator.ViewModels.CanvasViewModel
Viewmodel for canvas panel.
Definition: CanvasViewModel.cs:13
Microscopic_Traffic_Simulator.ViewModels.MainViewModel
Main application viewmodel.
Definition: MainViewModel.cs:12
Microscopic_Traffic_Simulator.Views
Microscopic_Traffic_Simulator
Definition: App.xaml.cs:12