Pārlūkot izejas kodu

偏好设置-补充偏好设置逻辑

ZhouJieSheng 2 gadi atpakaļ
vecāks
revīzija
6418435ee3

+ 3 - 0
PDF Office/CustomControl/NumericUpDown.xaml.cs

@@ -176,6 +176,9 @@ namespace PDF_Office.CustomControl
 
         private void TextBox_Num_TextChanged(object sender, TextChangedEventArgs e)
         {
+            //控件未显示前不进行逻辑处理 避免初始化前卡顿
+            if (!this.IsLoaded)
+                return;
             //int.TryParse("30.0000610351563"),字符串有小数点,会转换失败
             double num = 0;
             if (this.TextBox_Num.Text == "" || !double.TryParse(this.TextBox_Num.Text,out num))

+ 222 - 0
PDF Office/Model/SettingsDialog/AnnotateModel.cs

@@ -0,0 +1,222 @@
+using PDF_Office.Properties;
+using PDFSettings;
+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;
+
+namespace PDF_Office.Model.SettingsDialog
+{
+    public class AnnotateModel:BindableBase
+    {
+        private Color highLightColor;
+
+        public Color HighLightColor
+        {
+            get { return highLightColor; }
+            set
+            {
+                SetProperty(ref highLightColor, value);
+            }
+        }
+
+        private Color underLineColor;
+
+        public Color UnderLineColor
+        {
+            get { return underLineColor; }
+            set
+            {
+                SetProperty(ref underLineColor, value);
+            }
+        }
+
+        private Color strikethroughColor;
+
+        public Color StrikethroughColor
+        {
+            get { return strikethroughColor; }
+            set
+            {
+                SetProperty(ref strikethroughColor, value);
+            }
+        }
+
+        private Color freeHandColor;
+
+        public Color FreeHandColor
+        {
+            get { return freeHandColor; }
+            set
+            {
+                SetProperty(ref freeHandColor, value);
+            }
+        }
+
+
+        private Color textAnnoteColor;
+
+        public Color TextAnnoteColor
+        {
+            get { return textAnnoteColor; }
+            set
+            {
+                SetProperty(ref textAnnoteColor, value);
+            }
+        }
+
+        private Color noteAnnoteColor;
+
+        public Color NoteAnnoteColor
+        {
+            get { return noteAnnoteColor; }
+            set
+            {
+                SetProperty(ref noteAnnoteColor, value);
+            }
+        }
+
+        private Color rectangleBorderColor;
+
+        public Color RectangleBorderColor
+        {
+            get { return rectangleBorderColor; }
+            set
+            {
+                SetProperty(ref rectangleBorderColor, value);
+            }
+        }
+
+        private Color rectangleFillColor;
+
+        public Color RectangleFillColor
+        {
+            get { return rectangleFillColor; }
+            set
+            {
+                SetProperty(ref rectangleFillColor, value);
+            }
+        }
+
+        private Color circleBorderColor;
+
+        public Color CircleBorderColor
+        {
+            get { return circleBorderColor; }
+            set
+            {
+                SetProperty(ref circleBorderColor, value);
+            }
+        }
+
+        private Color circleFillColor;
+
+        public Color CircleFillColor
+        {
+            get { return circleFillColor; }
+            set
+            {
+                SetProperty(ref circleFillColor, value);
+            }
+        }
+
+        private Color lineColor;
+
+        public Color LineColor
+        {
+            get { return lineColor; }
+            set
+            {
+                SetProperty(ref lineColor, value);
+            }
+        }
+
+        private TextAlignment textAlign;
+
+        public TextAlignment TextAlign
+        {
+            get { return textAlign; }
+            set
+            {
+                SetProperty(ref textAlign, value);
+            }
+        }
+
+        private string textFontFamaily;
+
+        public string TextFontFamaily
+        {
+            get { return textFontFamaily; }
+            set
+            {
+                SetProperty(ref textFontFamaily, value);
+            }
+        }
+
+        private string anchoredFamaily;
+
+        public string AnchoredFamaily
+        {
+            get { return anchoredFamaily; }
+            set
+            {
+                SetProperty(ref anchoredFamaily, value);
+            }
+        }
+
+        public AnnotateModel()
+        {
+            InitFromSettings();
+        }
+
+        private void InitFromSettings()
+        {
+            var annote = Settings.Default.AppProperties.Annotate;
+            this.HighLightColor = annote.HighLightColor;
+            this.UnderLineColor = annote.UnderLineColor;
+            this.StrikethroughColor = annote.StrikethroughColor;
+            this.FreeHandColor = annote.FreeHandColor;
+            this.TextAnnoteColor = annote.TextAnnoteColor;
+            this.NoteAnnoteColor = annote.NoteAnnoteColor;
+            this.RectangleBorderColor = annote.RectangleBorderColor;
+            this.RectangleFillColor = annote.RectangleFillColor;
+            this.CircleBorderColor = annote.CircleBorderColor;
+            this.CircleFillColor = annote.CircleFillColor;
+            this.LineColor = annote.LineColor;
+            this.TextFontFamaily = annote.TextFontFamaily;
+            this.AnchoredFamaily = annote.AnchoredFamaily;
+            this.TextAlign = annote.TextAlign;
+        }
+
+        public void Save()
+        {
+            AnnotatePropertyClass annote = new AnnotatePropertyClass();
+            annote.HighLightColor = this.HighLightColor;
+            annote.UnderLineColor = this.UnderLineColor;
+            annote.StrikethroughColor = this.StrikethroughColor;
+            annote.FreeHandColor = this.FreeHandColor;
+            annote.TextAnnoteColor = this.TextAnnoteColor;
+            annote.NoteAnnoteColor = this.NoteAnnoteColor;
+            annote.RectangleBorderColor = this.RectangleBorderColor;
+            annote.RectangleFillColor = this.RectangleFillColor;
+            annote.CircleBorderColor = this.CircleBorderColor;
+            annote.CircleFillColor = this.CircleFillColor;
+            annote.LineColor = this.LineColor;
+            annote.TextFontFamaily = this.TextFontFamaily;
+            annote.AnchoredFamaily = this.AnchoredFamaily;
+            annote.TextAlign = this.TextAlign;
+
+            Settings.Default.AppProperties.Annotate = annote;
+        }
+
+        public void Reset()
+        {
+            InitFromSettings();
+        }
+
+    }
+}

+ 176 - 0
PDF Office/Model/SettingsDialog/DescriptionModel.cs

@@ -0,0 +1,176 @@
+using PDF_Office.Properties;
+using PDFSettings;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.SettingsDialog
+{
+    public class DescriptionModel:BindableBase
+    {
+        private bool openUnClosedFileWhenOpen;
+
+        public bool OpenUnClosedFileWhenOpen
+        {
+            get { return openUnClosedFileWhenOpen; }
+            set
+            {
+                SetProperty(ref openUnClosedFileWhenOpen, value);
+            }
+        }
+
+        private bool recoveryViewWhenOpen;
+
+        public bool RecoveryViewWhenOpen
+        {
+            get { return recoveryViewWhenOpen; }
+            set
+            {
+                SetProperty(ref recoveryViewWhenOpen, value);
+            }
+        }
+
+        private int fileCountInRecentFiles;
+
+        public int FileCountInRecentFiles
+        {
+            get { return fileCountInRecentFiles; }
+            set
+            {
+                SetProperty(ref fileCountInRecentFiles, value);
+            }
+        }
+
+        private bool autoSave;
+
+        public bool AutoSave
+        {
+            get { return autoSave; }
+            set
+            {
+                SetProperty(ref autoSave, value);
+            }
+        }
+
+        private int autoSaveInterval;
+
+        public int AutoSaveInterval
+        {
+            get { return autoSaveInterval; }
+            set
+            {
+                SetProperty(ref autoSaveInterval, value);
+            }
+        }
+
+        private bool showSaveWhenClose;
+
+        public bool ShowSaveWhenClose
+        {
+            get { return showSaveWhenClose; }
+            set
+            {
+                SetProperty(ref showSaveWhenClose, value);
+            }
+        }
+
+        private bool notShowSaveWhenClose;
+
+        public bool NotShowSaveWhenClose
+        {
+            get { return notShowSaveWhenClose; }
+            set
+            {
+                SetProperty(ref notShowSaveWhenClose, value);
+            }
+        }
+
+        private bool autoScanImageFile;
+
+        public bool AutoScanImageFile
+        {
+            get { return autoScanImageFile; }
+            set
+            {
+                SetProperty(ref autoScanImageFile, value);
+            }
+        }
+
+
+        private bool tipScanImageFile;
+
+        public bool TipScanImageFile
+        {
+            get { return tipScanImageFile; }
+            set
+            {
+                SetProperty(ref tipScanImageFile, value);
+            }
+        }
+
+        private string author;
+
+        public string Author
+        {
+            get { return author; }
+            set
+            {
+                SetProperty(ref author, value);
+            }
+        }
+
+
+        public DescriptionModel()
+        {
+            InitFromSettings();
+        }
+
+        public void Reset()
+        {
+            InitFromSettings();
+        }
+
+        /// <summary>
+        /// 保存配置到缓存  外面需要统一调用一次settngs.save
+        /// </summary>
+        public void Save()
+        {
+            DescriptionPropertyClass description = new DescriptionPropertyClass();
+            description.OpenUnClosedFileWhenOpen = this.OpenUnClosedFileWhenOpen;
+            description.RecoveryViewWhenOpen = this.RecoveryViewWhenOpen;
+            description.FileCountInRecentFiles = this.FileCountInRecentFiles;
+            description.AutoSave = this.AutoSave;
+            description.AutoSaveInterval = this.AutoSaveInterval;
+            description.ShowSaveWhenClose = this.ShowSaveWhenClose;
+            description.NotShowSaveWhenClose = this.NotShowSaveWhenClose;
+
+            description.AutoScanImageFile = this.AutoScanImageFile;
+            description.TipScanImageFile = this.TipScanImageFile;
+            description.Author = this.Author;
+
+            Settings.Default.AppProperties.Description = description;
+        }
+
+        /// <summary>
+        /// 从缓存读取配置
+        /// </summary>
+        private void InitFromSettings()
+        {
+            var description = Settings.Default.AppProperties.Description;
+            this.OpenUnClosedFileWhenOpen = description.OpenUnClosedFileWhenOpen;
+            this.RecoveryViewWhenOpen = description.RecoveryViewWhenOpen;
+            this.FileCountInRecentFiles = description.FileCountInRecentFiles;
+            this.AutoSave = description.AutoSave;
+            this.AutoSaveInterval = description.AutoSaveInterval;
+            this.ShowSaveWhenClose = description.ShowSaveWhenClose;
+            this.NotShowSaveWhenClose = description.NotShowSaveWhenClose;
+
+            this.AutoScanImageFile = description.AutoScanImageFile;
+            this.TipScanImageFile = description.TipScanImageFile;
+            this.Author = description.Author;
+        }
+    }
+}

+ 222 - 0
PDF Office/Model/SettingsDialog/InitialVIewModel.cs

@@ -0,0 +1,222 @@
+using ComPDFKitViewer;
+using PDF_Office.Properties;
+using PDFSettings;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace PDF_Office.Model.SettingsDialog
+{
+    public class InitialVIewModel:BindableBase
+    {
+        private ViewMode pageView;
+
+        public ViewMode PageView
+        {
+            get { return pageView; }
+            set
+            {
+                SetProperty(ref pageView, value);
+            }
+        }
+
+        private FitMode zoomMode;
+
+        public FitMode ZoomMode
+        {
+            get { return zoomMode; }
+            set
+            {
+                SetProperty(ref zoomMode, value);
+            }
+        }
+
+        private bool notShowBOTA;
+
+        public bool NotShowBOTA
+        {
+            get { return notShowBOTA; }
+            set
+            {
+                SetProperty(ref notShowBOTA, value);
+            }
+        }
+
+
+        private bool rememberBOTA;
+
+        public bool RememberBOTA
+        {
+            get { return rememberBOTA; }
+            set
+            {
+                SetProperty(ref rememberBOTA, value);
+            }
+        }
+
+        private bool isBOTAOpen;
+
+        public bool IsBOTAOpen
+        {
+            get { return isBOTAOpen; }
+            set
+            {
+                SetProperty(ref isBOTAOpen, value);
+            }
+        }
+
+        private bool showOutLine;
+
+        public bool ShowOutLine
+        {
+            get { return showOutLine; }
+            set
+            {
+                SetProperty(ref showOutLine, value);
+            }
+        }
+
+        private bool autoExpandProperty;
+
+        public bool AutoExpandProperty
+        {
+            get { return autoExpandProperty; }
+            set
+            {
+                SetProperty(ref autoExpandProperty, value);
+            }
+        }
+
+        private bool clickOpenProperty;
+
+        public bool ClickOpenProperty
+        {
+            get { return clickOpenProperty; }
+            set
+            {
+                SetProperty(ref clickOpenProperty, value);
+            }
+        }
+
+        private Color backGround;
+
+        public Color BackGround
+        {
+            get { return backGround; }
+            set
+            {
+                SetProperty(ref backGround, value);
+            }
+        }
+
+        private Color backGroundInFulWindow;
+
+        public Color BackGroundInFulWindow
+        {
+            get { return backGroundInFulWindow; }
+            set
+            {
+                SetProperty(ref backGroundInFulWindow, value);
+            }
+        }
+
+        private bool hignlightForm;
+
+        public bool HignlightForm
+        {
+            get { return hignlightForm; }
+            set
+            {
+                SetProperty(ref hignlightForm, value);
+            }
+        }
+
+        private bool highlightLink;
+
+        public bool HighlightLink
+        {
+            get { return highlightLink; }
+            set
+            {
+                SetProperty(ref highlightLink, value);
+            }
+        }
+
+        private Color formHighLightColor;
+
+        public Color FormHighLightColor
+        {
+            get { return formHighLightColor; }
+            set
+            {
+                SetProperty(ref formHighLightColor, value);
+            }
+        }
+
+        private Color requiredFieldsColor;
+
+        public Color RequiredFieldsColor
+        {
+            get { return requiredFieldsColor; }
+            set
+            {
+                SetProperty(ref requiredFieldsColor, value);
+            }
+        }
+
+        public InitialVIewModel()
+        {
+            InitFromSettings();
+        }
+
+        private void InitFromSettings()
+        {
+            var view = Settings.Default.AppProperties.InitialVIew;
+            this.PageView = view.PageView;
+            this.ZoomMode = view.ZoomMode;
+            this.NotShowBOTA = view.NotShowBOTA;
+            this.RememberBOTA = view.RememberBOTA;
+            this.ShowOutLine = view.ShowOutLine;
+            this.IsBOTAOpen = view.IsBOTAOpen;
+            this.AutoExpandProperty =view.AutoExpandProperty;
+            this.ClickOpenProperty = view.ClickOpenProperty;
+            this.BackGround = view.BackGround;
+            this.BackGroundInFulWindow = view.BackGroundInFulWindow;
+            this.HignlightForm = view.HignlightForm;
+            this.HighlightLink = view.HighlightLink;
+            this.FormHighLightColor = view.FormHighLightColor;
+            this.RequiredFieldsColor = view.RequiredFieldsColor;
+
+        }
+
+        public void Save()
+        {
+            InitialVIewPropertyClass view = new InitialVIewPropertyClass();
+            view.PageView = this.PageView;
+            view.ZoomMode = this.ZoomMode;
+            view.NotShowBOTA = this.NotShowBOTA;
+            view.RememberBOTA = this.RememberBOTA;
+            view.ShowOutLine = this.ShowOutLine;
+            view.IsBOTAOpen = this.IsBOTAOpen;
+            view.AutoExpandProperty = this.AutoExpandProperty;
+            view.ClickOpenProperty = this.ClickOpenProperty;
+            view.BackGround = this.BackGround;
+            view.BackGroundInFulWindow = this.BackGroundInFulWindow;
+            view.HignlightForm = this.HignlightForm;
+            view.HighlightLink = this.HighlightLink;
+            view.FormHighLightColor = this.FormHighLightColor;
+            view.RequiredFieldsColor = this.RequiredFieldsColor;
+            Settings.Default.AppProperties.InitialVIew = view;
+        }
+
+        public void Reset()
+        {
+            InitFromSettings();
+        }
+
+    }
+}

+ 3 - 0
PDF Office/PDF Office.csproj

@@ -401,6 +401,9 @@
     <Compile Include="EventAggregators\DragablzWindowEvent.cs" />
     <Compile Include="EventAggregators\OpenFileEvent.cs" />
     <Compile Include="Helper\CommonHelper.cs" />
+    <Compile Include="Model\SettingsDialog\AnnotateModel.cs" />
+    <Compile Include="Model\SettingsDialog\DescriptionModel.cs" />
+    <Compile Include="Model\SettingsDialog\InitialVIewModel.cs" />
     <Compile Include="Properties\Resources.Designer.cs">
       <DependentUpon>Resources.resx</DependentUpon>
       <DesignTime>True</DesignTime>

+ 360 - 2
PDF Office/ViewModels/Dialog/SettingsDialogViewModel.cs

@@ -1,4 +1,7 @@
-using Prism.Mvvm;
+using PDF_Office.Model.SettingsDialog;
+using PDF_Office.Properties;
+using Prism.Commands;
+using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
@@ -14,9 +17,357 @@ namespace PDF_Office.ViewModels.Dialog
 
         public event Action<IDialogResult> RequestClose;
 
+        public AnnotateModel Annote { get; set; }
+
+        public DescriptionModel Descript { get; set; }
+
+        public InitialVIewModel View { get; set; }
+
+        public DelegateCommand ResetCommand { get; set; }
+
+        public DelegateCommand ResetAllCommand { get; set; }
+
+        public List<string> AnnoteFamilyList { get; set; }
+
+        public List<string> PageViewList { get; set; }
+
+        public List<string> ZoomModeList { get; set; }
+
+        private int noteSelectedIndex;
+
+        public int NoteSelectedIndex
+        {
+            get { return noteSelectedIndex; }
+            set
+            {
+                SetProperty(ref noteSelectedIndex, value);
+                switch (value)
+                {
+                    case 0:
+                        Annote.AnchoredFamaily = "Courier";
+                        break;
+                    case 1:
+                        Annote.AnchoredFamaily = "Helvetica";
+                        break;
+                    case 2:
+                        Annote.AnchoredFamaily = "Times New Roman";
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+
+        private int annoteSelectedIndex;
+
+        public int AnnoteSelectedIndex
+        {
+            get { return annoteSelectedIndex; }
+            set
+            {
+                SetProperty(ref annoteSelectedIndex, value);
+                switch (value)
+                {
+                    case 0:
+                        Annote.TextFontFamaily = "Courier";
+                        break;
+                    case 1:
+                        Annote.TextFontFamaily = "Helvetica";
+                        break;
+                    case 2:
+                        Annote.TextFontFamaily = "Times New Roman";
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+
+        private bool lefeSelected;
+
+        public bool LeftSelected
+        {
+            get { return lefeSelected; }
+            set
+            {
+                SetProperty(ref lefeSelected, value);
+                if(value)
+                {
+                    Annote.TextAlign = System.Windows.TextAlignment.Left;
+                }
+            }
+        }
+
+        private bool centerSelected;
+
+        public bool CenterSelected
+        {
+            get { return centerSelected; }
+            set
+            {
+                SetProperty(ref centerSelected, value);
+                if (value)
+                {
+                    Annote.TextAlign = System.Windows.TextAlignment.Center;
+                }
+            }
+        }
+
+        private bool rightSelected;
+
+        public bool RightSelected
+        {
+            get { return rightSelected; }
+            set
+            {
+                SetProperty(ref rightSelected, value);
+                if (value)
+                {
+                    Annote.TextAlign = System.Windows.TextAlignment.Right;
+                }
+            }
+        }
+
+        private bool strechSelected;
+
+        public bool StrechSelected
+        {
+            get { return strechSelected; }
+            set
+            {
+                SetProperty(ref strechSelected, value);
+                if (value)
+                {
+                    Annote.TextAlign = System.Windows.TextAlignment.Justify;
+                }
+            }
+        }
+
+
+        private int modeSelectedIndex = 0;
+        //选中的模式
+        public int ModeSelectedIndex
+        {
+            get { return modeSelectedIndex; }
+            set
+            {
+                SetProperty(ref modeSelectedIndex, value);
+            }
+        }
+
+        private bool isDefualtApp;
+
+        /// <summary>
+        /// 是否是默认软件
+        /// </summary>
+        public bool IsDefualtApp
+        {
+            get { return isDefualtApp; }
+            set { isDefualtApp = value; }
+        }
+
+        private bool isSetDefualtAppEnable;
+        /// <summary>
+        /// 是否允许设置默认软件
+        /// </summary>
+        public bool IsSetDefualtAppEnable
+        {
+            get { return isSetDefualtAppEnable; }
+            set
+            {
+                SetProperty(ref isSetDefualtAppEnable, value);
+            }
+        }
+
+        private int pageViewSelectedIndex = 0;
+
+        public int PageViewSelctedIndex
+        {
+            get { return pageViewSelectedIndex; }
+            set
+            {
+                SetProperty(ref pageViewSelectedIndex, value);
+                View.PageView = (ComPDFKitViewer.ViewMode)(value+1);
+            }
+        }
+
+        private int zoomModeSelectedIndex = 0;
+
+        public int ZoomModeSelectedIndex
+        {
+            get { return zoomModeSelectedIndex; }
+            set
+            {
+                SetProperty(ref zoomModeSelectedIndex, value);
+                switch (value)
+                {
+                    case 0:
+                        View.ZoomMode = ComPDFKitViewer.FitMode.FitWidth;
+                        break;
+                    case 1:
+                        View.ZoomMode = ComPDFKitViewer.FitMode.FitHeight;
+                        break;
+                    case 2:
+                        View.ZoomMode = ComPDFKitViewer.FitMode.FitSize;
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+
         public SettingsDialogViewModel()
         {
+            Annote = new AnnotateModel();
+            Descript = new DescriptionModel();
+            View = new InitialVIewModel();
+
+            ResetAllCommand = new DelegateCommand(resetAll);
+            ResetCommand = new DelegateCommand(reset);
+
+            InitAnnoteFamily();
+            InitPageViews();
+            InitZoomMode();
+            //根据缓存还原下拉框 单选等
+            InitAnnote();
+            InitView();
+        }
+
+        private void InitView()
+        {
+            //页面模式下拉框
+            PageViewSelctedIndex = (int)View.PageView - 1;
+
+            //缩放模式下拉框
+            switch (View.ZoomMode)
+            {
+                case ComPDFKitViewer.FitMode.FitWidth:
+                    ZoomModeSelectedIndex = 0;
+                    break;
+                case ComPDFKitViewer.FitMode.FitHeight:
+                    ZoomModeSelectedIndex = 1;
+                    break;
+                case ComPDFKitViewer.FitMode.FitSize:
+                    zoomModeSelectedIndex = 2;
+                    break;
+                case ComPDFKitViewer.FitMode.FitFree:
+                    //TODO:
+                    break;
+                default:
+                    break;
+            }
+
+        }
+
+        private void InitAnnote()
+        {
+            //注释对齐方式
+            switch (Annote.TextAlign)
+            {
+                case System.Windows.TextAlignment.Left:
+                    LeftSelected = true;
+                    break;
+                case System.Windows.TextAlignment.Right:
+                    RightSelected = true;
+                    break;
+                case System.Windows.TextAlignment.Center:
+                    CenterSelected = true;
+                    break;
+                case System.Windows.TextAlignment.Justify:
+                default:
+                    StrechSelected = true;
+                    break;
+            }
+
+            //文本注释字体
+            if(Annote.TextFontFamaily== "Courier")
+            {
+                AnnoteSelectedIndex = 0;
+            }
+            else if(Annote.TextFontFamaily== "Helvetica")
+            {
+                AnnoteSelectedIndex = 1;
+            }
+            else
+            {
+                AnnoteSelectedIndex = 2;
+            }
+
+            //便签注释字体
+            if (Annote.AnchoredFamaily == "Courier")
+            {
+                NoteSelectedIndex = 0;
+            }
+            else if (Annote.AnchoredFamaily == "Helvetica")
+            {
+                NoteSelectedIndex = 1;
+            }
+            else
+            {
+                NoteSelectedIndex = 2;
+            }
+        }
+
+        private void InitPageViews()
+        {
+            PageViewList = new List<string>();
+            PageViewList.Add("单页");
+            PageViewList.Add("单页连续");
+            PageViewList.Add("双页");
+            PageViewList.Add("双页连续");
+            PageViewList.Add("书本");
+            PageViewList.Add("书本连续");
+        }
 
+        private void InitZoomMode()
+        {
+            ZoomModeList = new List<string>();
+            ZoomModeList.Add("适应宽度");
+            ZoomModeList.Add("适应页面");
+            ZoomModeList.Add("实际大小");
+        }
+
+        private void InitAnnoteFamily()
+        {
+            AnnoteFamilyList = new List<string>();
+            AnnoteFamilyList.Add("Courier New");
+            AnnoteFamilyList.Add("Arial");
+            AnnoteFamilyList.Add("Times New Roman");
+        }
+
+        /// <summary>
+        /// 重置
+        /// </summary>
+        private void reset()
+        {
+            switch (ModeSelectedIndex)
+            {
+                case 0:
+                    Descript.Reset();
+                    break;
+                case 1:
+                    View.Reset();
+                    InitView();
+                    break;
+                case 2:
+                    Annote.Reset();
+                    InitAnnote();
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        /// <summary>
+        /// 全部重置
+        /// </summary>
+        private void resetAll()
+        {
+            View.Reset();
+            Descript.Reset();
+            Annote.Reset();
+            InitAnnote();
+            InitView();
         }
 
         public bool CanCloseDialog()
@@ -26,7 +377,14 @@ namespace PDF_Office.ViewModels.Dialog
 
         public void OnDialogClosed()
         {
-            
+            try
+            {
+                View.Save();
+                Annote.Save();
+                Descript.Save();
+                Settings.Default.Save();
+            }
+            catch { }
         }
 
         public void OnDialogOpened(IDialogParameters parameters)

+ 5 - 0
PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs

@@ -1939,6 +1939,11 @@ namespace PDF_Office.ViewModels.PageEdit
             {
                 NotifyUIToRefresh(pageRange);
             }
+            else
+            {
+                //没有符合条件时 清空选中项
+                ListSelectedIndex = -1;
+            }
         }
 
 

+ 226 - 308
PDF Office/Views/Dialog/SettingsDialog.xaml

@@ -2,6 +2,7 @@
     x:Class="PDF_Office.Views.Dialog.SettingsDialog"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:compositecontrol="clr-namespace:PDF_Office.CustomControl.CompositeControl"
     xmlns:cus="clr-namespace:PDF_Office.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:dataconvert="clr-namespace:PDF_Office.DataConvert"
@@ -12,7 +13,7 @@
     Width="700"
     Height="600"
     d:DataContext="{d:DesignInstance Type=dialog:SettingsDialogViewModel}"
-    d:DesignHeight="673"
+    d:DesignHeight="800"
     d:DesignWidth="700"
     prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
     prism:ViewModelLocator.AutoWireViewModel="True"
@@ -121,6 +122,7 @@
         <TabControl
             Grid.Row="1"
             BorderThickness="0"
+            SelectedIndex="{Binding ModeSelectedIndex, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}"
             Style="{StaticResource InfoTabControl}"
             TabStripPlacement="Left">
             <TabItem x:Name="TabItemGeneral" Style="{StaticResource InfoTabItem}">
@@ -148,11 +150,13 @@
                                 <CheckBox
                                     Margin="8"
                                     Content="APP启动时打开上次未关闭的文档"
-                                    Foreground="{StaticResource color.sys.text.neutral.lv1}" />
+                                    Foreground="{StaticResource color.sys.text.neutral.lv1}"
+                                    IsChecked="{Binding Descript.OpenUnClosedFileWhenOpen, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                 <CheckBox
                                     Margin="8"
                                     Content="文档打开时恢复上次视图设置"
-                                    Foreground="{StaticResource color.sys.text.neutral.lv1}" />
+                                    Foreground="{StaticResource color.sys.text.neutral.lv1}"
+                                    IsChecked="{Binding Descript.RecoveryViewWhenOpen, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                 <Label
                                     Margin="8"
                                     Content="最近打开中文档最多显示数量:"
@@ -164,7 +168,9 @@
                                         BorderThickness="0"
                                         FontSize="14"
                                         Foreground="{StaticResource color.field.text.act}"
-                                        Text="20" />
+                                        Maximum="50"
+                                        Minimum="10"
+                                        Value="{Binding Descript.FileCountInRecentFiles, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                     <TextBlock
                                         Margin="8,0"
                                         VerticalAlignment="Center"
@@ -172,7 +178,11 @@
                                         Text="10 to 50" />
                                 </StackPanel>
                                 <StackPanel Margin="8" Orientation="Horizontal">
-                                    <CheckBox Content="APP自动保存文件,频次为每" Foreground="{StaticResource color.sys.text.neutral.lv1}" />
+                                    <CheckBox
+                                        Name="ChkAutoSave"
+                                        Content="APP自动保存文件,频次为每"
+                                        Foreground="{StaticResource color.sys.text.neutral.lv1}"
+                                        IsChecked="{Binding Descript.AutoSave, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                     <cus:NumericUpDown
                                         Width="120"
                                         Margin="8,0,0,0"
@@ -180,7 +190,10 @@
                                         BorderThickness="0"
                                         FontSize="14"
                                         Foreground="{StaticResource color.field.text.act}"
-                                        Text="10" />
+                                        IsEnabled="{Binding ElementName=ChkAutoSave, Path=IsChecked}"
+                                        Maximum="99"
+                                        Minimum="5"
+                                        Value="{Binding Descript.AutoSaveInterval, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                     <Label
                                         Margin="8,0,0,0"
                                         Content="min"
@@ -193,7 +206,7 @@
                                 </StackPanel>
                                 <Grid Margin="8">
                                     <Grid.ColumnDefinitions>
-                                        <ColumnDefinition Width="64" />
+                                        <ColumnDefinition Width="auto" />
                                         <ColumnDefinition />
                                     </Grid.ColumnDefinitions>
                                     <Grid.RowDefinitions>
@@ -209,12 +222,14 @@
                                         Grid.Row="0"
                                         Grid.Column="1"
                                         Content="弹出“保存/不保存”提示"
+                                        IsChecked="{Binding Descript.ShowSaveWhenClose, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                         Style="{DynamicResource RadioButtonStyle1}" />
                                     <RadioButton
                                         Grid.Row="1"
                                         Grid.Column="1"
                                         Margin="0,8"
                                         Content="无提示,直接保存"
+                                        IsChecked="{Binding Descript.NotShowSaveWhenClose, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                         Style="{DynamicResource RadioButtonStyle1}" />
                                 </Grid>
                             </StackPanel>
@@ -229,11 +244,13 @@
                                 <RadioButton
                                     Margin="9,12,0,0"
                                     Content="自动扫描并识别文本"
+                                    IsChecked="{Binding Descript.AutoScanImageFile, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     Style="{DynamicResource RadioButtonStyle1}" />
                                 <RadioButton
                                     Grid.Row="1"
                                     Margin="9,10"
                                     Content="提示扫描并识别文本"
+                                    IsChecked="{Binding Descript.TipScanImageFile, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     Style="{DynamicResource RadioButtonStyle1}" />
                             </StackPanel>
                         </Border>
@@ -247,30 +264,15 @@
                                 Width="224"
                                 VerticalAlignment="Center"
                                 Foreground="{StaticResource color.field.text.act}"
-                                Text="User name" />
+                                Text="{Binding Descript.Author, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                         </WrapPanel>
                         <CheckBox
                             Name="CheckBoxDefaultPDF"
                             Margin="8,16"
-                            Content="设置为默认PDF阅读器"
-                            Foreground="{StaticResource color.sys.text.neutral.lv1}" />
-                        <StackPanel Visibility="{Binding ElementName=CheckBoxDefaultPDF, Path=IsChecked, Converter={StaticResource BoolToVisible}}">
-                            <Label Content="在Keychain中保存密码:" Style="{StaticResource Label}" />
-                            <WrapPanel>
-                                <RadioButton
-                                    Margin="5,16,16,16"
-                                    Content="总是使用"
-                                    Style="{DynamicResource RadioButtonStyle1}" />
-                                <RadioButton
-                                    Margin="0,16"
-                                    Content="永不"
-                                    Style="{DynamicResource RadioButtonStyle1}" />
-                                <RadioButton
-                                    Margin="16"
-                                    Content="询问"
-                                    Style="{DynamicResource RadioButtonStyle1}" />
-                            </WrapPanel>
-                        </StackPanel>
+                            Content="设置为默认PDF阅读器(需要管理员权限)"
+                            Foreground="{StaticResource color.sys.text.neutral.lv1}"
+                            IsChecked="{Binding IsDefualtApp, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                            IsEnabled="{Binding IsSetDefualtAppEnable}" />
                     </StackPanel>
                 </ScrollViewer>
             </TabItem>
@@ -307,7 +309,8 @@
                                     <ComboBox
                                         Width="348"
                                         Height="30"
-                                        SelectedIndex="0">
+                                        ItemsSource="{Binding PageViewList}"
+                                        SelectedIndex="{Binding PageViewSelctedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                         <ComboBoxItem Content="单页" Foreground="{StaticResource color.field.text.act}" />
                                         <ComboBoxItem Content="单页连续" Foreground="{StaticResource color.field.text.act}" />
                                         <ComboBoxItem Content="双页" Foreground="{StaticResource color.field.text.act}" />
@@ -324,10 +327,9 @@
                                     <ComboBox
                                         Width="348"
                                         Height="30"
-                                        SelectedIndex="0">
-                                        <ComboBoxItem Content="适应宽度" Foreground="{StaticResource color.field.text.act}" />
-                                        <ComboBoxItem Content="适应页面" Foreground="{StaticResource color.field.text.act}" />
-                                        <ComboBoxItem Content="实际大小" Foreground="{StaticResource color.field.text.act}" />
+                                        ItemsSource="{Binding ZoomModeList}"
+                                        SelectedIndex="{Binding ZoomModeSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
+  
                                     </ComboBox>
                                 </WrapPanel>
                             </Grid>
@@ -346,15 +348,18 @@
                                 <RadioButton
                                     Margin="12"
                                     Content="打开文件时收起"
+                                    IsChecked="{Binding View.NotShowBOTA, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     Style="{DynamicResource RadioButtonStyle1}" />
                                 <RadioButton
                                     Margin="12,0,0,8"
                                     Content="打开APP记住上次选择"
+                                    IsChecked="{Binding View.RememberBOTA, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     Style="{DynamicResource RadioButtonStyle1}" />
                                 <CheckBox
                                     Margin="12,0,0,10"
                                     Content="有大纲时默认显示大纲列表"
-                                    Foreground="{StaticResource color.sys.text.neutral.lv1}" />
+                                    Foreground="{StaticResource color.sys.text.neutral.lv1}"
+                                    IsChecked="{Binding View.ShowOutLine}" />
                             </StackPanel>
                         </Border>
 
@@ -368,98 +373,43 @@
                                     Margin="8,5"
                                     Content="显示方式:"
                                     Style="{StaticResource Label2}" />
-                                <RadioButton Content="自动展开" Style="{DynamicResource RadioButtonStyle1}" />
+                                <RadioButton
+                                    Content="自动展开"
+                                    IsChecked="{Binding View.AutoExpandProperty}"
+                                    Style="{DynamicResource RadioButtonStyle1}" />
                                 <RadioButton
                                     Margin="8,5"
                                     Content="手动展开"
+                                    IsChecked="{Binding View.ClickOpenProperty}"
                                     Style="{DynamicResource RadioButtonStyle1}" />
                             </WrapPanel>
                         </Border>
 
-                        <Label Content="页码指示符:" Style="{StaticResource Label}" />
-                        <WrapPanel Margin="6,10,6,18">
-                            <RadioButton Content="自动展开" Style="{DynamicResource RadioButtonStyle1}" />
-                            <RadioButton
-                                Margin="17,0"
-                                Content="总是显示"
-                                Style="{DynamicResource RadioButtonStyle1}" />
-                            <RadioButton Content="永不显示" Style="{DynamicResource RadioButtonStyle1}" />
-                        </WrapPanel>
                         <Label Content="背景色:" Style="{StaticResource Label}" />
                         <WrapPanel>
                             <Label Content="正常:" Style="{StaticResource Label2}" />
-                            <Border
-                                Margin="10"
-                                BorderBrush="{StaticResource color.field.border.norm}"
-                                BorderThickness="1"
-                                CornerRadius="4">
-                                <StackPanel Orientation="Horizontal">
-                                    <Ellipse
-                                        Width="20"
-                                        Height="20"
-                                        Margin="4,0"
-                                        Fill="#F3465B" />
-                                    <cus:ColorDropBox Margin="4,0" />
-                                </StackPanel>
-                            </Border>
+                            <compositecontrol:ColorContent SelectedColor="{Binding View.BackGround, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ShowColorList="Collapsed" />
                             <Label Content="全屏:" Style="{StaticResource Label}" />
-                            <Border
-                                Margin="10"
-                                BorderBrush="{StaticResource color.field.border.norm}"
-                                BorderThickness="1"
-                                CornerRadius="4">
-                                <StackPanel Margin="5" Orientation="Horizontal">
-                                    <Ellipse
-                                        Width="20"
-                                        Height="20"
-                                        Margin="4,0"
-                                        Fill="#FFAF25" />
-                                    <cus:ColorDropBox Margin="4,0" />
-                                </StackPanel>
-                            </Border>
+                            <compositecontrol:ColorContent SelectedColor="{Binding View.BackGroundInFulWindow, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ShowColorList="Collapsed" />
                         </WrapPanel>
                         <CheckBox
                             Margin="5,0,0,8"
                             Content="高亮表单"
-                            Foreground="{StaticResource color.sys.text.neutral.lv1}" />
+                            Foreground="{StaticResource color.sys.text.neutral.lv1}"
+                            IsChecked="{Binding View.HignlightForm, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                         <WrapPanel>
                             <Label Content="域高亮色:" Style="{StaticResource Label2}" />
-                            <Border
-                                Margin="10"
-                                BorderBrush="{StaticResource color.field.border.norm}"
-                                BorderThickness="1"
-                                CornerRadius="4">
-                                <StackPanel Margin="5" Orientation="Horizontal">
-                                    <Ellipse
-                                        Width="20"
-                                        Height="20"
-                                        Margin="4,0"
-                                        Fill="#BDDFFD" />
-                                    <cus:ColorDropBox Margin="4,0" />
-                                </StackPanel>
-                            </Border>
+                            <compositecontrol:ColorContent SelectedColor="{Binding View.FormHighLightColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ShowColorList="Collapsed" />
                         </WrapPanel>
                         <WrapPanel>
                             <Label Content="必填栏高亮色:" Style="{StaticResource Label2}" />
-                            <Border
-                                Margin="10"
-                                BorderBrush="{StaticResource color.field.border.norm}"
-                                BorderThickness="1"
-                                CornerRadius="4">
-                                <StackPanel Margin="5" Orientation="Horizontal">
-                                    <Ellipse
-                                        Width="20"
-                                        Height="20"
-                                        Margin="4,0"
-                                        Fill="#1770F4" />
-                                    <cus:ColorDropBox Margin="4,0" />
-                                </StackPanel>
-                            </Border>
+                            <compositecontrol:ColorContent SelectedColor="{Binding View.RequiredFieldsColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ShowColorList="Collapsed" />
                         </WrapPanel>
                         <CheckBox
                             Margin="5,0,0,8"
                             Content="高亮链接"
-                            Foreground="{StaticResource color.sys.text.neutral.lv1}" />
+                            Foreground="{StaticResource color.sys.text.neutral.lv1}"
+                            IsChecked="{Binding View.HighlightLink, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                     </StackPanel>
                 </ScrollViewer>
             </TabItem>
@@ -500,236 +450,115 @@
                                 </Grid.RowDefinitions>
 
                                 <Label Content="highlights:" Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Column="1"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.HighLightColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
 
                                 <Label
                                     Grid.Column="2"
                                     Content="Rectangular borders:"
                                     Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Column="3"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.RectangleBorderColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="1"
                                     Content="Strikthrough:"
                                     Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Row="1"
                                     Grid.Column="1"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.StrikethroughColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="1"
                                     Grid.Column="2"
                                     Content="Round borders:"
                                     Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Row="1"
                                     Grid.Column="3"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.CircleBorderColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="2"
                                     Content="Underline:"
                                     Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Row="2"
                                     Grid.Column="1"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.UnderLineColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="2"
                                     Grid.Column="2"
                                     Content="Line segment:"
                                     Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Row="2"
                                     Grid.Column="3"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.LineColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="3"
                                     Content="Draw:"
                                     Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Row="3"
                                     Grid.Column="1"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.FreeHandColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="3"
                                     Grid.Column="2"
                                     Content="Rectangular Fill:"
                                     Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Row="3"
                                     Grid.Column="3"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.RectangleFillColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="4"
                                     Content="Text Notes:"
                                     Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Row="4"
                                     Grid.Column="1"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.TextAnnoteColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="4"
                                     Grid.Column="2"
                                     Content="Round filling:"
                                     Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Row="4"
                                     Grid.Column="3"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.CircleFillColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="5"
                                     Content="Notes:"
                                     Style="{StaticResource Label2}" />
-                                <Border
+                                <compositecontrol:ColorContent
                                     Grid.Row="5"
                                     Grid.Column="1"
-                                    Width="66"
                                     Margin="10"
-                                    BorderBrush="{StaticResource color.field.border.norm}"
-                                    BorderThickness="1"
-                                    CornerRadius="4">
-                                    <StackPanel Margin="5" Orientation="Horizontal">
-                                        <Ellipse
-                                            Width="20"
-                                            Height="20"
-                                            Margin="4,0"
-                                            Fill="#F3465B" />
-                                        <cus:ColorDropBox Margin="4,0" />
-                                    </StackPanel>
-                                </Border>
+                                    SelectedColor="{Binding Annote.NoteAnnoteColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                             </Grid>
                         </Border>
 
@@ -740,44 +569,172 @@
                                 <ComboBox
                                     Width="228"
                                     Height="30"
-                                    SelectedIndex="0">
+                                    SelectedIndex="{Binding AnnoteSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                     <ComboBoxItem Content="系统字体" Foreground="{StaticResource color.field.text.act}" />
                                     <ComboBoxItem Content="PingFang" Foreground="{StaticResource color.field.text.act}" />
                                 </ComboBox>
-                                <ToggleButton
+                                <RadioButton
+                                    Name="RbtLeft"
                                     Width="32"
                                     Height="32"
                                     Margin="8,8,0,8"
                                     HorizontalAlignment="Center"
                                     VerticalAlignment="Center"
-                                    Style="{StaticResource infoText1}" />
-                                <ToggleButton
+                                    IsChecked="{Binding LeftSelected}"
+                                    Style="{StaticResource GreyBgRadioBtnStyle}">
+                                    <Grid Width="32" Height="32">
+                                        <Canvas Margin="5,10,0,0">
+                                            <Rectangle
+                                                Canvas.Top="0.25"
+                                                Width="14"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtLeft, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Top="4.25"
+                                                Width="8"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtLeft, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Top="12.25"
+                                                Width="8"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtLeft, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Top="8.25"
+                                                Width="14"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtLeft, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                        </Canvas>
+                                    </Grid>
+                                </RadioButton>
+                                <RadioButton
+                                    Name="RbtCenter"
                                     Width="32"
                                     Height="32"
                                     Margin="8"
                                     HorizontalAlignment="Center"
                                     VerticalAlignment="Center"
-                                    Style="{StaticResource infoText2}" />
-                                <ToggleButton
+                                    IsChecked="{Binding CenterSelected}"
+                                    Style="{StaticResource GreyBgRadioBtnStyle}">
+                                    <Grid Width="32" Height="32">
+                                        <Canvas Margin="5,10,0,0">
+                                            <Rectangle
+                                                Canvas.Top="0.25"
+                                                Width="14"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtCenter, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Left="3"
+                                                Canvas.Top="4.25"
+                                                Width="8"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtCenter, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Left="3"
+                                                Canvas.Top="12.25"
+                                                Width="8"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtCenter, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Top="8.25"
+                                                Width="14"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtCenter, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                        </Canvas>
+                                    </Grid>
+                                </RadioButton>
+                                <RadioButton
+                                    Name="RbtRight"
                                     Width="32"
                                     Height="32"
                                     Margin="0,8,8,8"
                                     HorizontalAlignment="Center"
                                     VerticalAlignment="Center"
-                                    Style="{StaticResource infoText3}" />
-                                <ToggleButton
+                                    IsChecked="{Binding RightSelected}"
+                                    Style="{StaticResource GreyBgRadioBtnStyle}">
+                                    <Grid Width="32" Height="32">
+                                        <Canvas Margin="5,10,0,0">
+                                            <Rectangle
+                                                Canvas.Top="0.25"
+                                                Width="14"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtRight, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Left="6"
+                                                Canvas.Top="4.25"
+                                                Width="8"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtRight, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Left="6"
+                                                Canvas.Top="12.25"
+                                                Width="8"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtRight, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Top="8.25"
+                                                Width="14"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtRight, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                        </Canvas>
+                                    </Grid>
+                                </RadioButton>
+                                <RadioButton
+                                    Name="RbtnStrech"
                                     Width="32"
                                     Height="32"
                                     HorizontalAlignment="Center"
                                     VerticalAlignment="Center"
-                                    Style="{StaticResource infoText4}" />
+                                    IsChecked="{Binding StrechSelected}"
+                                    Style="{StaticResource GreyBgRadioBtnStyle}">
+                                    <Grid Width="32" Height="32">
+                                        <Canvas Margin="5,10,0,0">
+                                            <Rectangle
+                                                Canvas.Top="0.25"
+                                                Width="14"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtnStrech, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Top="8.25"
+                                                Width="14"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtnStrech, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Top="4.25"
+                                                Width="14"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtnStrech, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                            <Rectangle
+                                                Canvas.Top="12.25"
+                                                Width="14"
+                                                Height="1.5"
+                                                Stroke="{Binding ElementName=RbtnStrech, Path=Foreground}"
+                                                StrokeThickness="1.5" />
+                                        </Canvas>
+                                    </Grid>
+                                </RadioButton>
                             </WrapPanel>
                             <WrapPanel>
                                 <Label Content="便签:" Style="{StaticResource Label2}" />
                                 <ComboBox
                                     Width="228"
                                     Height="30"
-                                    SelectedIndex="0">
+                                    SelectedIndex="{Binding NoteSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                     <ComboBoxItem Content="系统字体" Foreground="{StaticResource color.field.text.act}" />
                                     <ComboBoxItem Content="PingFang" Foreground="{StaticResource color.field.text.act}" />
                                 </ComboBox>
@@ -822,22 +779,19 @@
                 Width="120"
                 Height="32"
                 Margin="16,24"
+                Command="{Binding ResetCommand}"
                 Content="重置"
                 FontSize="14"
-                Foreground="{StaticResource color.btn.sec.text.def}"
                 Style="{StaticResource btn.sec}" />
             <Button
                 Width="120"
                 Height="32"
+                Command="{Binding ResetAllCommand}"
                 Content="重置全部"
                 FontSize="14"
-                Foreground="{StaticResource color.btn.sec.text.def}"
                 Style="{StaticResource btn.sec}" />
         </WrapPanel>
-        <StackPanel
-            VerticalAlignment="Top"
-            Background="{StaticResource color.sys.layout.bg.tabbar}"
-            Orientation="Horizontal">
+        <Grid VerticalAlignment="Top" Background="{StaticResource color.sys.layout.bg.tabbar}">
             <TextBlock
                 Width="550"
                 Margin="16,6"
@@ -853,42 +807,6 @@
                 HorizontalAlignment="Right"
                 Orientation="Horizontal"
                 WindowChrome.IsHitTestVisibleInChrome="True">
-                <Button
-                    Name="BtnMiniSize"
-                    Width="40"
-                    Height="40"
-                    Background="Transparent"
-                    BorderThickness="0"
-                    Click="BtnMiniSize_Click"
-                    Style="{StaticResource TitleBarBtn}">
-                    <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 7 14 8 2 8 2 7">
-                        <Polygon.RenderTransform>
-                            <TransformGroup>
-                                <TranslateTransform Y="-3" />
-                            </TransformGroup>
-                        </Polygon.RenderTransform>
-                    </Polygon>
-                </Button>
-                <Button
-                    Name="BtnReStore"
-                    Width="40"
-                    Height="40"
-                    Background="Transparent"
-                    BorderThickness="0"
-                    Click="BtnReStore_Click"
-                    Style="{StaticResource TitleBarBtn}">
-                    <Grid>
-                        <Path
-                            x:Name="ico_max"
-                            Data="M14,2 L14,14 L2,14 L2,2 L14,2 Z M13,3 L3,3 L3,13 L13,13 L13,3 Z"
-                            Fill="{StaticResource color.btn.sec.text.def}"
-                            Visibility="Collapsed" />
-                        <Grid x:Name="ico_mini" Visibility="{Binding ElementName=ico_max, Path=Visibility, Converter={StaticResource UnvisibleConvert}}">
-                            <Path Data="M11,5 L11,14 L2,14 L2,5 L11,5 Z M10,6 L3,6 L3,13 L10,13 L10,6 Z" Fill="{StaticResource color.btn.sec.text.def}" />
-                            <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 2 14 11 11 11 11 10 13 10 13 3 6 3 6 5 5 5 5 2" />
-                        </Grid>
-                    </Grid>
-                </Button>
                 <Button
                     Name="BtnClose"
                     Width="40"
@@ -900,6 +818,6 @@
                     <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="11.2919922 12 12 11.2919922 6.70800781 6 12 0.708007813 11.2919922 0 6 5.29199219 0.708007812 9.76996262e-15 -2.27456942e-13 0.708007813 5.29199219 6 0 11.2919922 0.708007812 12 6 6.70800781" />
                 </Button>
             </StackPanel>
-        </StackPanel>
+        </Grid>
     </Grid>
 </UserControl>

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

@@ -25,26 +25,9 @@ namespace PDF_Office.Views.Dialog
             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));
-            }
-        }
     }
 }

+ 16 - 16
PDFSettings/APPSettingProperties.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
-using System.Drawing;
+using System.Windows.Media;
 using ComPDFKitViewer.PdfViewer;
 using ComPDFKitViewer;
 
@@ -145,12 +145,12 @@ namespace PDFSettings
         /// <summary>
         /// 阅读页背景色
         /// </summary>
-        public Color BackGround = Color.White;
+        public Color BackGround = Colors.White;
 
         /// <summary>
         /// 全屏背景色
         /// </summary>
-        public Color BackGroundInFulWindow = Color.White;
+        public Color BackGroundInFulWindow = Colors.White;
 
         /// <summary>
         ///高亮表单
@@ -160,12 +160,12 @@ namespace PDFSettings
         /// <summary>
         /// 域高亮色
         /// </summary>
-        public Color FormHighLightColor = Color.White;
+        public Color FormHighLightColor = Colors.White;
 
         /// <summary>
         /// 必填栏高亮色
         /// </summary>
-        public Color RequiredFieldsColor = Color.White;
+        public Color RequiredFieldsColor = Colors.White;
 
         /// <summary>
         /// 高亮链接
@@ -177,17 +177,17 @@ namespace PDFSettings
     {
         //各类型注释默认颜色
 
-        public Color HighLightColor = Color.White;
-        public Color UnderLineColor = Color.White;
-        public Color StrikethroughColor = Color.White;
-        public Color FreeHandColor = Color.White;
-        public Color TextAnnoteColor = Color.White;
-        public Color NoteAnnoteColor = Color.White;
-        public Color RectangleBorderColor = Color.White;
-        public Color RectangleFillColor = Color.White;
-        public Color CircleBorderColor = Color.White;
-        public Color CircleFillColor = Color.White;
-        public Color LineColor = Color.White;
+        public Color HighLightColor = Colors.White;
+        public Color UnderLineColor = Colors.White;
+        public Color StrikethroughColor = Colors.White;
+        public Color FreeHandColor = Colors.White;
+        public Color TextAnnoteColor = Colors.White;
+        public Color NoteAnnoteColor = Colors.White;
+        public Color RectangleBorderColor = Colors.White;
+        public Color RectangleFillColor = Colors.White;
+        public Color CircleBorderColor = Colors.White;
+        public Color CircleFillColor = Colors.White;
+        public Color LineColor = Colors.White;
 
         /// <summary>
         ///文本对齐方式