|
@@ -6,11 +6,13 @@ using ImTools;
|
|
|
using Microsoft.Office.Interop.Word;
|
|
|
using PDF_Master.CustomControl;
|
|
|
using PDF_Master.CustomControl.CompositeControl;
|
|
|
+using PDF_Master.EventAggregators;
|
|
|
using PDF_Master.Helper;
|
|
|
using PDF_Master.Model;
|
|
|
using PDF_Master.Model.BOTA;
|
|
|
using Prism.Commands;
|
|
|
using Prism.Common;
|
|
|
+using Prism.Events;
|
|
|
using Prism.Mvvm;
|
|
|
using Prism.Services.Dialogs;
|
|
|
using System;
|
|
@@ -102,7 +104,6 @@ namespace PDF_Master.ViewModels.Dialog.BOTA
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private void InitString()
|
|
|
{
|
|
|
T_Style = App.MainPageLoader.GetString("Annotation_DialogStyle");
|
|
@@ -113,8 +114,8 @@ namespace PDF_Master.ViewModels.Dialog.BOTA
|
|
|
T_Cancel = App.MainPageLoader.GetString("Annotation_DialogNo");
|
|
|
}
|
|
|
|
|
|
+ #endregion 文案
|
|
|
|
|
|
- #endregion
|
|
|
public string Title => "";
|
|
|
|
|
|
public event Action<IDialogResult> RequestClose;
|
|
@@ -293,10 +294,11 @@ namespace PDF_Master.ViewModels.Dialog.BOTA
|
|
|
|
|
|
public DelegateCommand CancelCommand { get; set; }
|
|
|
|
|
|
- public DelegateCommand<Object> OkCommnad { get; set; }
|
|
|
+ public DelegateCommand<object> OkCommnad { get; set; }
|
|
|
|
|
|
- public DelegateCommand<Object> CleanCommand { get; set; }
|
|
|
+ public DelegateCommand<object> CleanCommand { get; set; }
|
|
|
public DelegateCommand<object> LoadedCommand { get; set; }
|
|
|
+
|
|
|
public ObservableCollection<AnnotationHandlerEventArgs> AnnotationListItems { get; set; }
|
|
|
|
|
|
private ObservableCollection<ColorItem> annotationColors = new ObservableCollection<ColorItem>();
|
|
@@ -345,18 +347,94 @@ namespace PDF_Master.ViewModels.Dialog.BOTA
|
|
|
public List<string> Colors { get => colors; set => colors = value; }
|
|
|
public List<string> Authors { get => authors; set => authors = value; }
|
|
|
public List<AnnotArgsType> AnnotArgsTypes { get => annotArgsTypes; set => annotArgsTypes = value; }
|
|
|
+ public IEventAggregator events;
|
|
|
|
|
|
- public ScreenAnnotationDialogViewModel()
|
|
|
+ public ScreenAnnotationDialogViewModel(IEventAggregator eventAggregator)
|
|
|
{
|
|
|
+ events = eventAggregator;
|
|
|
+ //this.events.GetEvent<ScreenAnnotationEvent>().Subscribe(Loading, e => e.Unicode == App.mainWindowViewModel.SelectedItem.Unicode);
|
|
|
LoadedCommand = new DelegateCommand<object>(Loaded);
|
|
|
CancelCommand = new DelegateCommand(CancelEvent);
|
|
|
- OkCommnad = new DelegateCommand<Object>(OkEvent);
|
|
|
- CleanCommand = new DelegateCommand<Object>(CleanEvent);
|
|
|
+ OkCommnad = new DelegateCommand<object>(OkEvent);
|
|
|
+ CleanCommand = new DelegateCommand<object>(CleanEvent);
|
|
|
InitString();
|
|
|
}
|
|
|
|
|
|
private void Loaded(object obj)
|
|
|
{
|
|
|
+ if (obj is Object[] arrys1)
|
|
|
+ {
|
|
|
+ foreach (var item in arrys1)
|
|
|
+ {
|
|
|
+ if (item is CustomIconToggleBtn iconToggleBtn)
|
|
|
+ {
|
|
|
+ string tag = iconToggleBtn.Tag.ToString();
|
|
|
+ switch (tag)
|
|
|
+ {
|
|
|
+ case "Highlight":
|
|
|
+ btnHighlight = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "FreeHand":
|
|
|
+ btnFreeHand = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "AnnotSticky":
|
|
|
+ btnAnnotSticky = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "AnnotStamp":
|
|
|
+ btnAnnotStamp = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "SharpLine":
|
|
|
+ btnSharpLine = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "SharpArrow":
|
|
|
+ btnSharpArrow = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "AnnotCircle":
|
|
|
+ btnAnnotCircle = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "AnnotSquare":
|
|
|
+ btnAnnotSquare = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "AnnotFreeText":
|
|
|
+ btnAnnotFreeText = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "AnnotStrikeout":
|
|
|
+ btnAnnotStrikeout = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Underline":
|
|
|
+ btnUnderLine = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "AnnotLink":
|
|
|
+ btnAnnotLink = iconToggleBtn;
|
|
|
+ iconToggleBtns.Add(iconToggleBtn);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SetBtnSelectedState(arrys1);
|
|
|
+ }
|
|
|
if (obj is CompositeCommandParameter composite)
|
|
|
{
|
|
|
if (composite.Parameter is Object[] arrys)
|
|
@@ -430,22 +508,6 @@ namespace PDF_Master.ViewModels.Dialog.BOTA
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //btnHighlight = arrys[0] as CustomIconToggleBtn;
|
|
|
- //btnFreeHand = arrys[1] as CustomIconToggleBtn;
|
|
|
- //btnAnnotSticky = arrys[2] as CustomIconToggleBtn;
|
|
|
- //btnAnnotStamp = arrys[3] as CustomIconToggleBtn;
|
|
|
- //btnSharpLine = arrys[4] as CustomIconToggleBtn;
|
|
|
- //btnSharpArrow = arrys[5] as CustomIconToggleBtn;
|
|
|
- //btnAnnotCircle = arrys[6] as CustomIconToggleBtn;
|
|
|
- //btnAnnotSquare = arrys[7] as CustomIconToggleBtn;
|
|
|
- //btnAnnotFreeText = arrys[8] as CustomIconToggleBtn;
|
|
|
- //btnAnnotStrikeout = arrys[9] as CustomIconToggleBtn;
|
|
|
- //btnUnderLine = arrys[10] as CustomIconToggleBtn;
|
|
|
- //btnAnnotLink = arrys[11] as CustomIconToggleBtn;
|
|
|
- //for (int i = 0; i < arrys.Length - 2; i++)
|
|
|
- //{
|
|
|
- // iconToggleBtns.Add(arrys[i] as CustomIconToggleBtn);
|
|
|
- //}
|
|
|
SetBtnSelectedState(arrys);
|
|
|
}
|
|
|
}
|
|
@@ -742,7 +804,6 @@ namespace PDF_Master.ViewModels.Dialog.BOTA
|
|
|
|
|
|
private void CancelEvent()
|
|
|
{
|
|
|
-
|
|
|
RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
|
|
|
}
|
|
|
|
|
@@ -799,10 +860,12 @@ namespace PDF_Master.ViewModels.Dialog.BOTA
|
|
|
{
|
|
|
this.AnnotArgsTypes = annotArgsTypes;
|
|
|
}
|
|
|
+
|
|
|
if (AnnotationListItems.Count <= 0)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
foreach (var item in AnnotationListItems)
|
|
|
{
|
|
|
AnnotationAuthor.Add(new AuthorItem(item.Author));
|