123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- using ComPDFKitViewer.AnnotEvent;
- using ComPDFKitViewer.PdfViewer;
- using PDF_Office.Helper;
- 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 ListBoxPropertyViewModel : FormBaseVM, INavigationAware
- {
- #region 属性
- #region 选项
- //排序项目
- private bool _isSortProject = false;
- public bool IsSortProject
- {
- get { return _isSortProject; }
- set { SetProperty(ref _isSortProject, value); }
- }
- //多重选择的
- private bool _multipleSelection = false;
- public bool MultipleSelection
- {
- get { return _multipleSelection; }
- set { SetProperty(ref _multipleSelection, value); }
- }
- #endregion
- #endregion
- #region Command
- #endregion
- #region 变量
- private CPDFViewer PDFViewer;
- private WidgetListBoxArgs listBoxArgs;
- public UpdateAttributeHelper AttribEvent;
- #endregion
- #region 初始化
- public ListBoxPropertyViewModel()
- {
- InitVariable();
- InitCommand();
- }
- private void InitVariable()
- {
- ResetColorOne = new ResetColor()
- {
- BorderColor = new SolidColorBrush(Colors.Transparent),
- FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
- FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
- };
- ResetColorTwo = new ResetColor()
- {
- BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
- FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
- FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
- };
- ResetColorThree = new ResetColor()
- {
- BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
- FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
- FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xBD, 0xDF, 0xFD))
- };
- ResetColorForth = new ResetColor()
- {
- BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
- FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
- FillColor = new SolidColorBrush(Colors.Transparent)
- };
- }
- private void InitCommand()
- {
- ChangeValueHandler -= ChangeValue;
- ChangeValueHandler += ChangeValue;
- }
- #endregion
- #region 一般处理
- #endregion
- #region 外观处理
- #endregion
- #region 选项处理
- #endregion
- #region Navegation
- public bool IsNavigationTarget(NavigationContext navigationContext)
- {
- return true;
- }
- public void OnNavigatedFrom(NavigationContext navigationContext)
- {
- listBoxArgs = null;
- }
- public void OnNavigatedTo(NavigationContext navigationContext)
- {
- navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
- navigationContext.Parameters.TryGetValue<WidgetListBoxArgs>("WidgetArgs", out listBoxArgs);
- navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
- GetWidgeText();
- }
- private void GetWidgeText()
- {
-
- if (listBoxArgs == null)
- {
- PDFViewer.SetMouseMode(MouseModes.FormEditTool);
- listBoxArgs = new WidgetListBoxArgs();
- listBoxArgs.BgColor = Colors.White;
- listBoxArgs.FontFamily = "Courier New";
- listBoxArgs.FontSize = 12;
- listBoxArgs.FontColor = Colors.Black;
- listBoxArgs.LineColor = Colors.Black;
- listBoxArgs.LineWidth = 1;
- listBoxArgs.FieldName = "ListBox1";
- PDFViewer.SetToolParam(listBoxArgs);
- }
- else
- {
- PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
- }
-
-
- }
- //更改基类公共属性后,触发的事件
- private void ChangeValue(object sender, FormAttributeType e)
- {
- switch (e)
- {
- case FormAttributeType.Name:
- break;
- case FormAttributeType.ToolTip:
- break;
- case FormAttributeType.IsSolid:
- break;
- case FormAttributeType.IsLocked:
- break;
- case FormAttributeType.HeightSize:
- break;
- case FormAttributeType.BorderThiness:
- break;
- case FormAttributeType.BorderColor:
- break;
- case FormAttributeType.ContentColor:
- break;
- case FormAttributeType.IsReadOnly:
- break;
- case FormAttributeType.WidthSize:
- break;
- case FormAttributeType.IsRequiredField:
- break;
- }
- }
- #endregion
- }
- }
|