using PDF_Master.Model; using Prism.Mvvm; using Prism.Regions; using System; using System.Windows.Controls; namespace PDF_Master.ViewModels.HomePanel { public class HomeGuidContentViewModel : BindableBase, INavigationAware { //Todo:首页快捷工具Command事件,已写在HomePanel/PDFTools/QuickToolsContentViewModel.cs里面了 HomeContentViewModel homeContentViewModel = null; private string homeToolRegionName; public string HomeToolRegionName { get { return homeToolRegionName; } set { SetProperty(ref homeToolRegionName, value); } } public IRegionManager toolregion; public HomeGuidContentViewModel(IRegionManager regionManager) { toolregion = regionManager; HomeToolRegionName = Guid.NewGuid().ToString(); } public bool IsNavigationTarget(NavigationContext navigationContext) { return true; } public void OnNavigatedFrom(NavigationContext navigationContext) { } public void OnNavigatedTo(NavigationContext navigationContext) { navigationContext.Parameters.TryGetValue(ParameterNames.HomeContentViewModel, out homeContentViewModel); if (homeContentViewModel != null) { NavigationParameters param = new NavigationParameters(); param.Add(ParameterNames.HomeContentViewModel, homeContentViewModel); toolregion.RequestNavigate(HomeToolRegionName, "HomeFilesContent", param); } } } }