123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- using PDF_Office.Helper;
- using PDF_Office.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_Office.ViewModels.Dialog.ServiceDialog
- {
- public class PasswordUpdataRegionViewModel : BindableBase, INavigationAware
- {
- private static Guid myuuid = Guid.NewGuid();
- private string uuid = myuuid.ToString();
- 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;
- }
- 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 _LoginPassword = "";
- public string LoginPassword
- {
- get { return _LoginPassword; }
- set
- {
- SetProperty(ref _LoginPassword, value);
- CheckEnableNextStepEncrypt();
- }
- }
- private string _LoginPasswordMsg = "Enter the new password again";
- public string LoginPasswordMsg
- {
- get { return _LoginPasswordMsg; }
- set
- {
- SetProperty(ref _LoginPasswordMsg, 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 string _LoginPassword2 = "";
- public string LoginPassword2
- {
- get { return _LoginPassword2; }
- set
- {
- SetProperty(ref _LoginPassword2, value);
- CheckEnableNextStepEncrypt();
- }
- }
- private string _LoginPasswordMsg2 = "Enter your password";
- public string LoginPasswordMsg2
- {
- get { return _LoginPasswordMsg2; }
- set
- {
- SetProperty(ref _LoginPasswordMsg2, 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 Visibility _PasswordUpdatalookVis = Visibility.Collapsed;
- public Visibility PasswordUpdatalookVis
- {
- get { return _PasswordUpdatalookVis; }
- set { SetProperty(ref _PasswordUpdatalookVis, value); }
- }
- public DelegateCommand<object> DisplayPasswordCommand { get; set; }
- public DelegateCommand ChangeEmailCommand { get; set; }
- public DelegateCommand GoCodeUpdataCommand { get; set; }
- public DelegateCommand PasswordUpdataCommand { get; set; }
- public DelegateCommand LinkLicenseCommand { get; set; }
- PasswordUpdataRegionViewModel(IRegionManager regionManager, IDialogService dialogService)
- {
- dialogs = dialogService;
- DisplayPasswordCommand = new DelegateCommand<object>(DisplayPassword);
- DisplayPasswordCommand = new DelegateCommand<object>(DisplayPassword2);
- PasswordUpdataCommand = new DelegateCommand(PasswordUpdata);
- }
- private void PasswordUpdata()
- {
-
-
- if (ServiceHelper.Rebirth(LoginEmail, LoginPassword2, LoginPassword, LoginDialogViewModel.PasswordCode) == "success")
- {
- LoginDialogViewModel.RegionMan("LoginRegion");
- }
- else
- {
- PasswordUpdatamsglook = ServiceHelper.Rebirth(LoginEmail, LoginPassword2, LoginPassword, LoginDialogViewModel.PasswordCode);
- PasswordUpdatalookVis = Visibility.Visible;
- }
- }
- private void CheckEnableNextStepEncrypt()
- {
- EnableNextStep = true;
- if (string.IsNullOrEmpty(LoginPassword)|| string.IsNullOrEmpty(LoginPassword2))
- {
- 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;
- }
- }
- }
- }
- }
|