123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- 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;
- /// <summary>
- /// 页码
- /// </summary>
- public int PageNumber
- {
- get { return pageNumber; }
- set
- {
- SetProperty(ref pageNumber, value);
- }
- }
- private string pageSize = "";
- /// <summary>
- /// 用于显示的页面尺寸
- /// </summary>
- public string PageSize
- {
- get { return pageSize; }
- set
- {
- SetProperty(ref pageSize, value);
- }
- }
- /// <summary>
- /// Size类型的页面尺寸 用于插入功能
- /// </summary>
- 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;
- /// <summary>
- /// 页面缩略图
- /// </summary>
- public BitmapSource Image
- {
- get { return image; }
- set
- {
- SetProperty(ref image, value);
- }
- }
- private bool showPageSize = false;
- /// <summary>
- /// 是否显示页码尺寸
- /// </summary>
- 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;
- /// <summary>
- /// 该页是否有书签标记
- /// </summary>
- public bool HaveBookMark
- {
- get { return haveBookMark; }
- set
- {
- SetProperty(ref haveBookMark, value);
- }
- }
- private Visibility visible = Visibility.Visible;
- /// <summary>
- /// 是否显示
- /// </summary>
- public Visibility Visible
- {
- get { return visible; }
- set
- {
- SetProperty(ref visible, value);
- }
- }
- private bool selected = false;
- /// <summary>
- /// 是否选中
- /// 用于获取项的选中状态
- /// </summary>
- public bool Selected
- {
- get { return selected; }
- set
- {
- SetProperty(ref selected, value);
- }
- }
- private Size itemSize = new Size(208, 294);
- /// <summary>
- /// 控件大小
- /// 直接修改Listbox 容器的项大小,会导致间距有问题,所有采用动态绑定大小的方式来实现Item大小更新
- /// </summary>
- public Size ItemSize
- {
- get { return itemSize; }
- set
- {
- SetProperty(ref itemSize, value);
- }
- }
- /// <summary>
- /// 此次打开中是否已经获取图片,避免重复拿图
- /// </summary>
- public bool IsGetImage = false;
- private bool isvertical = true;
- /// <summary>
- /// 是否是竖直的图
- /// </summary>
- public bool isVertical
- {
- get { return isvertical; }
- set
- {
- isvertical = value;
- }
- }
- }
- }
|