MainWindowViewModel.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System.Windows.Controls;
  2. using Prism.Commands;
  3. using WpfAppUI.View;
  4. namespace WpfAppUI.ViewModel
  5. {
  6. internal class MainWindowViewModel
  7. {
  8. #region Поля
  9. private Frame frame;
  10. private DelegateCommand _emploeeNavigateCommand;
  11. private DelegateCommand _clientsNavigateCommand;
  12. private DelegateCommand _inquiriesNavigateCommand;
  13. private DelegateCommand _securitiesNavigateCommand;
  14. private DelegateCommand _transactionsNavigateCommand;
  15. private DelegateCommand _treatiesNavigateCommand;
  16. private DelegateCommand _closeFrameCommand;
  17. #endregion
  18. #region Реализация
  19. private void EmploeeNavigateRealization() => frame.Navigate(new Emploee());
  20. private void ClientsNavigateRealization() => frame.Navigate(new Clients());
  21. private void InquiriesNavigateRealization() => frame.Navigate(new Inquiries());
  22. private void SecuritiesNavigateRealization() => frame.Navigate(new Securities());
  23. private void TransactionsNavigateRealization() => frame.Navigate(new Transactions());
  24. private void TreatiesNavigateRealization() => frame.Navigate(new Treaties());
  25. private void CloseFrameRealization() => frame.Navigate(null);
  26. #endregion
  27. #region Конструктор
  28. public MainWindowViewModel(Frame frame)
  29. {
  30. this.frame = frame;
  31. EmploeeNavigateCommand = new DelegateCommand(EmploeeNavigateRealization);
  32. ClientsNavigateCommand = new DelegateCommand(ClientsNavigateRealization);
  33. InquiriesNavigateCommand = new DelegateCommand(InquiriesNavigateRealization);
  34. SecuritiesNavigateCommand = new DelegateCommand(SecuritiesNavigateRealization);
  35. TransactionsNavigateCommand = new DelegateCommand(TransactionsNavigateRealization);
  36. TreatiesNavigateCommand = new DelegateCommand(TreatiesNavigateRealization);
  37. CloseFrameCommand = new DelegateCommand(CloseFrameRealization);
  38. }
  39. #endregion
  40. #region Свойства
  41. public DelegateCommand EmploeeNavigateCommand { get => _emploeeNavigateCommand; set => _emploeeNavigateCommand = value; }
  42. public DelegateCommand ClientsNavigateCommand { get => _clientsNavigateCommand; set => _clientsNavigateCommand = value; }
  43. public DelegateCommand InquiriesNavigateCommand { get => _inquiriesNavigateCommand; set => _inquiriesNavigateCommand = value; }
  44. public DelegateCommand SecuritiesNavigateCommand { get => _securitiesNavigateCommand; set => _securitiesNavigateCommand = value; }
  45. public DelegateCommand TransactionsNavigateCommand { get => _transactionsNavigateCommand; set => _transactionsNavigateCommand = value; }
  46. public DelegateCommand TreatiesNavigateCommand { get => _treatiesNavigateCommand; set => _treatiesNavigateCommand = value; }
  47. public DelegateCommand CloseFrameCommand { get => _closeFrameCommand; set => _closeFrameCommand = value; }
  48. #endregion
  49. }
  50. }