HomeGuidContentViewModel.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using PDF_Master.Model;
  2. using Prism.Mvvm;
  3. using Prism.Regions;
  4. using System;
  5. using System.Windows.Controls;
  6. namespace PDF_Master.ViewModels.HomePanel
  7. {
  8. public class HomeGuidContentViewModel : BindableBase, INavigationAware
  9. {
  10. //Todo:首页快捷工具Command事件,已写在HomePanel/PDFTools/QuickToolsContentViewModel.cs里面了
  11. HomeContentViewModel homeContentViewModel = null;
  12. private string homeToolRegionName;
  13. public string HomeToolRegionName
  14. {
  15. get { return homeToolRegionName; }
  16. set { SetProperty(ref homeToolRegionName, value); }
  17. }
  18. public IRegionManager toolregion;
  19. public HomeGuidContentViewModel(IRegionManager regionManager)
  20. {
  21. toolregion = regionManager;
  22. HomeToolRegionName = Guid.NewGuid().ToString();
  23. }
  24. public bool IsNavigationTarget(NavigationContext navigationContext)
  25. {
  26. return true;
  27. }
  28. public void OnNavigatedFrom(NavigationContext navigationContext)
  29. {
  30. }
  31. public void OnNavigatedTo(NavigationContext navigationContext)
  32. {
  33. navigationContext.Parameters.TryGetValue<HomeContentViewModel>(ParameterNames.HomeContentViewModel, out homeContentViewModel);
  34. if (homeContentViewModel != null)
  35. {
  36. NavigationParameters param = new NavigationParameters();
  37. param.Add(ParameterNames.HomeContentViewModel, homeContentViewModel);
  38. toolregion.RequestNavigate(HomeToolRegionName, "HomeFilesContent", param);
  39. }
  40. }
  41. }
  42. }