AppConfig.cs 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093
  1. 
  2. using GeekDesk.Constant;
  3. using GeekDesk.Util;
  4. using GeekDesk.ViewModel.Temp;
  5. using Newtonsoft.Json;
  6. using System;
  7. using System.Collections.ObjectModel;
  8. using System.ComponentModel;
  9. using System.Windows;
  10. using System.Windows.Input;
  11. using System.Windows.Media.Imaging;
  12. using static GeekDesk.Util.GlobalHotKey;
  13. /// <summary>
  14. /// 程序设置
  15. /// </summary>
  16. namespace GeekDesk.ViewModel
  17. {
  18. [Serializable]
  19. public class AppConfig : INotifyPropertyChanged
  20. {
  21. private SortType menuSortType = SortType.CUSTOM; //菜单排序类型
  22. private SortType iconSortType = SortType.CUSTOM; //图表排序类型
  23. private double windowWidth = (double)CommonEnum.WINDOW_WIDTH; //窗口宽度
  24. private double windowHeight = (double)CommonEnum.WINDOW_HEIGHT; //窗口高度
  25. private double menuCardWidth = (double)CommonEnum.MENU_CARD_WIDHT;//菜单栏宽度
  26. private int selectedMenuIndex = 0; //上次选中菜单索引
  27. private bool followMouse = true; //面板跟随鼠标 默认是
  28. private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
  29. private Visibility titleLogoVisible = Visibility.Visible; // 标题logo是否显示
  30. private AppHideType appHideType = AppHideType.START_EXE; //面板关闭方式 (默认启动程序后)
  31. private bool startedShowPanel = true; //启动时是否显示主面板 默认显示
  32. [field: NonSerialized]
  33. private BitmapImage bitmapImage; //位图
  34. private byte[] imageByteArr; //背景图片 byte数组
  35. private string bacImgName = "系统默认";
  36. private int cardOpacity = 10; //默认0.1的不透明度 此处显示数值 * 100
  37. private int bgOpacity = 100; // 背景图片不透明度 此处显示数值 * 100
  38. private int pannelOpacity = 100; //主面板不透明度 此处显示数值 * 100
  39. private int pannelCornerRadius = 4; //面板圆角 默认4
  40. [field: NonSerialized]
  41. private ObservableCollection<IconInfo> selectedMenuIcons;
  42. private string hotkeyStr = "Ctrl + Q"; //默认启动面板快捷键
  43. private HotkeyModifiers hotkeyModifiers = HotkeyModifiers.MOD_CONTROL; //默认启动面板快捷键
  44. private Key hotkey = Key.Q; //默认启动面板快捷键
  45. private string toDoHotkeyStr = "Ctrl + Shift + Q"; //待办任务快捷键
  46. private HotkeyModifiers toDoHotkeyModifiers; //待办任务快捷键
  47. private Key toDoHotkey = Key.Q; //待办任务快捷键
  48. private string colorPickerHotkeyStr = ""; //拾色器快捷键
  49. private HotkeyModifiers colorPickerHotkeyModifiers; //拾色器快捷键
  50. private Key colorPickerHotkey; //拾色器快捷键
  51. private string customIconUrl; //自定义图标url
  52. private string customIconJsonUrl; //自定义图标json信息url
  53. private bool blurEffect = true; //毛玻璃效果 默认是
  54. private double blurValue;
  55. private UpdateType updateType = UpdateType.Gitee; //更新源 默认gitee源
  56. private bool selfStartUp = true; //开机自启动设置
  57. private bool selfStartUped = false; //是否已设置
  58. private bool pmModel = false; //性能模式
  59. private string textColor = "#000000"; //字体颜色
  60. private double imgPanelWidth = (double)CommonEnum.IMAGE_PANEL_WIDTH;
  61. private double imgPanelHeight = (double)CommonEnum.IMAGE_PANEL_HEIGHT;
  62. private bool marginHide = false; //贴边隐藏
  63. private bool appAnimation = false; //主窗口动画效果
  64. private int imageWidth = (int)CommonEnum.IMAGE_WIDTH; //图片宽度
  65. private int imageHeight = (int)CommonEnum.IMAGE_HEIGHT; //图片高度
  66. private bool mouseMiddleShow = true; //鼠标中键呼出 默认启用
  67. private bool showBarIcon = true; //显示托盘图标 默认显示
  68. private bool doubleOpen = false; //双击打开项目 默认关闭
  69. private bool hoverMenu = false; //悬停切换菜单 默认关闭
  70. private BGStyle bgStyle = BGStyle.ImgBac; //背景风格
  71. private GradientBGParam gradientBGParam = null; //渐变背景参数
  72. private bool? enableAppHotKey = true; //可能为null 开启热键
  73. private bool? enableTodoHotKey = true; //可能为null 开启待办热键
  74. private bool enableColorPickerHotKey; //新增 默认为false 不需要考虑null值
  75. private SearchType searchType;
  76. private string sysBakTime; //系统自动备份时间
  77. private string menuPassword; //锁菜单密码
  78. private string passwordHint; //密码提示
  79. private bool? isShow;
  80. private bool itemSpradeAnimation; //列表展开动画
  81. private bool? secondsWindow; //秒数窗口 默认打开
  82. private bool? enableEveryThing; //开启everything
  83. private bool? alwaysTopmost; //是否置顶
  84. private bool? showIconTitle = true; //是否显示iconTitle
  85. private bool iconBatch = false; //批量操作图标状态
  86. private ObservableCollection<GradientBGParam> customBGParams; //自定义纯色背景
  87. public ObservableCollection<GradientBGParam> CustomBGParams
  88. {
  89. get
  90. {
  91. if (customBGParams == null)
  92. {
  93. customBGParams = new ObservableCollection<GradientBGParam>();
  94. }
  95. return customBGParams;
  96. }
  97. set
  98. {
  99. customBGParams = value;
  100. OnPropertyChanged("CustomBGParams");
  101. }
  102. }
  103. public bool IconBatch_NoWrite
  104. {
  105. get
  106. {
  107. return iconBatch;
  108. }
  109. set
  110. {
  111. iconBatch = value;
  112. OnPropertyChanged("IconBatch_NoWrite");
  113. }
  114. }
  115. public bool? ShowIconTitle
  116. {
  117. get
  118. {
  119. if (showIconTitle == null) showIconTitle = true;
  120. return showIconTitle;
  121. }
  122. set
  123. {
  124. showIconTitle = value;
  125. OnPropertyChanged("ShowIconTitle");
  126. }
  127. }
  128. public bool? AlwaysTopmost
  129. {
  130. get
  131. {
  132. if (alwaysTopmost == null) alwaysTopmost = false;
  133. return alwaysTopmost;
  134. }
  135. set
  136. {
  137. alwaysTopmost = value;
  138. OnPropertyChanged("AlwaysTopmost");
  139. }
  140. }
  141. public bool? EnableEveryThing
  142. {
  143. get
  144. {
  145. if (enableEveryThing == null) enableEveryThing = false;
  146. return enableEveryThing;
  147. }
  148. set
  149. {
  150. enableEveryThing = value;
  151. OnPropertyChanged("EnableEveryThing");
  152. }
  153. }
  154. #region GetSet
  155. public bool? SecondsWindow
  156. {
  157. get
  158. {
  159. if (secondsWindow == null) secondsWindow = true;
  160. return secondsWindow;
  161. }
  162. set
  163. {
  164. secondsWindow = value;
  165. OnPropertyChanged("SecondsWindow");
  166. }
  167. }
  168. public bool ItemSpradeAnimation
  169. {
  170. get
  171. {
  172. return itemSpradeAnimation;
  173. }
  174. set
  175. {
  176. itemSpradeAnimation = value;
  177. OnPropertyChanged("ItemSpradeAnimation");
  178. }
  179. }
  180. public bool? IsShow
  181. {
  182. get
  183. {
  184. return isShow;
  185. }
  186. set
  187. {
  188. isShow = value;
  189. OnPropertyChanged("IsShow");
  190. }
  191. }
  192. public string PasswordHint
  193. {
  194. get
  195. {
  196. return passwordHint;
  197. }
  198. set
  199. {
  200. passwordHint = value;
  201. OnPropertyChanged("PasswordHint");
  202. }
  203. }
  204. public string MenuPassword
  205. {
  206. get
  207. {
  208. return menuPassword;
  209. }
  210. set
  211. {
  212. menuPassword = value;
  213. OnPropertyChanged("MenuPassword");
  214. }
  215. }
  216. public string SysBakTime
  217. {
  218. get
  219. {
  220. return sysBakTime;
  221. }
  222. set
  223. {
  224. sysBakTime = value;
  225. }
  226. }
  227. public SearchType SearchType
  228. {
  229. get
  230. {
  231. return searchType;
  232. }
  233. set
  234. {
  235. searchType = value;
  236. OnPropertyChanged("SearchType");
  237. }
  238. }
  239. public bool EnableColorPickerHotKey
  240. {
  241. get
  242. {
  243. return enableColorPickerHotKey;
  244. }
  245. set
  246. {
  247. enableColorPickerHotKey = value;
  248. OnPropertyChanged("EnableColorPickerHotKey");
  249. }
  250. }
  251. public bool? EnableAppHotKey
  252. {
  253. get
  254. {
  255. if (enableAppHotKey == null) enableAppHotKey = true;
  256. return enableAppHotKey;
  257. }
  258. set
  259. {
  260. enableAppHotKey = value;
  261. OnPropertyChanged("EnableAppHotKey");
  262. }
  263. }
  264. public bool? EnableTodoHotKey
  265. {
  266. get
  267. {
  268. if (enableTodoHotKey == null) enableTodoHotKey = true;
  269. return enableTodoHotKey;
  270. }
  271. set
  272. {
  273. enableTodoHotKey = value;
  274. OnPropertyChanged("EnableTodoHotKey");
  275. }
  276. }
  277. public Visibility TitleLogoVisible
  278. {
  279. get
  280. {
  281. return titleLogoVisible;
  282. }
  283. set
  284. {
  285. titleLogoVisible = value;
  286. OnPropertyChanged("TitleLogoVisible");
  287. }
  288. }
  289. public GradientBGParam GradientBGParam
  290. {
  291. get
  292. {
  293. if (gradientBGParam == null)
  294. {
  295. gradientBGParam = DeepCopyUtil.DeepCopy(GradientBGParamList.GradientBGParams[0]);
  296. }
  297. return gradientBGParam;
  298. }
  299. set
  300. {
  301. gradientBGParam = value;
  302. OnPropertyChanged("GradientBGParam");
  303. }
  304. }
  305. public BGStyle BGStyle
  306. {
  307. get
  308. {
  309. if (bgStyle == 0)
  310. {
  311. bgStyle = (BGStyle)1;
  312. }
  313. return bgStyle;
  314. }
  315. set
  316. {
  317. bgStyle = value;
  318. OnPropertyChanged("BGStyle");
  319. }
  320. }
  321. public bool HoverMenu
  322. {
  323. get
  324. {
  325. return hoverMenu;
  326. }
  327. set
  328. {
  329. hoverMenu = value;
  330. OnPropertyChanged("HoverMenu");
  331. }
  332. }
  333. public bool DoubleOpen
  334. {
  335. get
  336. {
  337. return doubleOpen;
  338. }
  339. set
  340. {
  341. doubleOpen = value;
  342. OnPropertyChanged("DoubleOpen");
  343. }
  344. }
  345. public bool ShowBarIcon
  346. {
  347. get
  348. {
  349. return showBarIcon;
  350. }
  351. set
  352. {
  353. showBarIcon = value;
  354. OnPropertyChanged("ShowBarIcon");
  355. }
  356. }
  357. public bool MouseMiddleShow
  358. {
  359. get
  360. {
  361. return mouseMiddleShow;
  362. }
  363. set
  364. {
  365. mouseMiddleShow = value;
  366. OnPropertyChanged("MouseMiddleShow");
  367. }
  368. }
  369. public int ImageWidth
  370. {
  371. get
  372. {
  373. // 为了兼容旧版 暂时使用默认
  374. if (imageWidth == 0)
  375. {
  376. return (int)CommonEnum.IMAGE_WIDTH;
  377. }
  378. else
  379. {
  380. return imageWidth;
  381. }
  382. }
  383. set
  384. {
  385. imageWidth = value;
  386. //同时设置高度
  387. ImageHeight = value;
  388. //计算 容器宽度因子
  389. double i = ((double)imageWidth - (double)CommonEnum.IMAGE_WIDTH) / 5d;
  390. double s = 2.44;
  391. i *= 2d;
  392. while (i > 1)
  393. {
  394. i /= 10d;
  395. }
  396. if (i > 0d)
  397. {
  398. s -= i;
  399. }
  400. if (s < 2.2)
  401. {
  402. s = 2.2;
  403. }
  404. //设置容器宽度
  405. ImgPanelWidth = (int)(ImageWidth * s);
  406. OnPropertyChanged("ImageWidth");
  407. }
  408. }
  409. public int ImageHeight
  410. {
  411. get
  412. {
  413. //都使用宽度来确定大小
  414. // 为了兼容旧版 暂时使用默认
  415. if (imageHeight == 0)
  416. {
  417. return (int)CommonEnum.IMAGE_HEIGHT;
  418. }
  419. else
  420. {
  421. return imageHeight;
  422. }
  423. }
  424. set
  425. {
  426. imageHeight = value;
  427. //计算容器高度因子
  428. double i = ((double)imageHeight - (double)CommonEnum.IMAGE_HEIGHT) / 5d;
  429. while (i > 1)
  430. {
  431. i /= 10d;
  432. }
  433. double s = 2.00;
  434. if (i > 0d)
  435. {
  436. s -= i;
  437. }
  438. if (s < 1.5) s = 1.5;
  439. //设置容器高度
  440. ImgPanelHeight = ImageHeight * s;
  441. OnPropertyChanged("ImageHeight");
  442. }
  443. }
  444. public bool AppAnimation
  445. {
  446. get
  447. {
  448. return appAnimation;
  449. }
  450. set
  451. {
  452. appAnimation = value;
  453. OnPropertyChanged("AppAnimation");
  454. }
  455. }
  456. public bool MarginHide
  457. {
  458. get
  459. {
  460. return marginHide;
  461. }
  462. set
  463. {
  464. marginHide = value;
  465. OnPropertyChanged("MarginHide");
  466. }
  467. }
  468. public double ImgPanelWidth
  469. {
  470. get
  471. {
  472. if (imgPanelWidth == 0d) return (double)CommonEnum.IMAGE_PANEL_WIDTH;
  473. return imgPanelWidth;
  474. }
  475. set
  476. {
  477. imgPanelWidth = value;
  478. OnPropertyChanged("ImgPanelWidth");
  479. }
  480. }
  481. public double ImgPanelHeight
  482. {
  483. get
  484. {
  485. if (imgPanelHeight == 0d) return (double)CommonEnum.IMAGE_PANEL_HEIGHT;
  486. return imgPanelHeight;
  487. }
  488. set
  489. {
  490. imgPanelHeight = value;
  491. OnPropertyChanged("ImgPanelHeight");
  492. }
  493. }
  494. public string TextColor
  495. {
  496. get
  497. {
  498. if (textColor == null) return "#000000";
  499. return textColor;
  500. }
  501. set
  502. {
  503. textColor = value;
  504. OnPropertyChanged("TextColor");
  505. }
  506. }
  507. public bool PMModel
  508. {
  509. get
  510. {
  511. return pmModel;
  512. }
  513. set
  514. {
  515. pmModel = value;
  516. OnPropertyChanged("PMModel");
  517. }
  518. }
  519. public bool SelfStartUped
  520. {
  521. get
  522. {
  523. return selfStartUped;
  524. }
  525. set
  526. {
  527. selfStartUped = value;
  528. OnPropertyChanged("SelfStartUped");
  529. }
  530. }
  531. public bool SelfStartUp
  532. {
  533. get
  534. {
  535. return selfStartUp;
  536. }
  537. set
  538. {
  539. selfStartUp = value;
  540. selfStartUped = true;
  541. OnPropertyChanged("SelfStartUp");
  542. }
  543. }
  544. public Key ColorPickerHotkey
  545. {
  546. get
  547. {
  548. return colorPickerHotkey;
  549. }
  550. set
  551. {
  552. colorPickerHotkey = value;
  553. OnPropertyChanged("ColorPickerHotkey");
  554. }
  555. }
  556. public HotkeyModifiers ColorPickerHotkeyModifiers
  557. {
  558. get
  559. {
  560. return colorPickerHotkeyModifiers;
  561. }
  562. set
  563. {
  564. colorPickerHotkeyModifiers = value;
  565. OnPropertyChanged("ColorPickerHotkeyModifiers");
  566. }
  567. }
  568. public string ColorPickerHotkeyStr
  569. {
  570. get
  571. {
  572. return colorPickerHotkeyStr;
  573. }
  574. set
  575. {
  576. colorPickerHotkeyStr = value;
  577. OnPropertyChanged("ColorPickerHotkeyStr");
  578. }
  579. }
  580. public Key ToDoHotkey
  581. {
  582. get
  583. {
  584. //兼容老版本
  585. if (toDoHotkey == Key.None)
  586. {
  587. toDoHotkey = Key.E;
  588. }
  589. return toDoHotkey;
  590. }
  591. set
  592. {
  593. toDoHotkey = value;
  594. OnPropertyChanged("ToDoHotkey");
  595. }
  596. }
  597. public HotkeyModifiers ToDoHotkeyModifiers
  598. {
  599. get
  600. {
  601. if (toDoHotkeyModifiers == 0)
  602. {
  603. toDoHotkeyModifiers = HotkeyModifiers.MOD_CONTROL | HotkeyModifiers.MOD_SHIFT;
  604. }
  605. return toDoHotkeyModifiers;
  606. }
  607. set
  608. {
  609. toDoHotkeyModifiers = value;
  610. OnPropertyChanged("ToDoHotkeyModifiers");
  611. }
  612. }
  613. public string ToDoHotkeyStr
  614. {
  615. get
  616. {
  617. //兼容老版本
  618. if (toDoHotkeyStr == null)
  619. {
  620. toDoHotkeyStr = "Ctrl + Shift + Q";
  621. }
  622. return toDoHotkeyStr;
  623. }
  624. set
  625. {
  626. toDoHotkeyStr = value;
  627. OnPropertyChanged("ToDoHotkeyStr");
  628. }
  629. }
  630. public UpdateType UpdateType
  631. {
  632. get
  633. {
  634. return updateType;
  635. }
  636. set
  637. {
  638. updateType = value;
  639. OnPropertyChanged("UpdateType");
  640. }
  641. }
  642. public double BlurValue
  643. {
  644. get
  645. {
  646. if (blurEffect)
  647. {
  648. BlurValue = 100;
  649. }
  650. else
  651. {
  652. BlurValue = 0;
  653. }
  654. return blurValue;
  655. }
  656. set
  657. {
  658. blurValue = value;
  659. OnPropertyChanged("BlurValue");
  660. }
  661. }
  662. public bool BlurEffect
  663. {
  664. get
  665. {
  666. return blurEffect;
  667. }
  668. set
  669. {
  670. blurEffect = value;
  671. if (blurEffect)
  672. {
  673. BlurValue = 100;
  674. }
  675. else
  676. {
  677. BlurValue = 0;
  678. }
  679. OnPropertyChanged("BlurEffect");
  680. }
  681. }
  682. public string CustomIconUrl
  683. {
  684. get
  685. {
  686. return customIconUrl;
  687. }
  688. set
  689. {
  690. customIconUrl = value;
  691. OnPropertyChanged("CustomIconUrl");
  692. }
  693. }
  694. public string CustomIconJsonUrl
  695. {
  696. get
  697. {
  698. return customIconJsonUrl;
  699. }
  700. set
  701. {
  702. customIconJsonUrl = value;
  703. OnPropertyChanged("CustomIconJsonUrl");
  704. }
  705. }
  706. public Key Hotkey
  707. {
  708. get
  709. {
  710. return hotkey;
  711. }
  712. set
  713. {
  714. hotkey = value;
  715. OnPropertyChanged("Hotkey");
  716. }
  717. }
  718. public string HotkeyStr
  719. {
  720. get
  721. {
  722. return hotkeyStr;
  723. }
  724. set
  725. {
  726. hotkeyStr = value;
  727. OnPropertyChanged("HotkeyStr");
  728. }
  729. }
  730. public HotkeyModifiers HotkeyModifiers
  731. {
  732. get
  733. {
  734. if (hotkeyModifiers == 0)
  735. {
  736. hotkeyModifiers = HotkeyModifiers.MOD_CONTROL;
  737. }
  738. return hotkeyModifiers;
  739. }
  740. set
  741. {
  742. hotkeyModifiers = value;
  743. OnPropertyChanged("HotkeyModifiers");
  744. }
  745. }
  746. public ObservableCollection<IconInfo> SelectedMenuIcons
  747. {
  748. get
  749. {
  750. return selectedMenuIcons;
  751. }
  752. set
  753. {
  754. selectedMenuIcons = value;
  755. OnPropertyChanged("SelectedMenuIcons");
  756. }
  757. }
  758. public int PannelCornerRadius
  759. {
  760. get
  761. {
  762. return pannelCornerRadius;
  763. }
  764. set
  765. {
  766. pannelCornerRadius = value;
  767. OnPropertyChanged("pannelCornerRadius");
  768. }
  769. }
  770. public int PannelOpacity
  771. {
  772. get
  773. {
  774. return pannelOpacity;
  775. }
  776. set
  777. {
  778. pannelOpacity = value;
  779. OnPropertyChanged("PannelOpacity");
  780. }
  781. }
  782. public int BgOpacity
  783. {
  784. get
  785. {
  786. return bgOpacity;
  787. }
  788. set
  789. {
  790. bgOpacity = value;
  791. OnPropertyChanged("BgOpacity");
  792. }
  793. }
  794. public int CardOpacity
  795. {
  796. get
  797. {
  798. return cardOpacity;
  799. }
  800. set
  801. {
  802. cardOpacity = value;
  803. OnPropertyChanged("CardOpacity");
  804. }
  805. }
  806. public string BacImgName
  807. {
  808. get
  809. {
  810. return bacImgName;
  811. }
  812. set
  813. {
  814. bacImgName = value;
  815. OnPropertyChanged("BacImgName");
  816. }
  817. }
  818. public byte[] ImageByteArr
  819. {
  820. get
  821. {
  822. return imageByteArr;
  823. }
  824. set
  825. {
  826. imageByteArr = value;
  827. OnPropertyChanged("ImageByteArr");
  828. }
  829. }
  830. public BitmapImage BitmapImage
  831. {
  832. get
  833. {
  834. if (imageByteArr == null || imageByteArr.Length == 0)
  835. {
  836. bacImgName = "系统默认";
  837. //Image image = ImageUtil.ByteArrayToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
  838. return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
  839. }
  840. else
  841. {
  842. return ImageUtil.ByteArrToImage(ImageByteArr);
  843. }
  844. }
  845. set
  846. {
  847. bitmapImage = value;
  848. imageByteArr = ImageUtil.BitmapImageToByte(bitmapImage);
  849. OnPropertyChanged("BitmapImage");
  850. }
  851. }
  852. public bool StartedShowPanel
  853. {
  854. get
  855. {
  856. return startedShowPanel;
  857. }
  858. set
  859. {
  860. startedShowPanel = value;
  861. OnPropertyChanged("StartedShowPanel");
  862. }
  863. }
  864. public AppHideType AppHideType
  865. {
  866. get
  867. {
  868. return appHideType;
  869. }
  870. set
  871. {
  872. appHideType = value;
  873. OnPropertyChanged("AppHideType");
  874. }
  875. }
  876. public Visibility ConfigIconVisible
  877. {
  878. get
  879. {
  880. return configIconVisible;
  881. }
  882. set
  883. {
  884. configIconVisible = value;
  885. OnPropertyChanged("ConfigIconVisible");
  886. }
  887. }
  888. public bool FollowMouse
  889. {
  890. get
  891. {
  892. return followMouse;
  893. }
  894. set
  895. {
  896. followMouse = value;
  897. OnPropertyChanged("FollowMouse");
  898. }
  899. }
  900. public int SelectedMenuIndex
  901. {
  902. get
  903. {
  904. return selectedMenuIndex;
  905. }
  906. set
  907. {
  908. selectedMenuIndex = value;
  909. OnPropertyChanged("SelectedMenuIndex");
  910. }
  911. }
  912. public SortType MenuSortType
  913. {
  914. get
  915. {
  916. return menuSortType;
  917. }
  918. set
  919. {
  920. menuSortType = value;
  921. OnPropertyChanged("MenuSortType");
  922. }
  923. }
  924. public SortType IconSortType
  925. {
  926. get
  927. {
  928. return iconSortType;
  929. }
  930. set
  931. {
  932. iconSortType = value;
  933. OnPropertyChanged("IconSortType");
  934. }
  935. }
  936. public double WindowWidth
  937. {
  938. get
  939. {
  940. return windowWidth;
  941. }
  942. set
  943. {
  944. windowWidth = value;
  945. OnPropertyChanged("WindowWidth");
  946. }
  947. }
  948. public double WindowHeight
  949. {
  950. get
  951. {
  952. return windowHeight;
  953. }
  954. set
  955. {
  956. windowHeight = value;
  957. OnPropertyChanged("WindowHeight");
  958. }
  959. }
  960. public double MenuCardWidth
  961. {
  962. get
  963. {
  964. return menuCardWidth;
  965. }
  966. set
  967. {
  968. menuCardWidth = value;
  969. OnPropertyChanged("MenuCardWidth");
  970. }
  971. }
  972. [field: NonSerializedAttribute()]
  973. public event PropertyChangedEventHandler PropertyChanged;
  974. private void OnPropertyChanged(string propertyName)
  975. {
  976. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  977. if (propertyName != null && !propertyName.Contains("NoWrite"))
  978. {
  979. CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
  980. }
  981. }
  982. #endregion
  983. public override String ToString()
  984. {
  985. return JsonConvert.SerializeObject(this);
  986. }
  987. }
  988. }