123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062 |
- 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();
- 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()
- {
- 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)
- {
-
- }
- }
- }
|