using Prism.Commands; using Prism.Mvvm; using Prism.Regions; using Prism.Services.Dialogs; using System; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using System.Windows.Data; namespace PDF_Master.ViewModels.Dialog.ServiceDialog { public class IAPCompareDialogViewModel : BindableBase,IDialogAware { public string Title => ""; public event Action RequestClose; #region 文案 private string _Text_Signup = ""; public string Text_Signup { get { return _Text_Signup; } set { SetProperty(ref _Text_Signup, value); } } private string _Text_Login = ""; public string Text_Login { get { return _Text_Login; } set { SetProperty(ref _Text_Login, value); } } private void InitString() { Text_Signup = App.ServiceLoader.GetString("Text_Signup"); Text_Login = App.ServiceLoader.GetString("Text_Login"); } #endregion private string _IAPRegionName; public string IAPRegionName { get { return _IAPRegionName; } set { _IAPRegionName = value; } } private List _Items= new List(); public List Items { get { return _Items; } set { _Items = value; } } public bool CanCloseDialog() { return true; } public void OnDialogClosed() { } public void OnDialogOpened(IDialogParameters parameters) { } public enum UseType { CreatePDF, ConvertPDF , AdvancedEditTools, AnnotatePDF, Security}; public class User { public string Use { get; set; } public bool Re { get; set; } public bool UnRe { get; set; } public UseType UseType { get; set; } } public DelegateCommand GoLoginCommand { get; set; } public DelegateCommand GoRegisterCommand { get; set; } public IAPCompareDialogViewModel(IRegionManager regionManager, IDialogService dialogService) { IAPRegionName = Guid.NewGuid().ToString(); GoLoginCommand = new DelegateCommand(GoLogin); GoRegisterCommand = new DelegateCommand(GoRegisterd); InitString(); Items.Add(new User() { Use = "Create PDF from Microsoft Word, PowerPoint, Excel, Text, and image", UnRe = true, Re=true, UseType = UseType.CreatePDF }); Items.Add(new User() { Use = "Create PDF from scanner", UnRe = true, Re = true, UseType = UseType.CreatePDF }); Items.Add(new User() { Use = "Convert PDF to Microsoft Word, Excel, PPT, Text, and image", UnRe = false, Re = true, UseType = UseType.ConvertPDF }); Items.Add(new User() { Use = "Turn PDF to RTF, HTML, CSV", UnRe = false, Re = true, UseType = UseType.ConvertPDF }); Items.Add(new User() { Use = "Save as flatten PDF", UnRe = false, Re = true, UseType = UseType.ConvertPDF }); Items.Add(new User() { Use = "Merge multiple PDFs", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools }); Items.Add(new User() { Use = "Fill & sign forms", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools }); Items.Add(new User() { Use = "Crop pages", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools }); Items.Add(new User() { Use = "Rotate, delete, paste, copy pages", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools }); Items.Add(new User() { Use = "Basic markup tools", UnRe = true, Re = true, UseType = UseType.AnnotatePDF }); Items.Add(new User() { Use = "Hyperlink", UnRe = false, Re = true, UseType = UseType.AnnotatePDF }); Items.Add(new User() { Use = "Stamp", UnRe = false, Re = true, UseType = UseType.AnnotatePDF }); Items.Add(new User() { Use = "Signature", UnRe = false, Re = true, UseType = UseType.AnnotatePDF }); Items.Add(new User() { Use = "Add password and permission", UnRe = false, Re = true, UseType = UseType.Security }); Items.Add(new User() { Use = "Remove password", UnRe = false, Re = true, UseType = UseType.Security }); CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(Items); PropertyGroupDescription groupDescription = new PropertyGroupDescription("UseType"); view.GroupDescriptions.Add(groupDescription); } private void GoRegisterd() { RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel)); App.mainWindowViewModel.OpenRegister(); } private void GoLogin() { RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel)); App.mainWindowViewModel.OpenLogin(); } } }