123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- using ComPDFKit.PDFWatermark;
- using ComPDFKitViewer.PdfViewer;
- using PDF_Master.Helper;
- using PDF_Master.Model;
- using PDF_Master.Model.EditTools.Watermark;
- using PDF_Master.Properties;
- using PDFReader_WPF.Helper;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Regions;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Media.Imaging;
- using System.Windows.Resources;
- namespace PDF_Master.ViewModels.Dialog.ServiceDialog
- {
- public class SubscriptionDialogViewModel : BindableBase, IDialogAware
- {
- public string Title => "";
- private ViewContentViewModel viewContentViewModel;
- private string open;
- public event Action<IDialogResult> RequestClose;
- #region 文案
- #endregion
- /// <summary>
- /// 价格优惠bord
- /// </summary>
- private Visibility _Vishalfprice = Visibility.Visible;
- public Visibility Vishalfprice
- {
- get { return _Vishalfprice; }
- set
- {
- SetProperty(ref _Vishalfprice, value);
- }
- }
- private double _RightBtnWidth = 394;
- public double RightBtnWidth
- {
- get { return _RightBtnWidth; }
- set
- {
- SetProperty(ref _RightBtnWidth, value);
- }
- }
- /// <summary>
- /// 左边按钮的vis
- /// </summary>
- private Visibility _LeftBtnVis = Visibility.Visible;
- public Visibility LeftBtnVis
- {
- get { return _LeftBtnVis; }
- set
- {
- SetProperty(ref _LeftBtnVis, value);
- }
- }
- /// <summary>
- /// 价格优惠
- /// </summary>
- private string _Textprice = "$39.99/year";
- public string Textprice
- {
- get { return _Textprice; }
- set
- {
- SetProperty(ref _Textprice, value);
- }
- }
- private string _TextSubscriptionBenefit;
- public string TextSubscriptionBenefit
- {
- get { return _TextSubscriptionBenefit; }
- set { SetProperty(ref _TextSubscriptionBenefit, value); }
- }
- private string _TextSavewithout;
- public string TextSavewithout
- {
- get { return _TextSavewithout; }
- set { SetProperty(ref _TextSavewithout, value); }
- }
- private string _TextWhenyou;
- public string TextWhenyou
- {
- get { return _TextWhenyou; }
- set { SetProperty(ref _TextWhenyou, value); }
- }
- private string _TextConvertPDF;
- public string TextConvertPDF
- {
- get { return _TextConvertPDF; }
- set { SetProperty(ref _TextConvertPDF, value); }
- }
- private string _TextConvertPDFto;
- public string TextConvertPDFto
- {
- get { return _TextConvertPDFto; }
- set { SetProperty(ref _TextConvertPDFto, value); }
- }
- private string _TextAIassitant;
- public string TextAIassitant
- {
- get { return _TextAIassitant; }
- set { SetProperty(ref _TextAIassitant, value); }
- }
- private string _TextSupportAI;
- public string TextSupportAI
- {
- get { return _TextSupportAI; }
- set { SetProperty(ref _TextSupportAI, value); }
- }
- private string _BtnTextSavewithWatermark;
- public string BtnTextSavewithWatermark
- {
- get { return _BtnTextSavewithWatermark; }
- set { SetProperty(ref _BtnTextSavewithWatermark, value); }
- }
- private string _Textoff;
- public string Textoff
- {
- get { return _Textoff; }
- set { SetProperty(ref _Textoff, value); }
- }
- private string _TextBatchProcessing;
- public string TextBatchProcessing
- {
- get { return _TextBatchProcessing; }
- set { _TextBatchProcessing = value; }
- }
- private string _TextBatch;
- public string TextBatch
- {
- get { return _TextBatch; }
- set { _TextBatch = value; }
- }
- private string _BtnTextSubscribe;
- public string BtnTextSubscribe
- {
- get { return _BtnTextSubscribe; }
- set { SetProperty(ref _BtnTextSubscribe, value); }
- }
- private string _uristore = ServiceHelper.WebHost + "/windows/store/master?email=" + Settings.Default.UserDate.Email;
- public string Uristore
- {
- get { return _uristore; }
- set
- {
- SetProperty(ref _uristore, value);
- }
- }
- public DelegateCommand LinkstoreCommand { get; set; }
- public DelegateCommand WarermarkSavingCommand { get; set; }
- public DelegateCommand RefreshCommand { get; set; }
- private void InitString()
- {
- TextSubscriptionBenefit = App.ServiceLoader.GetString("TextSubscriptionBenefit");
- TextSavewithout = App.ServiceLoader.GetString("TextSavewithout");
- TextWhenyou = App.ServiceLoader.GetString("TextWhenyou");
- TextConvertPDF = App.ServiceLoader.GetString("TextConvertPDFwithout");
- TextConvertPDFto = App.ServiceLoader.GetString("TextConvertPDFto");
- TextAIassitant = App.ServiceLoader.GetString("TextAIassitant");
- TextSupportAI = App.ServiceLoader.GetString("TextSupportAI");
- Textoff = App.ServiceLoader.GetString("Textoff");
- BtnTextSubscribe = App.ServiceLoader.GetString("BtnTextSubscribe");
- TextBatch = App.ServiceLoader.GetString("TextBatch");
- TextBatchProcessing = App.ServiceLoader.GetString("TextBatchProcessing");
- BtnTextSavewithWatermark = App.ServiceLoader.GetString("BtnTextSavewithWatermark");
- }
- public SubscriptionDialogViewModel(IRegionManager regionManager, IDialogService dialogService)
- {
- LinkstoreCommand = new DelegateCommand(Linkstore);
- WarermarkSavingCommand = new DelegateCommand(WarermarkSaving);
- InitString();
- if (Settings.Default.UserDate.subscribestatus == 2)
- {
- Textprice = "$79.99/year";
- Vishalfprice = Visibility.Collapsed;
- }
- else
- {
- Textprice = "$39.99/year";
- Vishalfprice = Visibility.Visible;
- }
- }
- private void Linkstore()
- {
- DataTrackingHelper.AddThirdPath();
- DataTrackingHelper.SendPurchaseEvent();
- DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.PUW, "Sub_PUW", "PUW_Sub_Subscribe");
- Process.Start(new ProcessStartInfo(Uristore));
- }
- /// <summary>
- /// 水印保存
- /// </summary>
- private void WarermarkSaving()
- {
- DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.PUW, "Sub_PUW", "PUW_Sub_SaveWatermark");
- String IsFormSave = "FormSave";
-
- if(open== "saveAs")
- {
- RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.OK));
- }
- else
- {
- if(viewContentViewModel != null&&viewContentViewModel.saveAsFile(null, IsFormSave)==false)
- {
- RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
- }
- else
- {
- RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.OK));
- }
- }
-
- }
- public void Close()
- {
- RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
- }
- public bool CanCloseDialog()
- {
- return true;
- }
- public void OnDialogClosed()
- {
- }
- public void OnDialogOpened(IDialogParameters parameters)
- {
- parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
- parameters.TryGetValue<String>(ParameterNames.Open, out open);
- //AI目前策略不会弹出权益弹窗
- //if (open == "AI")
- //{
- // LeftBtnVis = Visibility.Collapsed;
- // RightBtnWidth = 280;
- //}
- //
- //if (open == "Auto")
- //{
- // BtnTextSavewithWatermark = App.ServiceLoader.GetString("BtnTextContinue");
- //}
- //else
- //{
- // BtnTextSavewithWatermark = App.ServiceLoader.GetString("BtnTextSavewithWatermark");
- //}
- }
- }
- }
|