using ComPDFKitViewer.PdfViewer; using PDF_Office.EventAggregators; using PDF_Office.Model; using Prism.Commands; using Prism.Events; using Prism.Mvvm; using Prism.Regions; using System; using System.Collections.Generic; using System.Linq; using System.Windows; namespace PDF_Office.ViewModels.EditTools.Redaction { public class RedactionContentViewModel : BindableBase,INavigationAware { public IEventAggregator eventAggregator; public IRegionManager redactionRegion; private CPDFViewer PDFViewer; public string RedactionDocumentRegionName { get; set; } public string RedactionBottomBarRegionName { get; set; } public string RedactionDocumentName = "RedactionDocumentContent"; public string Unicode = null; public DelegateCommand CloseEditToolCommand { get; set; } public RedactionContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) { this.redactionRegion = regionManager; this.eventAggregator = eventAggregator; RedactionDocumentRegionName = Guid.NewGuid().ToString(); Unicode = App.mainWindowViewModel.SelectedItem.Unicode; CloseEditToolCommand = new DelegateCommand(CloseEditTool); } public void CloseEditTool() { this.eventAggregator.GetEvent().Publish(new EnumCloseModeUnicode { Unicode = this.Unicode, Status = EnumCloseMode.StatusCancel }); } public bool IsNavigationTarget(NavigationContext navigationContext) { return true; } public void OnNavigatedFrom(NavigationContext navigationContext) { } public void OnNavigatedTo(NavigationContext navigationContext) { navigationContext.Parameters.TryGetValue(ParameterNames.PDFViewer, out PDFViewer); NavigationParameters param = new NavigationParameters(); param.Add(ParameterNames.PDFViewer, PDFViewer); redactionRegion.RequestNavigate(RedactionDocumentRegionName, RedactionDocumentName, param); } } }