1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using ComPDFKitViewer.PdfViewer;
- using PDF_Office.Model;
- using Prism.Commands;
- 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;
- namespace PDF_Office.ViewModels.Form
- {
- public class FormsToolContentViewModel : BindableBase, INavigationAware
- {
- private CPDFViewer PDFViewer;
- public ViewContentViewModel viewContentViewModel;
- private IRegionManager regions;
- /// <summary>
- /// 按钮和属性面板键值对
- /// </summary>
- private Dictionary<string, string> btnToProperty = new Dictionary<string, string>();
- private Visibility showPreView;
- /// <summary>
- /// 显示PreView按钮
- /// </summary>
- public Visibility ShowPreView
- {
- get { return showPreView; }
- set
- {
- SetProperty(ref showPreView, value);
- }
- }
- public DelegateCommand<string> CheckedCommand { get; set; }
- public FormsToolContentViewModel(IRegionManager regionManager)
- {
- regions = regionManager;
- CheckedCommand = new DelegateCommand<string>(CheckedEvent);
- InitBtnToProperty();
- }
- private void InitBtnToProperty()
- {
- btnToProperty.Add("Text", "TextFieldProperty");
- btnToProperty.Add("CheckBox", "CheckBoxProperty");
- btnToProperty.Add("RadioButton", "RadioButtonProperty");
- btnToProperty.Add("ListBox", "ListBoxProperty");
- btnToProperty.Add("Combox", "ComboxProperty");
- btnToProperty.Add("Button", "ButtonProperty");
- btnToProperty.Add("Sign", "SignProperty");
- }
- /// <summary>
- /// Form
- /// </summary>
- /// <param name="type"></param>
- private void CheckedEvent(string type)
- {
- if (btnToProperty.ContainsKey(type))
- {
- regions.RequestNavigate(RegionNames.PropertyRegionName, btnToProperty[type]);
- }
- }
- #region Navegation
- public bool IsNavigationTarget(NavigationContext navigationContext)
- {
- return true;
- }
- public void OnNavigatedFrom(NavigationContext navigationContext)
- {
-
- }
- public void OnNavigatedTo(NavigationContext navigationContext)
- {
- navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel,out viewContentViewModel);
- navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.ViewContentViewModel, out PDFViewer);
- }
- #endregion
- }
- }
|