12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043 |
- 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;
- }
- }
- }
- 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();
-
- }
- 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();
- }
- catch { }
- }
- public void OnDialogOpened(IDialogParameters parameters)
- {
-
- }
- }
- }
|