123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- using PDF_Master.Properties;
- using PDFSettings;
- using Prism.Mvvm;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PDF_Master.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();
- }
- /// <summary>
- /// 重置
- /// </summary>
- public void Reset()
- {
- var description = new DescriptionPropertyClass();
- 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;
- }
- /// <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;
- }
- }
- }
|