using PDF_Master.Helper;
using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
namespace PDF_Master.Model.PageEdit
{
public class PageEditItem : BindableBase
{
private int pageNumber;
///
/// 页码
///
public int PageNumber
{
get { return pageNumber; }
set
{
SetProperty(ref pageNumber, value);
}
}
private string pageSize = "";
///
/// 用于显示的页面尺寸
///
public string PageSize
{
get { return pageSize; }
set
{
SetProperty(ref pageSize, value);
}
}
///
/// Size类型的页面尺寸 用于插入功能
///
private Size size;
public Size Size
{
get { return size; }
set
{
size = value;
//if(Size.Width>0&&Size.Height>0)
//{
// var heigit = size.Height * 208 / size.Width;
// ItemSize = new Size(208,heigit);
//}
//再设置Size时 同步更新文件尺寸大小,以及设置页面方向
double width = CommonHelper.GetUnitsFromPageSize(value.Width);
double height = CommonHelper.GetUnitsFromPageSize(value.Height);
this.PageSize = $"{width.ToString("F0")}x{height.ToString("F0")}mm";
if (value.Width < value.Height)
{
this.isVertical = true;
}
else
{
this.isVertical = false;
}
}
}
private BitmapSource image;
///
/// 页面缩略图
///
public BitmapSource Image
{
get { return image; }
set
{
SetProperty(ref image, value);
}
}
private bool showPageSize = false;
///
/// 是否显示页码尺寸
///
public bool ShowPageSize
{
get { return showPageSize; }
set
{
SetProperty(ref showPageSize, value);
}
}
private int fontSize = 14;
public int FontSize
{
get { return fontSize; }
set
{
SetProperty(ref fontSize, value);
}
}
private bool haveBookMark = false;
///
/// 该页是否有书签标记
///
public bool HaveBookMark
{
get { return haveBookMark; }
set
{
SetProperty(ref haveBookMark, value);
}
}
private Visibility visible = Visibility.Visible;
///
/// 是否显示
///
public Visibility Visible
{
get { return visible; }
set
{
SetProperty(ref visible, value);
}
}
private bool selected = false;
///
/// 是否选中
/// 用于获取项的选中状态
///
public bool Selected
{
get { return selected; }
set
{
SetProperty(ref selected, value);
}
}
private Size itemSize = new Size(208, 294);
///
/// 控件大小
/// 直接修改Listbox 容器的项大小,会导致间距有问题,所有采用动态绑定大小的方式来实现Item大小更新
///
public Size ItemSize
{
get { return itemSize; }
set
{
SetProperty(ref itemSize, value);
}
}
///
/// 此次打开中是否已经获取图片,避免重复拿图
///
public bool IsGetImage = false;
private bool isvertical = true;
///
/// 是否是竖直的图
///
public bool isVertical
{
get { return isvertical; }
set
{
isvertical = value;
}
}
}
}