1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075 |
- using PDF_Master.Helper;
- using PDF_Master.Model.SettingsDialog;
- using PDF_Master.Properties;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PDF_Master.ViewModels.Dialog
- {
- public class SettingsDialogViewModel : BindableBase, IDialogAware
- {
- public string Title => "";
- public event Action<IDialogResult> RequestClose;
- #region 文案
- private string _Settings_Preferences = "";
- public string Settings_Preferences
- {
- get { return _Settings_Preferences; }
- set
- {
- SetProperty(ref _Settings_Preferences, value);
- }
- }
- private string _Settings_General = "";
- public string Settings_General
- {
- get { return _Settings_General; }
- set
- {
- SetProperty(ref _Settings_General, value);
- }
- }
- private string _Settings_Display = "";
- public string Settings_Display
- {
- get { return _Settings_Display; }
- set
- {
- SetProperty(ref _Settings_Display, value);
- }
- }
- private string _Settings_Annotation = "";
- public string Settings_Annotation
- {
- get { return _Settings_Annotation; }
- set
- {
- SetProperty(ref _Settings_Annotation, value);
- }
- }
- private string _Settings_General_Documents = "";
- public string Settings_General_Documents
- {
- get { return _Settings_General_Documents; }
- set
- {
- SetProperty(ref _Settings_General_Documents, value);
- }
- }
- private string _Settings_General_Open = "";
- public string Settings_General_Open
- {
- get { return _Settings_General_Open; }
- set
- {
- SetProperty(ref _Settings_General_Open, value);
- }
- }
- private string _Settings_General_Restore = "";
- public string Settings_General_Restore
- {
- get { return _Settings_General_Restore; }
- set
- {
- SetProperty(ref _Settings_General_Restore, value);
- }
- }
- private string _Settings_General_Maximum = "";
- public string Settings_General_Maximum
- {
- get { return _Settings_General_Maximum; }
- set
- {
- SetProperty(ref _Settings_General_Maximum, value);
- }
- }
- private string _Settings_General_Auto = "";
- public string Settings_General_Auto
- {
- get { return _Settings_General_Auto; }
- set
- {
- SetProperty(ref _Settings_General_Auto, value);
- }
- }
- private string _Settings_General_Close = "";
- public string Settings_General_Close
- {
- get { return _Settings_General_Close; }
- set
- {
- SetProperty(ref _Settings_General_Close, value);
- }
- }
- private string _Settings_General_ASave = "";
- public string Settings_General_ASave
- {
- get { return _Settings_General_ASave; }
- set
- {
- SetProperty(ref _Settings_General_ASave, value);
- }
- }
- private string _Settings_General_Savedirectly = "";
- public string Settings_General_Savedirectly
- {
- get { return _Settings_General_Savedirectly; }
- set
- {
- SetProperty(ref _Settings_General_Savedirectly, value);
- }
- }
- private string _Settings_General_Author = "";
- public string Settings_General_Author
- {
- get { return _Settings_General_Author; }
- set
- {
- SetProperty(ref _Settings_General_Author, value);
- }
- }
- private string _Settings_Display_Default = "";
- public string Settings_Display_Default
- {
- get { return _Settings_Display_Default; }
- set
- {
- SetProperty(ref _Settings_Display_Default, value);
- }
- }
- private string _Settings_Display_Page = "";
- public string Settings_Display_Page
- {
- get { return _Settings_Display_Page; }
- set
- {
- SetProperty(ref _Settings_Display_Page, value);
- }
- }
- private string _Settings_Display_Singlepage = "";
- public string Settings_Display_Singlepage
- {
- get { return _Settings_Display_Singlepage; }
- set
- {
- SetProperty(ref _Settings_Display_Singlepage, value);
- }
- }
- private string _Settings_Display_Singlepagecon = "";
- public string Settings_Display_Singlepagecon
- {
- get { return _Settings_Display_Singlepagecon; }
- set
- {
- SetProperty(ref _Settings_Display_Singlepagecon, value);
- }
- }
- private string _Settings_Display_Twopage = "";
- public string Settings_Display_Twopage
- {
- get { return _Settings_Display_Twopage; }
- set
- {
- SetProperty(ref _Settings_Display_Twopage, value);
- }
- }
- private string _Settings_Display_Twopagecon = "";
- public string Settings_Display_Twopagecon
- {
- get { return _Settings_Display_Twopagecon; }
- set
- {
- SetProperty(ref _Settings_Display_Twopagecon, value);
- }
- }
- private string _Settings_Display_Bookmode = "";
- public string Settings_Display_Bookmode
- {
- get { return _Settings_Display_Bookmode; }
- set
- {
- SetProperty(ref _Settings_Display_Bookmode, value);
- }
- }
- private string _Settings_Display_Bookmodecon = "";
- public string Settings_Display_Bookmodecon
- {
- get { return _Settings_Display_Bookmodecon; }
- set
- {
- SetProperty(ref _Settings_Display_Bookmodecon, value);
- }
- }
- private string _Settings_Display_Zoom = "";
- public string Settings_Display_Zoom
- {
- get { return _Settings_Display_Zoom; }
- set
- {
- SetProperty(ref _Settings_Display_Zoom, value);
- }
- }
- private string _Settings_Display_Fitwidth = "";
- public string Settings_Display_Fitwidth
- {
- get { return _Settings_Display_Fitwidth; }
- set
- {
- SetProperty(ref _Settings_Display_Fitwidth, value);
- }
- }
- private string _Settings_Display_Fitpage = "";
- public string Settings_Display_Fitpage
- {
- get { return _Settings_Display_Fitpage; }
- set
- {
- SetProperty(ref _Settings_Display_Fitpage, value);
- }
- }
- private string _Settings_Display_Actualsize = "";
- public string Settings_Display_Actualsize
- {
- get { return _Settings_Display_Actualsize; }
- set
- {
- SetProperty(ref _Settings_Display_Actualsize, value);
- }
- }
- private string _Settings_Display_LeftPanel = "";
- public string Settings_Display_LeftPanel
- {
- get { return _Settings_Display_LeftPanel; }
- set
- {
- SetProperty(ref _Settings_Display_LeftPanel, value);
- }
- }
- private string _Settings_Display_Collapse = "";
- public string Settings_Display_Collapse
- {
- get { return _Settings_Display_Collapse; }
- set
- {
- SetProperty(ref _Settings_Display_Collapse, value);
- }
- }
- private string _Settings_Display_Remember = "";
- public string Settings_Display_Remember
- {
- get { return _Settings_Display_Remember; }
- set
- {
- SetProperty(ref _Settings_Display_Remember, value);
- }
- }
- private string _Settings_Display_Show = "";
- public string Settings_Display_Show
- {
- get { return _Settings_Display_Show; }
- set
- {
- SetProperty(ref _Settings_Display_Show, value);
- }
- }
- private string _Settings_Display_Properties = "";
- public string Settings_Display_Properties
- {
- get { return _Settings_Display_Properties; }
- set
- {
- SetProperty(ref _Settings_Display_Properties, value);
- }
- }
- private string _Settings_Display_Display = "";
- public string Settings_Display_Display
- {
- get { return _Settings_Display_Display; }
- set
- {
- SetProperty(ref _Settings_Display_Display, value);
- }
- }
- private string _Settings_Display_Auto = "";
- public string Settings_Display_Auto
- {
- get { return _Settings_Display_Auto; }
- set
- {
- SetProperty(ref _Settings_Display_Auto, value);
- }
- }
- private string _Settings_Display_Manually = "";
- public string Settings_Display_Manually
- {
- get { return _Settings_Display_Manually; }
- set
- {
- SetProperty(ref _Settings_Display_Manually, value);
- }
- }
- private string _Settings_Display_Background = "";
- public string Settings_Display_Background
- {
- get { return _Settings_Display_Background; }
- set
- {
- SetProperty(ref _Settings_Display_Background, value);
- }
- }
- private string _Settings_Display_Normal = "";
- public string Settings_Display_Normal
- {
- get { return _Settings_Display_Normal; }
- set
- {
- SetProperty(ref _Settings_Display_Normal, value);
- }
- }
- private string _Settings_Display_Full = "";
- public string Settings_Display_Full
- {
- get { return _Settings_Display_Full; }
- set
- {
- SetProperty(ref _Settings_Display_Full, value);
- }
- }
- private string _Settings_Display_Highlight = "";
- public string Settings_Display_Highlight
- {
- get { return _Settings_Display_Highlight; }
- set
- {
- SetProperty(ref _Settings_Display_Highlight, value);
- }
- }
- private string _Settings_Annotation_Annotation = "";
- public string Settings_Annotation_Annotation
- {
- get { return _Settings_Annotation_Annotation; }
- set
- {
- SetProperty(ref _Settings_Annotation_Annotation, value);
- }
- }
- private string _Settings_Annotation_Highlight = "";
- public string Settings_Annotation_Highlight
- {
- get { return _Settings_Annotation_Highlight; }
- set
- {
- SetProperty(ref _Settings_Annotation_Highlight, value);
- }
- }
- private string _Settings_Annotation_Underline = "";
- public string Settings_Annotation_Underline
- {
- get { return _Settings_Annotation_Underline; }
- set
- {
- SetProperty(ref _Settings_Annotation_Underline, value);
- }
- }
- private string _Settings_Annotation_Strikethrough = "";
- public string Settings_Annotation_Strikethrough
- {
- get { return _Settings_Annotation_Strikethrough; }
- set
- {
- SetProperty(ref _Settings_Annotation_Strikethrough, value);
- }
- }
- private string _Settings_Annotation_Freehand = "";
- public string Settings_Annotation_Freehand
- {
- get { return _Settings_Annotation_Freehand; }
- set
- {
- SetProperty(ref _Settings_Annotation_Freehand, value);
- }
- }
- private string _Settings_Annotation_TextBox = "";
- public string Settings_Annotation_TextBox
- {
- get { return _Settings_Annotation_TextBox; }
- set
- {
- SetProperty(ref _Settings_Annotation_TextBox, value);
- }
- }
- private string _Settings_Annotation_StickyNote = "";
- public string Settings_Annotation_StickyNote
- {
- get { return _Settings_Annotation_StickyNote; }
- set
- {
- SetProperty(ref _Settings_Annotation_StickyNote, value);
- }
- }
- private string _Settings_Annotation_RectangleBorder = "";
- public string Settings_Annotation_RectangleBorder
- {
- get { return _Settings_Annotation_RectangleBorder; }
- set
- {
- SetProperty(ref _Settings_Annotation_RectangleBorder, value);
- }
- }
- private string _Settings_Annotation_CircleBorder = "";
- public string Settings_Annotation_CircleBorder
- {
- get { return _Settings_Annotation_CircleBorder; }
- set
- {
- SetProperty(ref _Settings_Annotation_CircleBorder, value);
- }
- }
- private string _Settings_Annotation_Line = "";
- public string Settings_Annotation_Line
- {
- get { return _Settings_Annotation_Line; }
- set
- {
- SetProperty(ref _Settings_Annotation_Line, value);
- }
- }
- private string _Settings_Annotation_RectangleFill = "";
- public string Settings_Annotation_RectangleFill
- {
- get { return _Settings_Annotation_RectangleFill; }
- set
- {
- SetProperty(ref _Settings_Annotation_RectangleFill, value);
- }
- }
- private string _Settings_Annotation_CircleFill = "";
- public string Settings_Annotation_CircleFill
- {
- get { return _Settings_Annotation_CircleFill; }
- set
- {
- SetProperty(ref _Settings_Annotation_CircleFill, value);
- }
- }
- private string _Settings_Annotation_Text = "";
- public string Settings_Annotation_Text
- {
- get { return _Settings_Annotation_Text; }
- set
- {
- SetProperty(ref _Settings_Annotation_Text, value);
- }
- }
- private string T_settings_Annotation_Font = "";
- public string T_Settings_Annotation_Font
- {
- get { return T_settings_Annotation_Font; }
- set
- {
- SetProperty(ref T_settings_Annotation_Font, value);
- }
- }
- private string _Settings_ResetAll = "";
- public string Settings_ResetAll
- {
- get { return _Settings_ResetAll; }
- set
- {
- SetProperty(ref _Settings_ResetAll, value);
- }
- }
- private string _Settings_Reset = "";
- public string Settings_Reset
- {
- get { return _Settings_Reset; }
- set
- {
- SetProperty(ref _Settings_Reset, value);
- }
- }
- private string _Settings_Display_DefaultV = "";
- public string Settings_Display_DefaultV
- {
- get { return _Settings_Display_DefaultV; }
- set
- {
- SetProperty(ref _Settings_Display_DefaultV, value);
- }
- }
- private void InitString()
- {
- Settings_Display_DefaultV = App.MainPageLoader.GetString("Settings_Display_DefaultV");
- Settings_Annotation_CircleFill = App.MainPageLoader.GetString("Settings_Annotation_CircleFill");
- Settings_Annotation_Freehand = App.MainPageLoader.GetString("Settings_Annotation_Freehand");
- Settings_Annotation_TextBox = App.MainPageLoader.GetString("Settings_Annotation_TextBox");
- Settings_Annotation_Line = App.MainPageLoader.GetString("Settings_Annotation_Line");
- Settings_Annotation_StickyNote = App.MainPageLoader.GetString("Settings_Annotation_StickyNote");
- Settings_Annotation_RectangleFill = App.MainPageLoader.GetString("Settings_Annotation_RectangleFill");
- Settings_Annotation_RectangleBorder = App.MainPageLoader.GetString("Settings_Annotation_RectangleBorder");
- Settings_Annotation_CircleBorder = App.MainPageLoader.GetString("Settings_Annotation_CircleBorder");
- Settings_Annotation_Text = App.MainPageLoader.GetString("Settings_Annotation_Text");
- Settings_Reset = App.MainPageLoader.GetString("Settings_Reset");
- Settings_ResetAll = App.MainPageLoader.GetString("Settings_ResetAll");
- Settings_Annotation_Strikethrough = App.MainPageLoader.GetString("Settings_Annotation_Strikethrough");
- Settings_Annotation_Underline = App.MainPageLoader.GetString("Settings_Annotation_Underline");
- Settings_Annotation_Highlight = App.MainPageLoader.GetString("Settings_Annotation_Highlight");
- Settings_Annotation_Annotation = App.MainPageLoader.GetString("Settings_Annotation_Annotation");
- Settings_Display_Highlight = App.MainPageLoader.GetString("Settings_Display_Highlight");
- Settings_Display_Collapse = App.MainPageLoader.GetString("Settings_Display_Collapse");
- Settings_Display_Fitwidth = App.MainPageLoader.GetString("Settings_Display_Fitwidth");
- Settings_General_Open = App.MainPageLoader.GetString("Settings_General_Open");
- Settings_General_Documents = App.MainPageLoader.GetString("Settings_General_Documents");
- Settings_Annotation = App.MainPageLoader.GetString("Settings_Annotation");
- Settings_Preferences = App.MainPageLoader.GetString("Settings_Preferences");
- Settings_General = App.MainPageLoader.GetString("Settings_General");
- Settings_Display = App.MainPageLoader.GetString("Settings_Display");
- Settings_General_Restore = App.MainPageLoader.GetString("Settings_General_Restore");
- Settings_General_Maximum = App.MainPageLoader.GetString("Settings_General_Maximum");
- Settings_General_Auto = App.MainPageLoader.GetString("Settings_General_Auto");
- Settings_General_Close = App.MainPageLoader.GetString("Settings_General_Close");
- Settings_General_ASave = App.MainPageLoader.GetString("Settings_General_ASave");
- Settings_General_Savedirectly = App.MainPageLoader.GetString("Settings_General_Savedirectly");
- Settings_General_Author = App.MainPageLoader.GetString("Settings_General_Author");
- Settings_Display_Default = App.MainPageLoader.GetString("Settings_Display_Default");
- Settings_Display_Page = App.MainPageLoader.GetString("Settings_Display_Page");
- Settings_Display_Singlepage = App.MainPageLoader.GetString("Settings_Display_Singlepage");
- Settings_Display_Singlepagecon = App.MainPageLoader.GetString("Settings_Display_Singlepagecon");
- Settings_Display_Twopage = App.MainPageLoader.GetString("Settings_Display_Twopage");
- Settings_Display_Fitpage = App.MainPageLoader.GetString("Settings_Display_Fitpage");
- Settings_Display_Twopagecon = App.MainPageLoader.GetString("Settings_Display_Twopagecon");
- Settings_Display_Bookmode = App.MainPageLoader.GetString("Settings_Display_Bookmode");
- Settings_Display_Bookmodecon = App.MainPageLoader.GetString("Settings_Display_Bookmodecon");
- Settings_Display_Zoom = App.MainPageLoader.GetString("Settings_Display_Zoom");
- Settings_Display_Actualsize = App.MainPageLoader.GetString("Settings_Display_Actualsize");
- Settings_Display_LeftPanel = App.MainPageLoader.GetString("Settings_Display_LeftPanel");
- Settings_Display_Properties = App.MainPageLoader.GetString("Settings_Display_Properties");
- Settings_Display_Show = App.MainPageLoader.GetString("Settings_Display_Show");
- Settings_Display_Display = App.MainPageLoader.GetString("Settings_Display_Display");
- Settings_Display_Remember = App.MainPageLoader.GetString("Settings_Display_Remember");
- Settings_Display_Auto = App.MainPageLoader.GetString("Settings_Display_Auto");
- Settings_Display_Normal = App.MainPageLoader.GetString("Settings_Display_Normal");
- Settings_Display_Background = App.MainPageLoader.GetString("Settings_Display_Background");
- Settings_Display_Manually = App.MainPageLoader.GetString("Settings_Display_Manually");
- Settings_Display_Full = App.MainPageLoader.GetString("Settings_Display_Full");
- T_Settings_Annotation_Font = App.MainPageLoader.GetString("Settings_Annotation_Annotation_Font");
- }
- #endregion
- 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 ObservableCollection<string> AnnoteFamilyList { get; set; }
- public ObservableCollection<string> PageViewList { get; set; }
- public ObservableCollection<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 New";
- 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;
- //选中的模式
- 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;
- public int PageViewSelctedIndex
- {
- get { return pageViewSelectedIndex; }
- set
- {
- SetProperty(ref pageViewSelectedIndex, value);
- View.PageView = (ComPDFKitViewer.ViewMode)(value+1);
- }
- }
- private int zoomModeSelectedIndex ;
- 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;
- }
- }
- }
- private bool autoSaveEnable = true;
- /// <summary>
- /// 是否允许设置自动保存
- /// 未付费用户 不进行自动保存
- /// </summary>
- public bool AutoSaveEnable
- {
- get { return autoSaveEnable; }
- set { autoSaveEnable = value; }
- }
- public SettingsDialogViewModel()
- {
- InitString();
- Annote = new AnnotateModel();
- Descript = new DescriptionModel();
- View = new InitialVIewModel();
- PageViewList = new ObservableCollection<string>();
- AnnoteFamilyList = new ObservableCollection<string>();
- ZoomModeList = new ObservableCollection<string>();
- ResetAllCommand = new DelegateCommand(resetAll);
- ResetCommand = new DelegateCommand(reset);
- InitAnnoteFamily();
- InitPageViews();
- InitZoomMode();
- //根据缓存还原下拉框 单选等
- InitAnnote();
- InitView();
- //判断是否以管理员身份运行
- IsSetDefualtAppEnable = Win32Helper.IsRunAsAdmin();
- IsDefualtApp = Win32Helper.IsDefaultApp();
- //未付费用户不进行自动保存
- if (!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1)
- {
- AutoSaveEnable = false;
- Descript.AutoSave = false;
- }
- }
- 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 New")
- {
- 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.Clear();
- PageViewList.Add(Settings_Display_Singlepage);
- PageViewList.Add(Settings_Display_Singlepagecon);
- PageViewList.Add(Settings_Display_Twopage);
- PageViewList.Add(Settings_Display_Twopagecon);
- PageViewList.Add(Settings_Display_Bookmode);
- PageViewList.Add(Settings_Display_Bookmodecon);
- }
- private void InitZoomMode()
- {
- ZoomModeList.Clear();
- ZoomModeList.Add(Settings_Display_Fitwidth);
- ZoomModeList.Add(Settings_Display_Fitpage);
- ZoomModeList.Add(Settings_Display_Actualsize);
- }
- private void InitAnnoteFamily()
- {
- AnnoteFamilyList.Clear();
- AnnoteFamilyList.Add("Courier New");
- AnnoteFamilyList.Add("Arial");
- AnnoteFamilyList.Add("Times New Roman");
- }
- /// <summary>
- /// 重置
- /// </summary>
- private void reset()
- {
- switch (ModeSelectedIndex)
- {
- case 0:
- Descript.Reset();
- //未付费用户不进行自动保存
- if (!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1)
- {
- AutoSaveEnable = false;
- Descript.AutoSave = false;
- }
- break;
- case 1:
- View.Reset();
- InitView();
- break;
- case 2:
- Annote.Reset();
- InitAnnote();
- break;
- default:
- break;
- }
- }
- /// <summary>
- /// 全部重置
- /// </summary>
- private void resetAll()
- {
- View.Reset();
- Descript.Reset();
- //未付费用户不进行自动保存
- if (!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1)
- {
- AutoSaveEnable = false;
- Descript.AutoSave = false;
- }
- Annote.Reset();
- InitAnnote();
- InitView();
- }
- public bool CanCloseDialog()
- {
- return true;
- }
- public void OnDialogClosed()
- {
- try
- {
- View.Save();
- Annote.Save();
- Descript.Save();
- Win32Helper.RegisterDefaultApp(IsDefualtApp);
- Settings.Default.Save();
- //弹窗已关闭调用再次关闭方法会异常
- //RequestClose.Invoke(new DialogResult());
- }
- catch { }
- }
- public void OnDialogOpened(IDialogParameters parameters)
- {
-
- }
- }
- }
|