using Microsoft.Win32;
using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ComPDFKitViewer.PdfViewer;
using Prism.Regions;
using DryIoc;
using System.Diagnostics;
using Prism.Services.Dialogs;
using PDF_Office.CustomControl;
using PDF_Office.Model;
using System.Windows;
using System.Windows.Controls;
using System.IO;
namespace PDF_Office.ViewModels
{
public class ViewContentViewModel : BindableBase, INavigationAware
{
#region 属性、变量
private CPDFViewer PDFViewer { get; set; }
private MainContentViewModel mainViewModel { get; set; }
public IRegionManager region;
public IDialogService dialogs;
public string ViwerRegionName { get; set; }
public string BOTARegionName { get; set; }
public string PropertyRegionName { get; set; }
public string ToolContentRegionName { get; set; }
public string ToolsBarContentRegionName { get; set; }
///
/// 是否处于页面编辑模式,用于执行undo redo 的具体操作
///
public bool isInPageEdit = false;
public Action PageEditUndo { get; set; }
public Action PageEditRedo { get; set; }
private int gridToolRow = 1;
///
/// 控制ToolContent的Row
///
public int GridToolRow
{
get { return gridToolRow; }
set
{
SetProperty(ref gridToolRow, value);
}
}
private int gridToolRowSpan = 3;
///
/// 控制ToolContent的RowSpan
///
public int GridToolRowSpan
{
get { return gridToolRowSpan; }
set
{
SetProperty(ref gridToolRowSpan, value);
}
}
private Visibility toolContentVisible = Visibility.Collapsed;
///
/// 控制Content的显示 用于显示水印、贝茨码、密文等功能模块
/// 留意:显示前需要先注入内容、设置好行和跨行数
///
public Visibility ToolContentVisible
{
get { return toolContentVisible; }
set
{
SetProperty(ref toolContentVisible, value);
}
}
private Visibility isLoading = Visibility.Collapsed;
///
/// 是否正在加载中
///
public Visibility IsLoading
{
get { return isLoading; }
set
{
SetProperty(ref isLoading, value);
}
}
private Visibility toolsbarContentVisible = Visibility.Collapsed;
///
/// 控制ToolsBarContent的显示
/// 留意:显示前需要先注入内容、设置好行和跨行数
///
public Visibility ToolsBarContentVisible
{
get { return toolsbarContentVisible; }
set
{
SetProperty(ref toolsbarContentVisible, value);
}
}
private bool isPorpertyOpen = false;
///
/// 属性栏是否展开
///
public bool IsPropertyOpen
{
get { return isPorpertyOpen; }
set
{
SetProperty(ref isPorpertyOpen, value);
}
}
private bool canSave;
///
/// 是否可以保存
///
public bool CanSave
{
get { return canSave; }
set
{
SetProperty(ref canSave, value);
}
}
private bool canUndo;
public bool CanUndo
{
get { return canUndo; }
set
{
SetProperty(ref canUndo, value);
}
}
private bool canRedo;
public bool CanRedo
{
get { return canRedo; }
set
{
SetProperty(ref canRedo, value);
}
}
private GridLength botaWidth = new GridLength(48);
///
/// BOTA栏的宽度
///
public GridLength BOTAWidth
{
get { return botaWidth; }
set
{
SetProperty(ref botaWidth, value);
if(botaWidth.Value<=48)
{
OpenBOTA = false;
}
}
}
private bool openBOTA = false;
///
/// 是否展开BOTA
///
public bool OpenBOTA
{
get { return openBOTA; }
set {
openBOTA = value;
if(openBOTA)
{
BOTAWidth = new GridLength(256);
}
}
}
private Dictionary regionNameByTabItem;
private Dictionary barContentByTabItem;
private string previousBar = "";
private string currentBar = "";
///
/// 用来避免重复触发导航事件的标志符
///
private bool isOpenFile = false;
///
/// 鼠标滚轮缩放的缩放值
///
private double[] zoomLevel = { 1.00f, 10, 25, 50, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
#endregion
#region 命令
public DelegateCommand LoadFile { get; set; }
public DelegateCommand Load { get; set; }
public DelegateCommand