Jelajahi Sumber

其他-提交遗漏文件

ZhouJieSheng 2 tahun lalu
induk
melakukan
9e5c1339ef

+ 263 - 0
PDF Office/ViewModels/Dialog/PropertiesDialogViewModel.cs

@@ -0,0 +1,263 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Dialog
+{
+    public class PropertiesDialogViewModel : BindableBase, IDialogAware
+    {
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        private CPDFDocument Document;
+
+        private string fileName;
+        /// <summary>
+        /// 文件名
+        /// </summary>
+        public string FileName
+        {
+            get { return fileName; }
+            set
+            {
+                SetProperty(ref fileName, value);
+            }
+        }
+
+        private string fileSize;
+        /// <summary>
+        /// 文件大小
+        /// </summary>
+        public string FileSize
+        {
+            get { return fileSize; }
+            set
+            {
+                SetProperty(ref fileSize, value);
+            }
+        }
+
+        private string title;
+        /// <summary>
+        /// 文件标题
+        /// </summary>
+        public string FileTitle
+        {
+            get { return title; }
+            set
+            {
+                SetProperty(ref title, value);
+            }
+        }
+
+        private string author;
+        /// <summary>
+        /// 作者
+        /// </summary>
+        public string Author
+        {
+            get { return author; }
+            set
+            {
+                SetProperty(ref author, value);
+            }
+        }
+
+        private string filePath;
+        /// <summary>
+        /// 文件路径
+        /// </summary>
+        public string FilePath
+        {
+            get { return filePath; }
+            set
+            {
+                SetProperty(ref filePath, value);
+            }
+        }
+
+        private string version;
+        /// <summary>
+        /// 版本
+        /// </summary>
+        public string Version
+        {
+            get { return version; }
+            set
+            {
+                SetProperty(ref version, value);
+            }
+        }
+
+        private int pageCounr;
+        /// <summary>
+        /// 页面大小
+        /// </summary>
+        public int PageCount
+        {
+            get { return pageCounr; }
+            set
+            {
+                SetProperty(ref pageCounr, value);
+            }
+        }
+
+        private string creator;
+        /// <summary>
+        /// 创建软件名
+        /// </summary>
+        public string Creator
+        {
+            get { return creator; }
+            set
+            {
+                SetProperty(ref creator, value);
+            }
+        }
+
+        private string productor;
+
+        public string Productor
+        {
+            get { return productor; }
+            set
+            {
+                SetProperty(ref productor, value);
+            }
+        }
+
+        private string createDate;
+        /// <summary>
+        /// 创建日期
+        /// </summary>
+        public string CreateDate
+        {
+            get { return createDate; }
+            set
+            {
+                SetProperty(ref createDate, value);
+            }
+        }
+
+        private string modifyDate;
+        /// <summary>
+        /// 编辑日期
+        /// </summary>
+        public string ModifyDate
+        {
+            get { return modifyDate; }
+            set
+            {
+                SetProperty(ref modifyDate, value);
+            }
+        }
+
+
+        private string isEncrypted;
+        /// <summary>
+        /// 是否加密
+        /// </summary>
+        public string IsEncrypted
+        {
+            get { return isEncrypted; }
+            set
+            {
+                SetProperty(ref isEncrypted, value);
+            }
+        }
+
+        private string isUnlocked;
+        /// <summary>
+        /// 是否加锁
+        /// </summary>
+        public string IsUnlocked
+        {
+            get { return isUnlocked; }
+            set
+            {
+                SetProperty(ref isUnlocked, value);
+            }
+        }
+
+        private string allowCopy;
+        /// <summary>
+        /// 允许复制
+        /// </summary>
+        public string AllowCopy
+        {
+            get { return allowCopy; }
+            set
+            {
+                SetProperty(ref allowCopy, value);
+            }
+        }
+
+        private string allowPrint;
+        /// <summary>
+        /// 允许打印
+        /// </summary>
+        public string AllowPrint
+        {
+            get { return allowPrint; }
+            set
+            {
+                SetProperty(ref allowPrint, value);
+            }
+        }
+
+
+        public PropertiesDialogViewModel()
+        {
+
+        }
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+          
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            Document = parameters.GetValue<CPDFDocument>(ParameterNames.PDFDocument);
+
+            var info = Document.GetInfo();
+            FileName = Document.FileName;
+            FileSize = CommonHelper.GetFileSize(Document.FilePath);
+            FileTitle = info.Title;
+            Author = info.Author;
+            FilePath = Document.FilePath;
+            Version = info.Version;
+            PageCount = Document.PageCount;
+            Creator = info.Creator;
+            Productor = info.Producer;
+            CreateDate = CommonHelper.GetDate(info.CreationDate);
+            ModifyDate = CommonHelper.GetDate(info.ModificationDate);
+
+            string yes = "Yes";
+            string no = "No";
+
+            IsEncrypted = Document.IsEncrypted ? yes : no;
+            IsUnlocked = Document.IsLocked ? no : yes;
+
+            var permissions = Document.GetPermissionsInfo();
+
+            AllowCopy = permissions.AllowsCopying? yes : no;
+            AllowPrint = permissions.AllowsPrinting ? yes : no;
+        }
+    }
+}

+ 37 - 0
PDF Office/ViewModels/Dialog/SettingsDialogViewModel.cs

@@ -0,0 +1,37 @@
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Dialog
+{
+    public class SettingsDialogViewModel : BindableBase, IDialogAware
+    {
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public SettingsDialogViewModel()
+        {
+
+        }
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+            
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+           
+        }
+    }
+}

File diff ditekan karena terlalu besar
+ 905 - 0
PDF Office/Views/Dialog/SettingsDialog.xaml


+ 50 - 0
PDF Office/Views/Dialog/SettingsDialog.xaml.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Dialog
+{
+    /// <summary>
+    /// InfoDialog.xaml 的交互逻辑
+    /// </summary>
+    public partial class SettingsDialog : UserControl
+    {
+        public SettingsDialog()
+        {
+            InitializeComponent();
+        }
+
+        private void BtnMiniSize_Click(object sender, RoutedEventArgs e)
+        {
+            System.Windows.SystemCommands.MinimizeWindow(Window.GetWindow(this));
+        }
+
+        private void BtnClose_Click(object sender, RoutedEventArgs e)
+        {
+            System.Windows.SystemCommands.CloseWindow(Window.GetWindow(this));
+        }
+
+        private void BtnReStore_Click(object sender, RoutedEventArgs e)
+        {
+            if (Window.GetWindow(this).WindowState == WindowState.Maximized)
+            {
+                System.Windows.SystemCommands.RestoreWindow(Window.GetWindow(this));
+            }
+            else
+            {
+                System.Windows.SystemCommands.MaximizeWindow(Window.GetWindow(this));
+            }
+        }
+    }
+}