IAPCompareDialogViewModel.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using Prism.Commands;
  2. using Prism.Mvvm;
  3. using Prism.Regions;
  4. using Prism.Services.Dialogs;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. namespace PDF_Master.ViewModels.Dialog.ServiceDialog
  11. {
  12. public class IAPCompareDialogViewModel : BindableBase,IDialogAware
  13. {
  14. public string Title => "";
  15. public event Action<IDialogResult> RequestClose;
  16. #region 文案
  17. private string _Text_Signup = "";
  18. public string Text_Signup
  19. {
  20. get { return _Text_Signup; }
  21. set
  22. {
  23. SetProperty(ref _Text_Signup, value);
  24. }
  25. }
  26. private string _Text_Login = "";
  27. public string Text_Login
  28. {
  29. get { return _Text_Login; }
  30. set
  31. {
  32. SetProperty(ref _Text_Login, value);
  33. }
  34. }
  35. private void InitString()
  36. {
  37. Text_Signup = App.ServiceLoader.GetString("Text_Signup");
  38. Text_Login = App.ServiceLoader.GetString("Text_Login");
  39. }
  40. #endregion
  41. private string _IAPRegionName;
  42. public string IAPRegionName
  43. {
  44. get { return _IAPRegionName; }
  45. set { _IAPRegionName = value; }
  46. }
  47. private List<User> _Items= new List<User>();
  48. public List<User> Items
  49. {
  50. get { return _Items; }
  51. set { _Items = value; }
  52. }
  53. public bool CanCloseDialog()
  54. {
  55. return true;
  56. }
  57. public void OnDialogClosed()
  58. {
  59. }
  60. public void OnDialogOpened(IDialogParameters parameters)
  61. {
  62. }
  63. public enum UseType { CreatePDF, ConvertPDF , AdvancedEditTools, AnnotatePDF, Security};
  64. public class User
  65. {
  66. public string Use { get; set; }
  67. public bool Re { get; set; }
  68. public bool UnRe { get; set; }
  69. public UseType UseType { get; set; }
  70. }
  71. public DelegateCommand GoLoginCommand { get; set; }
  72. public DelegateCommand GoRegisterCommand { get; set; }
  73. public IAPCompareDialogViewModel(IRegionManager regionManager, IDialogService dialogService)
  74. {
  75. IAPRegionName = Guid.NewGuid().ToString();
  76. GoLoginCommand = new DelegateCommand(GoLogin);
  77. GoRegisterCommand = new DelegateCommand(GoRegisterd);
  78. InitString();
  79. Items.Add(new User() { Use = "Create PDF from Microsoft Word, PowerPoint, Excel, Text, and image", UnRe = true, Re=true, UseType = UseType.CreatePDF });
  80. Items.Add(new User() { Use = "Create PDF from scanner", UnRe = true, Re = true, UseType = UseType.CreatePDF });
  81. Items.Add(new User() { Use = "Convert PDF to Microsoft Word, Excel, PPT, Text, and image", UnRe = false, Re = true, UseType = UseType.ConvertPDF });
  82. Items.Add(new User() { Use = "Turn PDF to RTF, HTML, CSV", UnRe = false, Re = true, UseType = UseType.ConvertPDF });
  83. Items.Add(new User() { Use = "Save as flatten PDF", UnRe = false, Re = true, UseType = UseType.ConvertPDF });
  84. Items.Add(new User() { Use = "Merge multiple PDFs", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools });
  85. Items.Add(new User() { Use = "Fill & sign forms", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools });
  86. Items.Add(new User() { Use = "Crop pages", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools });
  87. Items.Add(new User() { Use = "Rotate, delete, paste, copy pages", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools });
  88. Items.Add(new User() { Use = "Basic markup tools", UnRe = true, Re = true, UseType = UseType.AnnotatePDF });
  89. Items.Add(new User() { Use = "Hyperlink", UnRe = false, Re = true, UseType = UseType.AnnotatePDF });
  90. Items.Add(new User() { Use = "Stamp", UnRe = false, Re = true, UseType = UseType.AnnotatePDF });
  91. Items.Add(new User() { Use = "Signature", UnRe = false, Re = true, UseType = UseType.AnnotatePDF });
  92. Items.Add(new User() { Use = "Add password and permission", UnRe = false, Re = true, UseType = UseType.Security });
  93. Items.Add(new User() { Use = "Remove password", UnRe = false, Re = true, UseType = UseType.Security });
  94. CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(Items);
  95. PropertyGroupDescription groupDescription = new PropertyGroupDescription("UseType");
  96. view.GroupDescriptions.Add(groupDescription);
  97. }
  98. private void GoRegisterd()
  99. {
  100. RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
  101. App.mainWindowViewModel.OpenRegister();
  102. }
  103. private void GoLogin()
  104. {
  105. RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
  106. App.mainWindowViewModel.OpenLogin();
  107. }
  108. }
  109. }