123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using ComPDFKitViewer.AnnotEvent;
- using ComPDFKitViewer.PdfViewer;
- using PDF_Office.Model;
- using Prism.Mvvm;
- using Prism.Regions;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Media;
- namespace PDF_Office.ViewModels.Form
- {
- public class ButtonPropertyViewModel : FormBaseVM, INavigationAware
- {
- #region 属性
- #region 选项
- //标签
- private string _labelContent;
- public string LabelContent
- {
- get { return _labelContent; }
- set { SetProperty(ref _labelContent, value); }
- }
- private string _emailContent;
- public string EmailContent
- {
- get { return _emailContent; }
- set { SetProperty(ref _emailContent, value); }
- }
- #endregion
- #endregion
- #region Command
- #endregion
- #region 变量
- private CPDFViewer PDFViewer;
- private WidgetPushButtonArgs pushButtonArgs;
- #endregion
- #region 初始化
- public ButtonPropertyViewModel()
- {
- InitVariable();
- InitCommand();
- }
- private void InitVariable()
- {
- }
- private void InitCommand()
- {
- }
- #endregion
- #region 一般处理
- #endregion
- #region 外观处理
- #endregion
- #region 选项处理
- #endregion
- #region Navegation
- public bool IsNavigationTarget(NavigationContext navigationContext)
- {
- return true;
- }
- public void OnNavigatedFrom(NavigationContext navigationContext)
- {
- pushButtonArgs = null;
- }
- public void OnNavigatedTo(NavigationContext navigationContext)
- {
- navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
- navigationContext.Parameters.TryGetValue<WidgetPushButtonArgs>("WidgetArgs", out pushButtonArgs);
- GetWidgeText();
- }
- private void GetWidgeText()
- {
- if (pushButtonArgs == null)
- {
- WidgetPushButtonArgs pushButtonArgs = new WidgetPushButtonArgs();
- pushButtonArgs.BgColor = Colors.White;
- pushButtonArgs.FontFamily = "Courier New";
- pushButtonArgs.FontSize = 12;
- pushButtonArgs.FontColor = Colors.Black;
- pushButtonArgs.LineColor = Colors.Black;
- pushButtonArgs.LineWidth = 1;
- var action = new Dictionary<ComPDFKit.PDFDocument.Action.C_ACTION_TYPE, string>();
- action.Add(ComPDFKit.PDFDocument.Action.C_ACTION_TYPE.ACTION_TYPE_URI, "");
- pushButtonArgs.ActionDict = action;
- pushButtonArgs.FieldName = "PushButton";
- pushButtonArgs.Text = "PushButton";
- this.pushButtonArgs = pushButtonArgs;
- }
- PDFViewer.SetMouseMode(MouseModes.FormEditTool);
- PDFViewer.SetToolParam(pushButtonArgs);
- }
- #endregion
- }
- }
|