|
@@ -2005,59 +2005,6 @@ namespace PDF_Master.ViewModels
|
|
|
|
|
|
#endregion PDFViewer鼠标滚轮缩放事件
|
|
|
|
|
|
- #region Navigate
|
|
|
-
|
|
|
- public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
- {
|
|
|
- App.mainWindowViewModel.OphVis = Visibility.Collapsed;
|
|
|
- if (App.IsShowRegist && App.IsLogin == true)
|
|
|
- {
|
|
|
- App.mainWindowViewModel.OpenRegister();
|
|
|
- App.IsShowRegist = false;
|
|
|
- }
|
|
|
-
|
|
|
- var mainVM = navigationContext.Parameters[ParameterNames.MainViewModel] as MainContentViewModel;
|
|
|
- if (mainVM != null)
|
|
|
- {
|
|
|
- mainViewModel = mainVM;
|
|
|
- mainViewModel.viewContentViewModel = this;
|
|
|
- }
|
|
|
- var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
|
|
|
- if (pdfview != null)
|
|
|
- {
|
|
|
- PDFViewer = pdfview;
|
|
|
- if (loadFile())
|
|
|
- {
|
|
|
- CheckHaveAllPermission();
|
|
|
- }
|
|
|
- }
|
|
|
- navigationContext.Parameters.TryGetValue(ParameterNames.PasswordInfo, out PasswordInfo);
|
|
|
-
|
|
|
- //快捷键
|
|
|
- KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
|
|
|
- KeyEventsHelper.KeyDown += ShortCut_KeyDown;
|
|
|
- }
|
|
|
-
|
|
|
- public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
|
- {
|
|
|
- if (navigationContext != null)
|
|
|
- {
|
|
|
- //另存为打开导航进来时 不能新建一个实例
|
|
|
- return true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //一次性打开多个文件时,需要新建实例
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
|
- {
|
|
|
- KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
|
|
|
- }
|
|
|
-
|
|
|
- #endregion Navigate
|
|
|
|
|
|
#region 方法
|
|
|
|
|
@@ -2157,10 +2104,6 @@ namespace PDF_Master.ViewModels
|
|
|
|
|
|
private void LoadControl()
|
|
|
{
|
|
|
- //在构造函数中使用Region需要借助Dispatcher 确保UI已经加载完成,加载BOTA区域
|
|
|
- // 非必要情况不要使用该异步方法,可能会导致一次性加载多个文件时出现因异步引起的regionname 错乱问题
|
|
|
- //System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
|
|
- // {
|
|
|
NavigationParameters parameters = new NavigationParameters();
|
|
|
parameters.Add(ParameterNames.PDFViewer, PDFViewer);
|
|
|
parameters.Add(ParameterNames.ViewContentViewModel, this);
|
|
@@ -2173,15 +2116,6 @@ namespace PDF_Master.ViewModels
|
|
|
EnterSelectedBar("TabItemAnnotation");
|
|
|
//}
|
|
|
//));
|
|
|
-
|
|
|
- //if (App.IsBookMode)
|
|
|
- //{
|
|
|
- // RbtnReadMode();
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // UnReadModel();
|
|
|
- //}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -2830,5 +2764,61 @@ namespace PDF_Master.ViewModels
|
|
|
}
|
|
|
|
|
|
#endregion 方法
|
|
|
+
|
|
|
+ #region Navigate
|
|
|
+
|
|
|
+ public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
+ {
|
|
|
+ navigationContext.Parameters.TryGetValue(ParameterNames.PasswordInfo, out PasswordInfo);
|
|
|
+ var mainVM = navigationContext.Parameters[ParameterNames.MainViewModel] as MainContentViewModel;
|
|
|
+ if (mainVM != null)
|
|
|
+ {
|
|
|
+ mainViewModel = mainVM;
|
|
|
+ mainViewModel.viewContentViewModel = this;
|
|
|
+ }
|
|
|
+ var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
|
|
|
+ if (pdfview != null)
|
|
|
+ {
|
|
|
+ PDFViewer = pdfview;
|
|
|
+ if (loadFile())
|
|
|
+ {
|
|
|
+ CheckHaveAllPermission();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //快捷键
|
|
|
+ KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
|
|
|
+ KeyEventsHelper.KeyDown += ShortCut_KeyDown;
|
|
|
+
|
|
|
+ //弹窗需要放到最后(确保在各字段赋值语句的后面),弹窗显示会触发控件的Loaded事件,会导致后续段没有赋值,而加载等事件继续往后跑了
|
|
|
+ //例如这里的问题 会因为显示注册弹窗,导致其他模块没有接受到正常的PDFviewer对象
|
|
|
+ App.mainWindowViewModel.OphVis = Visibility.Collapsed;
|
|
|
+ if (App.IsShowRegist && App.IsLogin == true)
|
|
|
+ {
|
|
|
+ App.mainWindowViewModel.OpenRegister();
|
|
|
+ App.IsShowRegist = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
|
+ {
|
|
|
+ if (navigationContext != null)
|
|
|
+ {
|
|
|
+ //另存为打开导航进来时 不能新建一个实例
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //一次性打开多个文件时,需要新建实例
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
|
+ {
|
|
|
+ KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion Navigate
|
|
|
}
|
|
|
}
|