123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445 |
- using PDF_Master.Helper;
- using PDF_Master.Model;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Regions;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- namespace PDF_Master.ViewModels.Dialog.ServiceDialog
- {
- public class PasswordUpdataRegionViewModel : BindableBase, INavigationAware
- {
- private string uuid = ServiceHelper.GetDeviceSerialNumber();
- private ErrorCodeHelper ErrorCodeHelper = new ErrorCodeHelper();
- private LoginDialogViewModel LoginDialogViewModel;
- public IDialogService dialogs;
- public bool IsNavigationTarget(NavigationContext navigationContext)
- {
- return true;
- }
- public void OnNavigatedFrom(NavigationContext navigationContext)
- {
- }
- public void OnNavigatedTo(NavigationContext navigationContext)
- {
- navigationContext.Parameters.TryGetValue<LoginDialogViewModel>("LoginDialogViewModel", out LoginDialogViewModel);
- LoginEmail = LoginDialogViewModel.LoginEmail;
- }
- #region 文案
- private string _Text_passuodata = "";
- public string Text_passuodata
- {
- get { return _Text_passuodata; }
- set
- {
- SetProperty(ref _Text_passuodata, value);
- }
- }
- private string _LoginPasswordMsg = "";
- public string LoginPasswordMsg
- {
- get { return _LoginPasswordMsg; }
- set
- {
- SetProperty(ref _LoginPasswordMsg, value);
- }
- }
-
- private string _LoginPasswordMsg2 = "";
- public string LoginPasswordMsg2
- {
- get { return _LoginPasswordMsg2; }
- set
- {
- SetProperty(ref _LoginPasswordMsg2, value);
- }
- }
- private string _Text_ok = "";
- public string Text_ok
- {
- get { return _Text_ok; }
- set
- {
- SetProperty(ref _Text_ok, value);
- }
- }
- private void InitString()
- {
- Codemax = App.ServiceLoader.GetString("Codemax");
- Codemin = App.ServiceLoader.GetString("Codemin");
- Containspaces = App.ServiceLoader.GetString("code327");
- Text_passuodata = App.ServiceLoader.GetString("Text_toocode");
- LoginPasswordMsg = App.ServiceLoader.GetString("LoginPasswordMsg");
- LoginPasswordMsg2 = App.ServiceLoader.GetString("LoginPasswordMsg2");
- Text_ok = App.ServiceLoader.GetString("Text_ok");
- }
- #endregion
- private bool enableNextStep = false;
- public bool EnableNextStep
- {
- get { return enableNextStep; }
- set { SetProperty(ref enableNextStep, value); }
- }
- private string _LoginEmail = "";
- public string LoginEmail
- {
- get { return _LoginEmail; }
- set
- {
- SetProperty(ref _LoginEmail, value);
- CheckEnableNextStepEncrypt();
- }
- }
- private string _LoginPasswordlook;
- public string LoginPasswordlook
- {
- get { return _LoginPasswordlook; }
- set { SetProperty(ref _LoginPasswordlook, value); }
- }
- private string _LoginPasswordlook2;
- public string LoginPasswordlook2
- {
- get { return _LoginPasswordlook2; }
- set { SetProperty(ref _LoginPasswordlook2, value); }
- }
- private string _LoginPassword = "";
- public string LoginPassword
- {
- get { return _LoginPassword; }
- set
- {
- SetProperty(ref _LoginPassword, value);
- if (string.IsNullOrEmpty(LoginPassword))
- {
- ChkVis = Visibility.Collapsed;
- }
- else
- {
- ChkVis = Visibility.Visible;
- }
- CheckEnableNextStepEncrypt();
- }
- }
- private string _LoginPassword2 = "";
- public string LoginPassword2
- {
- get { return _LoginPassword2; }
- set
- {
- SetProperty(ref _LoginPassword2, value);
- if (string.IsNullOrEmpty(LoginPassword2))
- {
- ChkVis2 = Visibility.Collapsed;
- }
- else
- {
- ChkVis2 = Visibility.Visible;
- }
- CheckEnableNextStepEncrypt();
- }
- }
- private Visibility _ChkVis = Visibility.Collapsed;
- public Visibility ChkVis
- {
- get { return _ChkVis; }
- set { SetProperty(ref _ChkVis, value); }
- }
- private Visibility _ChkVis2 = Visibility.Collapsed;
- public Visibility ChkVis2
- {
- get { return _ChkVis2; }
- set { SetProperty(ref _ChkVis2, value); }
- }
- private Visibility _LoginPasswordVisibility = Visibility.Visible;
- public Visibility LoginPasswordVisibility
- {
- get { return _LoginPasswordVisibility; }
- set
- {
- if (value == Visibility.Visible)
- {
- LoginTextVisibility = Visibility.Collapsed;
- }
- else
- {
- LoginTextVisibility = Visibility.Visible;
- }
- SetProperty(ref _LoginPasswordVisibility, value);
- }
- }
- private Visibility _LoginTextVisibility = Visibility.Collapsed;
- public Visibility LoginTextVisibility
- {
- get { return _LoginTextVisibility; }
- set { SetProperty(ref _LoginTextVisibility, value); }
- }
-
-
- private Visibility _LoginPasswordVisibility2 = Visibility.Visible;
- public Visibility LoginPasswordVisibility2
- {
- get { return _LoginPasswordVisibility2; }
- set
- {
- if (value == Visibility.Visible)
- {
- LoginTextVisibility2 = Visibility.Collapsed;
- }
- else
- {
- LoginTextVisibility2 = Visibility.Visible;
- }
- SetProperty(ref _LoginPasswordVisibility2, value);
- }
- }
- private Visibility _LoginTextVisibility2 = Visibility.Collapsed;
- public Visibility LoginTextVisibility2
- {
- get { return _LoginTextVisibility2; }
- set { SetProperty(ref _LoginTextVisibility2, value); }
- }
- private string _PasswordUpdatamsglook = "";
- public string PasswordUpdatamsglook
- {
- get { return _PasswordUpdatamsglook; }
- set
- {
- SetProperty(ref _PasswordUpdatamsglook, value);
- }
- }
- private string _Containspaces = "";
- public string Containspaces
- {
- get { return _Containspaces; }
- set
- {
- SetProperty(ref _Containspaces, value);
- }
- }
- private string _Codemax = "";
- public string Codemax
- {
- get { return _Codemax; }
- set
- {
- SetProperty(ref _Codemax, value);
- }
- }
- private string _Codemin = "";
- public string Codemin
- {
- get { return _Codemin; }
- set
- {
- SetProperty(ref _Codemin, value);
- }
- }
- private Visibility _PasswordUpdatalookVis = Visibility.Collapsed;
- public Visibility PasswordUpdatalookVis
- {
- get { return _PasswordUpdatalookVis; }
- set { SetProperty(ref _PasswordUpdatalookVis, value); }
- }
- public DelegateCommand<object> DisplayPasswordCommand { get; set; }
- public DelegateCommand<object> DisplayPasswordCommand2 { get; set; }
- public DelegateCommand ChangeEmailCommand { get; set; }
- public DelegateCommand GoCodeUpdataCommand { get; set; }
- public DelegateCommand PasswordUpdataCommand { get; set; }
- public DelegateCommand LinkLicenseCommand { get; set; }
- public DelegateCommand LoginPasswordChangedCommand { get; set; }
- public DelegateCommand LoginPasswordChanged2Command { get; set; }
- PasswordUpdataRegionViewModel(IRegionManager regionManager, IDialogService dialogService)
- {
- dialogs = dialogService;
- InitString();
- DisplayPasswordCommand = new DelegateCommand<object>(DisplayPassword);
- DisplayPasswordCommand2 = new DelegateCommand<object>(DisplayPassword2);
- PasswordUpdataCommand = new DelegateCommand(PasswordUpdata);
- LoginPasswordChangedCommand = new DelegateCommand(LoginPasswordChanged);
- LoginPasswordChanged2Command = new DelegateCommand(LoginPasswordChanged2);
- }
- private void LoginPasswordChanged()
- {
- if (LoginPassword.Length < 6 && LoginPassword.Length > 0)
- {
- LoginPasswordlook = Codemin;
- }
- else if (LoginPassword.Length > 24)
- {
- LoginPasswordlook = Codemax;
- }
- else if (LoginPassword.Contains(" ") == true)
- {
- LoginPasswordlook = Containspaces;
- }
- else if (LoginPassword != LoginPassword2 && LoginPassword != "" && LoginPassword2 != "")
- {
- LoginPasswordlook = ErrorCodeHelper.Ercode("320");
- }
- else
- {
- LoginPasswordlook = "";
- LoginPasswordlook2 = "";
- }
- }
- private void LoginPasswordChanged2()
- {
- if (LoginPassword2.Length < 6 && LoginPassword2.Length > 0)
- {
- LoginPasswordlook2 = Codemin;
- }
- else if (LoginPassword2.Length > 24)
- {
- LoginPasswordlook2 =Codemax;
- }
- else if (LoginPassword2.Contains(" ") == true)
- {
- LoginPasswordlook2 = Containspaces;
- }
- else if (LoginPassword != LoginPassword2 && LoginPassword != "" && LoginPassword2 != "")
- {
- LoginPasswordlook = ErrorCodeHelper.Ercode("320");
- LoginPasswordlook2 = "";
- }
- else
- {
- LoginPasswordlook = "";
- LoginPasswordlook2 = "";
- }
- }
- private void PasswordUpdata()
- {
- string code = ServiceHelper.Rebirth(LoginEmail, LoginPassword2, LoginPassword, LoginDialogViewModel.PasswordCode);
- if (code == "200")
- {
- LoginDialogViewModel.RegionMan("LoginRegion");
- }
- else
- {
- PasswordUpdatamsglook = ErrorCodeHelper.Ercode(code);
- PasswordUpdatalookVis = Visibility.Visible;
- }
- }
- private void CheckEnableNextStepEncrypt()
- {
- EnableNextStep = true;
- if (LoginPassword.Length < 6 || LoginPassword.Length > 24|| (LoginPassword!= LoginPassword2) || LoginPassword.Contains(" ") == true)
- {
- EnableNextStep = false;
- }
-
- }
- public void DisplayPassword(object e)
- {
- var chk = e as CheckBox;
- if (chk != null)
- {
- if (chk.IsChecked == true)
- {
- LoginPasswordVisibility = Visibility.Collapsed;
- }
- else
- {
- LoginPasswordVisibility = Visibility.Visible;
- }
- }
- }
- public void DisplayPassword2(object e)
- {
- var chk = e as CheckBox;
- if (chk != null)
- {
- if (chk.IsChecked == true)
- {
- LoginPasswordVisibility2 = Visibility.Collapsed;
- }
- else
- {
- LoginPasswordVisibility2 = Visibility.Visible;
- }
- }
- }
- }
- }
|