/ViewModel/WorkspaceViewModel.cs
C# | 47 lines | 39 code | 6 blank | 2 comment | 4 complexity | b9e5851c817fb9918ff209f4f18fe066 MD5 | raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows.Input;
-
- namespace QuickArch.ViewModel
- {
- public abstract class WorkspaceViewModel : ViewModelBase
- {
- #region Fields
- RelayCommand _closeCommand;
- #endregion
-
- #region Constructor
- protected WorkspaceViewModel()
- {
- }
- #endregion
-
- #region CloseCommand
- //returns the command that attempts to remove this workspace from the UI
- public ICommand CloseCommand
- {
- get
- {
- if (_closeCommand == null)
- _closeCommand = new RelayCommand(param => this.OnRequestClose());
-
- return _closeCommand;
- }
- }
- #endregion
-
- #region RequestClose [event]
- //raised when this workspace should be removed from the UI
- public event EventHandler RequestClose;
-
- void OnRequestClose()
- {
- EventHandler handler = this.RequestClose;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
- #endregion
- }
- }