|
@@ -226,6 +226,11 @@ namespace PDF_Master.ViewModels
|
|
|
|
|
|
#region 属性、变量
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 用于退出页面编辑 设置bota搜索框
|
|
|
+ /// </summary>
|
|
|
+ private SearchContent searchContent = null;
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 显示 隐藏注释
|
|
|
/// </summary>
|
|
@@ -703,6 +708,7 @@ namespace PDF_Master.ViewModels
|
|
|
//关闭BOTA的逻辑在xaml.cs代码里控制,无法绑定后台
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 防止自动保存异步导致弹窗出现两次
|
|
|
/// </summary>
|
|
@@ -1714,11 +1720,11 @@ namespace PDF_Master.ViewModels
|
|
|
|
|
|
private async void share()
|
|
|
{
|
|
|
- if (IsPopupInProgress)
|
|
|
+ if (IsPopupInProgress)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- IsPopupInProgress=true;
|
|
|
+ IsPopupInProgress = true;
|
|
|
try
|
|
|
{
|
|
|
DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Share");
|
|
@@ -1956,7 +1962,7 @@ namespace PDF_Master.ViewModels
|
|
|
}
|
|
|
|
|
|
public void ShowPrintDialog()
|
|
|
- {
|
|
|
+ {
|
|
|
//保存并继续,使用了高级功能则弹窗权益弹窗
|
|
|
if (!saveFile(true))
|
|
|
{
|
|
@@ -2188,28 +2194,87 @@ namespace PDF_Master.ViewModels
|
|
|
var item = args.AddedItems[0] as TabItem;
|
|
|
CurrentBar = item.Name;
|
|
|
TabControlSelectonDataTracking(item.Name);
|
|
|
+
|
|
|
if (previousBar != CurrentBar)
|
|
|
{
|
|
|
if (CurrentBar == "TabItemPageEdit")//如果是页面编辑则进入页面编辑模式
|
|
|
{
|
|
|
EnterPageEdit();
|
|
|
+ searchContent = CleanSearch();
|
|
|
}
|
|
|
else//其余情况直接导航至对应的工具栏即可,不需要清空之前的content,region里是单例模式
|
|
|
{
|
|
|
EnterSelectedBar(CurrentBar);
|
|
|
isInPageEdit = false;
|
|
|
+ SearchTextFocus(searchContent);
|
|
|
}
|
|
|
previousBar = CurrentBar;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public void SearchTextFocus(SearchContent searchContent)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(searchContent.SearchText.Text) == false)
|
|
|
+ {
|
|
|
+ searchContent.SearchText.Dispatcher.BeginInvoke(new Action(() =>
|
|
|
+ {
|
|
|
+ searchContent.SearchText.Focus();
|
|
|
+ searchContent.SearchText.SelectAll();
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private SearchContent CleanSearch()
|
|
|
+ {
|
|
|
+ SearchContent searchContent = null;
|
|
|
+ if (this.OpenBOTA)
|
|
|
+ {
|
|
|
+ bool isTabItemSearch = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemSearch");
|
|
|
+ if (bOTAContent.TabItemSearch.IsSelected)
|
|
|
+ {
|
|
|
+ SearchContentViewModel viewModel = GetSearchContentVM(bOTAContentViewModel, out searchContent);
|
|
|
+ if (viewModel.SearchItemList.Count > 0)
|
|
|
+ {
|
|
|
+ PDFViewer.ClearPageSelectText();
|
|
|
+ viewModel.SearchItemList.Clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return searchContent;
|
|
|
+ }
|
|
|
+
|
|
|
+ private SearchContentViewModel GetSearchContentVM(BOTAContentViewModel bOTAContentViewModel, out SearchContent searchContent)
|
|
|
+ {
|
|
|
+ SearchContentViewModel viewModel = null;
|
|
|
+ searchContent = null;
|
|
|
+ if (bOTAContentViewModel != null)
|
|
|
+ {
|
|
|
+ if (region.Regions.ContainsRegionWithName(bOTAContentViewModel.BOTAContentRegionName))
|
|
|
+ {
|
|
|
+ var views = region.Regions[bOTAContentViewModel.BOTAContentRegionName].Views;
|
|
|
+ foreach (var item in views)
|
|
|
+ {
|
|
|
+ if (item is SearchContent search)
|
|
|
+ {
|
|
|
+ searchContent = search;
|
|
|
+ viewModel = search.DataContext as SearchContentViewModel;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return viewModel;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 选项卡切换事件埋点
|
|
|
/// </summary>
|
|
|
/// <param name="e"></param>
|
|
|
private void TabControlSelectonDataTracking(string currentBar)
|
|
|
{
|
|
|
- switch (currentBar) {
|
|
|
+ switch (currentBar)
|
|
|
+ {
|
|
|
case "TabItemAnnotation":
|
|
|
DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Annotation");
|
|
|
break;
|
|
@@ -2217,24 +2282,26 @@ namespace PDF_Master.ViewModels
|
|
|
case "TabItemEdit":
|
|
|
DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_EditPDF");
|
|
|
break;
|
|
|
+
|
|
|
case "TabItemPageEdit":
|
|
|
DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_PageEdit");
|
|
|
break;
|
|
|
+
|
|
|
case "TabItemConvert":
|
|
|
DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Converter");
|
|
|
break;
|
|
|
+
|
|
|
case "TabItemTool":
|
|
|
DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Tools");
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 进入页面编辑模式
|
|
|
- /// </summary>
|
|
|
- //工具栏添加功能应注意自处
|
|
|
- public void EnterPageEdit()
|
|
|
+ /// <summary>
|
|
|
+ /// 进入页面编辑模式
|
|
|
+ /// </summary>
|
|
|
+ //工具栏添加功能应注意自处
|
|
|
+ public void EnterPageEdit()
|
|
|
{
|
|
|
if (TabSelectedIndex != 2)
|
|
|
{
|
|
@@ -2602,6 +2669,7 @@ namespace PDF_Master.ViewModels
|
|
|
events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private void Redo()
|
|
|
{
|
|
|
PDFViewer.UndoManager.Redo();
|
|
@@ -2826,9 +2894,9 @@ namespace PDF_Master.ViewModels
|
|
|
//是否取消了水印保存步骤
|
|
|
bool flg = false;
|
|
|
//删掉Settings.Default.UserDate.isInFreeUseTime == false,没有试用期策略了
|
|
|
- if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && ((App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP == true||PDFViewer.UndoManager.PDFEditChanged==true))
|
|
|
+ if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && ((App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP == true || PDFViewer.UndoManager.PDFEditChanged == true))
|
|
|
{
|
|
|
- DialogParameters value = new DialogParameters();
|
|
|
+ DialogParameters value = new DialogParameters();
|
|
|
value.Add(ParameterNames.ViewContentViewModel, this);
|
|
|
if (autosave)
|
|
|
{
|
|
@@ -3189,7 +3257,7 @@ namespace PDF_Master.ViewModels
|
|
|
DoAfterSaveAs(dlg.FileName);
|
|
|
}
|
|
|
else
|
|
|
- { //提示文件被其他软件占用 无法保存
|
|
|
+ { //提示文件被其他软件占用 无法保存
|
|
|
AlertsMessage alertsMessage = new AlertsMessage();
|
|
|
alertsMessage.ShowDialog(App.MainPageLoader.GetString("Main_SaveFailed"), App.MainPageLoader.GetString("Main_TheFileOccupiedWarning"), App.ServiceLoader.GetString("Text_cancel"), App.ServiceLoader.GetString("Text_ok"));
|
|
|
}
|
|
@@ -3334,15 +3402,14 @@ namespace PDF_Master.ViewModels
|
|
|
/// <summary>
|
|
|
/// 转档、压缩、合并、分享前自动保存
|
|
|
/// </summary>
|
|
|
- public async Task<bool> SaveBeforeOption(bool NoIAP=false)
|
|
|
+ public async Task<bool> SaveBeforeOption(bool NoIAP = false)
|
|
|
{
|
|
|
- if(NoIAP == false)
|
|
|
+ if (NoIAP == false)
|
|
|
{ //添加付费拦截锁
|
|
|
if (!ServiceHelper.IAPBeforeFunction())
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
bool result = true;
|
|
|
//因配合权益弹窗弹出,暂时移除可保存条件判断
|
|
@@ -3391,7 +3458,7 @@ namespace PDF_Master.ViewModels
|
|
|
|
|
|
if (flg == false)
|
|
|
{
|
|
|
- return ;
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
var dlg = new SaveFileDialog();
|
|
@@ -3563,7 +3630,6 @@ namespace PDF_Master.ViewModels
|
|
|
|
|
|
private void EnterSelectedBar(string currentBar)
|
|
|
{
|
|
|
-
|
|
|
NavigationParameters param = new NavigationParameters();
|
|
|
param.Add(ParameterNames.PDFViewer, PDFViewer);
|
|
|
param.Add(ParameterNames.ViewContentViewModel, this);
|
|
@@ -3596,6 +3662,7 @@ namespace PDF_Master.ViewModels
|
|
|
{
|
|
|
ServiceHelper.GetUser();
|
|
|
}
|
|
|
+
|
|
|
#endregion 方法
|
|
|
|
|
|
#region Navigate
|