HomeChatGPTAIContentViewModel.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using PDF_Master.Model;
  2. using Prism.Commands;
  3. using Prism.Mvvm;
  4. using Prism.Regions;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Windows.Controls;
  9. namespace PDF_Master.ViewModels.HomePanel
  10. {
  11. public class HomeChatGPTAIContentViewModel : BindableBase, INavigationAware
  12. {
  13. HomeContentViewModel homeContentViewModel = null;
  14. public string RegionName = "";
  15. private string chatGPTAIRegionName;
  16. public string ChatGPTAIRegionName
  17. {
  18. get { return chatGPTAIRegionName; }
  19. set { SetProperty(ref chatGPTAIRegionName, value); }
  20. }
  21. public IRegionManager region;
  22. public HomeChatGPTAIContentViewModel(IRegionManager regionManager)
  23. {
  24. region=regionManager;
  25. ChatGPTAIRegionName = Guid.NewGuid().ToString();
  26. }
  27. public bool IsNavigationTarget(NavigationContext navigationContext)
  28. {
  29. return true;
  30. }
  31. public void OnNavigatedFrom(NavigationContext navigationContext)
  32. {
  33. }
  34. public void OnNavigatedTo(NavigationContext navigationContext)
  35. {
  36. navigationContext.Parameters.TryGetValue<string>(ParameterNames.Tag, out RegionName);
  37. navigationContext.Parameters.TryGetValue<HomeContentViewModel>(ParameterNames.HomeContentViewModel, out homeContentViewModel);
  38. NavigationParameters param = new NavigationParameters();
  39. param.Add(ParameterNames.HomeContentViewModel, homeContentViewModel);
  40. region.RequestNavigate(ChatGPTAIRegionName, RegionName,param);
  41. }
  42. }
  43. }