Microscopic Traffic Simulator

- Main Page
- Packages
- Classes
- Files

- File List

ClosableViewModel.cs
Go to the documentation of this file.
1 using System;
2 using System.Windows.Input;
3
4 namespace Microscopic_Traffic_Simulator.ViewModels
5 {
9 abstract class ClosableViewModel : ViewModelBase
10 {
14 RelayCommand _closeCommand;
15
20 public ICommand CloseCommand
21 {
22 get
23 {
24 if (_closeCommand == null)
25 _closeCommand = new RelayCommand(param => this.OnRequestClose());
26
27 return _closeCommand;
28 }
29 }
30
34 protected ClosableViewModel() { }
35
39 public event EventHandler RequestClose;
40
44 void OnRequestClose()
45 {
46 EventHandler handler = this.RequestClose;
47 if (handler != null)
48 handler(this, EventArgs.Empty);
49 }
50 }
51 }
System
Microscopic_Traffic_Simulator.RelayCommand
Command class for binding UI commands with view models.
Definition: RelayCommand.cs:10
Microscopic_Traffic_Simulator.ViewModels.ClosableViewModel.RequestClose
EventHandler RequestClose
Raised when this workspace should be removed from the UI.
Definition: ClosableViewModel.cs:39
Microscopic_Traffic_Simulator.ViewModels.ClosableViewModel.ClosableViewModel
ClosableViewModel()
Creates viewmodel.
Definition: ClosableViewModel.cs:34
Microscopic_Traffic_Simulator.ViewModels.ViewModelBase
Definition: ViewModelBase.cs:8
Microscopic_Traffic_Simulator.ViewModels.ClosableViewModel
Class representing closable view model.
Definition: ClosableViewModel.cs:9
Microscopic_Traffic_Simulator
Definition: App.xaml.cs:12