PageRenderTime 44ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/ViewModel/WorkspaceViewModel.cs

https://github.com/shader/QuickArch
C# | 47 lines | 39 code | 6 blank | 2 comment | 4 complexity | b9e5851c817fb9918ff209f4f18fe066 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Input;
  6. namespace QuickArch.ViewModel
  7. {
  8. public abstract class WorkspaceViewModel : ViewModelBase
  9. {
  10. #region Fields
  11. RelayCommand _closeCommand;
  12. #endregion
  13. #region Constructor
  14. protected WorkspaceViewModel()
  15. {
  16. }
  17. #endregion
  18. #region CloseCommand
  19. //returns the command that attempts to remove this workspace from the UI
  20. public ICommand CloseCommand
  21. {
  22. get
  23. {
  24. if (_closeCommand == null)
  25. _closeCommand = new RelayCommand(param => this.OnRequestClose());
  26. return _closeCommand;
  27. }
  28. }
  29. #endregion
  30. #region RequestClose [event]
  31. //raised when this workspace should be removed from the UI
  32. public event EventHandler RequestClose;
  33. void OnRequestClose()
  34. {
  35. EventHandler handler = this.RequestClose;
  36. if (handler != null)
  37. handler(this, EventArgs.Empty);
  38. }
  39. #endregion
  40. }
  41. }