Microscopic Traffic Simulator
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 {
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 }
Command class for binding UI commands with view models.
Definition: RelayCommand.cs:10
EventHandler RequestClose
Raised when this workspace should be removed from the UI.