123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- using PDF_Master.DataConvert;
- using PDF_Master.Helper;
- using PDF_Master.Properties;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Regions;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- 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<IDialogResult> RequestClose;
- #region 文案
- #endregion
- /// <summary>
- /// 价格优惠bord
- /// </summary>
- private Visibility _Vishalfprice = Visibility.Visible;
- public Visibility Vishalfprice
- {
- get { return _Vishalfprice; }
- set
- {
- SetProperty(ref _Vishalfprice, value);
- }
- }
-
- /// <summary>
- /// 价格优惠
- /// </summary>
- private string _Textprice = "$39.99";
- public string Textprice
- {
- get { return _Textprice; }
- set
- {
- SetProperty(ref _Textprice, value);
- }
- }
- private string _Text_Signup = "";
- public string Text_Signup
- {
- get { return _Text_Signup; }
- set
- {
- SetProperty(ref _Text_Signup, value);
- }
- }
- private string _uristore = "https://www.pdfreaderpro.com/windows/store/permanent";
- public string Uristore
- {
- get { return _uristore; }
- set
- {
- SetProperty(ref _uristore, value);
- }
- }
- public DelegateCommand LinkstoreCommand { get; set; }
-
- private void InitString()
- {
- }
- public bool CanCloseDialog()
- {
- return true;
- }
- public void OnDialogClosed()
- {
-
- }
- public void OnDialogOpened(IDialogParameters parameters)
- {
-
- }
- public DelegateCommand GoLoginCommand { get; set; }
- public DelegateCommand RefreshCommand { get; set; }
- public IAPCompareDialogViewModel(IRegionManager regionManager, IDialogService dialogService)
- {
- GoLoginCommand = new DelegateCommand(GoLogin);
- LinkstoreCommand = new DelegateCommand(Linkstore);
- RefreshCommand = new DelegateCommand(Refresh);
- InitString();
-
- if (Settings.Default.UserDate.subscribestatus == 2 )
- {
- Textprice = "$79.99";
- Vishalfprice = Visibility.Collapsed;
- }
-
- else
- {
- Textprice = "$39.99";
- Vishalfprice = Visibility.Visible;
- }
- }
- private void GoLogin()
- {
- Close();
- App.mainWindowViewModel.OpenLogin();
- }
- public void Close()
- {
- RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
- }
- private void Linkstore()
- {
- Process.Start(new ProcessStartInfo(Uristore));
- }
- /// <summary>
- /// 刷新订阅状态按钮
- /// </summary>
- private void Refresh()
- {
- if (Settings.Default.AppProperties.LoginToken != "")
- {
- string code = ServiceHelper.GetUser();
- if (code == "330" || code == "304")
- {
- App.mainWindowViewModel.UserVis = Visibility.Collapsed;
- App.mainWindowViewModel.LoginVis = Visibility.Visible;
- App.mainWindowViewModel.OphVis = Visibility.Visible;
- if (Settings.Default.UserDate.IsLoginoff == false)
- {
- App.mainWindowViewModel.OpenLoginoff();
- Settings.Default.UserDate.IsLoginoff = true;
- Settings.Default.Save();
- }
- }
- }
- else
- {
- App.mainWindowViewModel.UserVis = Visibility.Collapsed;
- App.mainWindowViewModel.LoginVis = Visibility.Visible;
- App.mainWindowViewModel.OphVis = Visibility.Visible;
- }
- if (Settings.Default.UserDate.subscribestatus == 1&&App.IsLogin==true)
- {
- Close();
- }
- }
- }
- }
|