|
@@ -42,9 +42,6 @@ using PDF_Master.Views.PropertyPanel.ViewModular;
|
|
|
using PDF_Master.Views.PropertyPanel;
|
|
|
using System.Windows.Threading;
|
|
|
using Dropbox.Api.Files;
|
|
|
-using System.Windows.Media;
|
|
|
-using Color = System.Windows.Media.Color;
|
|
|
-using PDFSettings;
|
|
|
|
|
|
namespace PDF_Master.ViewModels
|
|
|
{
|
|
@@ -276,7 +273,7 @@ namespace PDF_Master.ViewModels
|
|
|
/// 顶部提示栏的显示状态
|
|
|
/// </summary>
|
|
|
public bool IsFileLocked = false;
|
|
|
-
|
|
|
+
|
|
|
public Visibility TipVisible
|
|
|
{
|
|
|
get { return tipVisible; }
|
|
@@ -899,6 +896,7 @@ namespace PDF_Master.ViewModels
|
|
|
{
|
|
|
//自动保存仅针对已经有文件路径的文档
|
|
|
saveFile();
|
|
|
+ App.Current.MainWindow.Activate();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1222,7 +1220,7 @@ namespace PDF_Master.ViewModels
|
|
|
if (PDFViewer.Document.UnlockWithPassword(result.Password))
|
|
|
{
|
|
|
PDFViewer.Document.CheckOwnerPassword(result.Password);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1404,30 +1402,7 @@ namespace PDF_Master.ViewModels
|
|
|
|
|
|
private void SettingsEvent()
|
|
|
{
|
|
|
- DialogParameters value = new DialogParameters();
|
|
|
- value.Add(ParameterNames.ViewContentViewModel, this);
|
|
|
-
|
|
|
- AnnotToolContentViewModel annotToolContent = null;
|
|
|
- if (region.Regions.ContainsRegionWithName(ToolsBarContentRegionName))
|
|
|
- {
|
|
|
- var views = region.Regions[ToolsBarContentRegionName].Views;
|
|
|
- var isHas = views.FindFirst(q => q is AnnotToolContent);
|
|
|
- if (isHas is AnnotToolContent annotTool)
|
|
|
- {
|
|
|
- annotToolContent = (AnnotToolContentViewModel)annotTool.DataContext;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- dialogs.ShowDialog(DialogNames.SettingsDialog, null, e =>
|
|
|
- {
|
|
|
- var annotate = Settings.Default.AppProperties.Annotate;
|
|
|
- if (annotToolContent != null)
|
|
|
- {
|
|
|
- //与注释联动修改颜色
|
|
|
- UpdateFreeHand(annotate, annotToolContent);
|
|
|
- UpdateTextHighlight(annotate, annotToolContent);
|
|
|
- }
|
|
|
- });
|
|
|
+ dialogs.ShowDialog(DialogNames.SettingsDialog, null, null);
|
|
|
if (PDFViewer != null)
|
|
|
{
|
|
|
PDFViewer.SetBackgroundBrush(new System.Windows.Media.SolidColorBrush(Settings.Default.AppProperties.InitialVIew.BackGround));
|
|
@@ -1443,71 +1418,6 @@ namespace PDF_Master.ViewModels
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void UpdateTextHighlight(AnnotatePropertyClass annotate, AnnotToolContentViewModel annotToolContent)
|
|
|
- {
|
|
|
- Color color2 = annotate.HighLightColor;
|
|
|
- Color color1 = (annotToolContent.HighLightColor as SolidColorBrush).Color;
|
|
|
- bool flag = ColorComparison(color2, color1);
|
|
|
- if (flag)
|
|
|
- {
|
|
|
- annotToolContent.HighLightColor = new SolidColorBrush(color2);
|
|
|
- if (string.IsNullOrEmpty(annotToolContent.StrAnnotToolChecked) == false)
|
|
|
- {
|
|
|
- CreateRefreshComment(annotToolContent);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void UpdateFreeHand(AnnotatePropertyClass annotate, AnnotToolContentViewModel annotToolContent)
|
|
|
- {
|
|
|
- Color color2 = annotate.FreeHandColor;
|
|
|
- Color color1 = (annotToolContent.FreeHandColor as SolidColorBrush).Color;
|
|
|
- bool flag = ColorComparison(color2, color1);
|
|
|
-
|
|
|
- if (flag)
|
|
|
- {
|
|
|
- annotToolContent.FreeHandColor = new SolidColorBrush(color2);
|
|
|
- if (annotToolContent.PropertyPanel.LastAnnotDict[AnnotArgsType.AnnotFreehand] != null)
|
|
|
- {
|
|
|
- if (annotToolContent.PropertyPanel.LastAnnotDict[AnnotArgsType.AnnotFreehand] is FreehandAnnotArgs freehandAnnotArgs)
|
|
|
- {
|
|
|
- freehandAnnotArgs.InkColor = color2;
|
|
|
- }
|
|
|
- }
|
|
|
- if (string.IsNullOrEmpty(annotToolContent.StrAnnotToolChecked) == false)
|
|
|
- {
|
|
|
- CreateRefreshComment(annotToolContent);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void CreateRefreshComment(AnnotToolContentViewModel annotToolContent)
|
|
|
- {
|
|
|
- AnnotHandlerEventArgs annotArgs = null;
|
|
|
- string tag = annotToolContent.StrAnnotToolChecked;
|
|
|
- annotToolContent.FindAnnotTypeKey(tag, ref annotArgs);
|
|
|
- if (annotArgs != null)
|
|
|
- {
|
|
|
- //设置点击页面会创建对应选中注释工具的注释
|
|
|
- annotArgs.Author = Settings.Default.AppProperties.Description.Author;
|
|
|
- PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
|
- PDFViewer.SetToolParam(annotArgs);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private bool ColorComparison(Color color2, Color color1)
|
|
|
- {
|
|
|
- if (color1.R == color2.R && color1.G == color2.G && color1.B == color2.B
|
|
|
- && color1.A == color2.A)
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private bool CanSaveExcute()
|
|
|
{
|
|
|
return CanSave;
|
|
@@ -2138,7 +2048,7 @@ namespace PDF_Master.ViewModels
|
|
|
PDFViewer.Document.UnlockWithPassword(passwordInfo.OpenPassword);
|
|
|
}
|
|
|
|
|
|
- if (!string.IsNullOrEmpty(passwordInfo.PermissionsPassword) && passwordInfo.PermissionsPassword != passwordInfo.OpenPassword)
|
|
|
+ if (!string.IsNullOrEmpty(passwordInfo.PermissionsPassword)&&passwordInfo.PermissionsPassword != passwordInfo.OpenPassword)
|
|
|
{
|
|
|
IsFileLocked = true;
|
|
|
NavigationParameters param = new NavigationParameters();
|