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;
///
/// 按钮和属性面板键值对
///
private Dictionary btnToProperty = new Dictionary();
private Visibility showPreView;
///
/// 显示PreView按钮
///
public Visibility ShowPreView
{
get { return showPreView; }
set
{
SetProperty(ref showPreView, value);
}
}
public DelegateCommand CheckedCommand { get; set; }
public FormsToolContentViewModel(IRegionManager regionManager)
{
regions = regionManager;
CheckedCommand = new DelegateCommand(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");
}
///
/// Form
///
///
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(ParameterNames.ViewContentViewModel,out viewContentViewModel);
navigationContext.Parameters.TryGetValue(ParameterNames.ViewContentViewModel, out PDFViewer);
}
#endregion
}
}