|
@@ -1,4 +1,6 @@
|
|
|
-using PDF_Office.EventAggregators;
|
|
|
+using ComPDFKitViewer.PdfViewer;
|
|
|
+using PDF_Office.EventAggregators;
|
|
|
+using PDF_Office.Model;
|
|
|
using Prism.Commands;
|
|
|
using Prism.Events;
|
|
|
using Prism.Mvvm;
|
|
@@ -13,10 +15,14 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
|
|
|
public class WatermarkContentViewModel : BindableBase,INavigationAware
|
|
|
{
|
|
|
public IEventAggregator eventAggregator;
|
|
|
- public IRegionManager backgroundRegion;
|
|
|
+ public IRegionManager watermarkRegion;
|
|
|
|
|
|
public string TemplateListName = "WatermarkTemplateListBaseContent";
|
|
|
public string CreateName = "WatermarkCreateBaseContent";
|
|
|
+ public string CreateModTextName = "WatermarkCreateTextContent";
|
|
|
+ public string CreateModFileName = "WatermarkCreateFileContent";
|
|
|
+
|
|
|
+ public string WatermarkDocumentName = "WatermarkDocumentContent";
|
|
|
|
|
|
private string _watermarkSettingsRegionName;
|
|
|
public string WatermarkSettingsRegionName
|
|
@@ -32,21 +38,53 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
|
|
|
set { _watermarkSettingsVisible = value; }
|
|
|
}
|
|
|
|
|
|
+ private string _watermarkDocumentRegionName;
|
|
|
+ /// <summary>
|
|
|
+ /// 持有Document的Region,负责渲染和保存
|
|
|
+ /// </summary>
|
|
|
+ public string WatermarkDocumentRegionName
|
|
|
+ {
|
|
|
+ get { return _watermarkDocumentRegionName; }
|
|
|
+ set { _watermarkDocumentRegionName = value; }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Visibility _watermarkDocumentVisible = Visibility.Visible;
|
|
|
+ /// <summary>
|
|
|
+ /// 持有Document的Region可见
|
|
|
+ /// </summary>
|
|
|
+ public Visibility WatermarkDocumentVisible
|
|
|
+ {
|
|
|
+ get { return _watermarkDocumentVisible; }
|
|
|
+ set { _watermarkDocumentVisible = value; }
|
|
|
+ }
|
|
|
+
|
|
|
+ private EnumTextOrFile _currentCreateMod;
|
|
|
+ public EnumTextOrFile CurrentCreateMod
|
|
|
+ {
|
|
|
+ get { return _currentCreateMod; }
|
|
|
+ set { _currentCreateMod = value; }
|
|
|
+ }
|
|
|
|
|
|
public DelegateCommand CloseEditToolCommand { get; set; }
|
|
|
|
|
|
+ public DelegateCommand ConfirmEditToolCommand { get; set; }
|
|
|
+
|
|
|
public DelegateCommand<string> EnterSelectedContentCommand { get; set; }
|
|
|
+
|
|
|
public WatermarkContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
|
|
|
{
|
|
|
this.eventAggregator = eventAggregator;
|
|
|
- this.backgroundRegion = regionManager;
|
|
|
+ this.watermarkRegion = regionManager;
|
|
|
WatermarkSettingsVisible = Visibility.Visible;
|
|
|
WatermarkSettingsRegionName = Guid.NewGuid().ToString();
|
|
|
-
|
|
|
+ WatermarkDocumentRegionName = Guid.NewGuid().ToString();
|
|
|
CloseEditToolCommand = new DelegateCommand(CloseEditTool);
|
|
|
+ ConfirmEditToolCommand = new DelegateCommand(ConfirmEditTool);
|
|
|
EnterSelectedContentCommand = new DelegateCommand<string>(EnterSelectedContent);
|
|
|
|
|
|
eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Subscribe(EnterTemplateListOrCreate);
|
|
|
+ eventAggregator.GetEvent<SetCurrentCreateModEvent>().Subscribe(SetCurrentCreateMod);
|
|
|
+
|
|
|
}
|
|
|
public void CloseEditTool()
|
|
|
{
|
|
@@ -54,6 +92,11 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public void ConfirmEditTool()
|
|
|
+ {
|
|
|
+ this.eventAggregator.GetEvent<ConfirmEditToolsWatermarkEvent>().Publish(CurrentCreateMod);
|
|
|
+ }
|
|
|
+
|
|
|
public void EnterTemplateListOrCreate(EnumTemplateListOrCreate enumTemplateListOrCreate)
|
|
|
{
|
|
|
if (enumTemplateListOrCreate == EnumTemplateListOrCreate.StatusTemplate)
|
|
@@ -66,15 +109,35 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void SetCurrentCreateMod(string currentCreateModName)
|
|
|
+ {
|
|
|
+ if (currentCreateModName == CreateModTextName)
|
|
|
+ {
|
|
|
+ CurrentCreateMod = EnumTextOrFile.StatusText;
|
|
|
+ }
|
|
|
+ else if (currentCreateModName == CreateModFileName)
|
|
|
+ {
|
|
|
+ CurrentCreateMod = EnumTextOrFile.StatusFile;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void EnterSelectedContent(string SelectedContentName)
|
|
|
{
|
|
|
- backgroundRegion.RequestNavigate(WatermarkSettingsRegionName, SelectedContentName);
|
|
|
+ watermarkRegion.RequestNavigate(WatermarkSettingsRegionName, SelectedContentName);
|
|
|
WatermarkSettingsVisible = Visibility.Visible;
|
|
|
}
|
|
|
|
|
|
+ public void EnterDocumentContent()
|
|
|
+ {
|
|
|
+ watermarkRegion.RequestNavigate(WatermarkDocumentRegionName, WatermarkDocumentName);
|
|
|
+ WatermarkDocumentVisible = Visibility.Visible;
|
|
|
+ }
|
|
|
+
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
{
|
|
|
EnterSelectedContent(TemplateListName);
|
|
|
+ EnterDocumentContent();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|