123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- 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.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- namespace PDF_Office.ViewModels.Dialog.ServiceDialog
- {
- public class LoginRegionViewModel : BindableBase, INavigationAware
- {
- 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);
- }
- private bool enableNextStep = false;
- public bool EnableNextStep
- {
- get { return enableNextStep; }
- set { SetProperty(ref enableNextStep, value); }
- }
- private string _LoginEmaillook;
- public string LoginEmaillook
- {
- get { return _LoginEmaillook; }
- set { SetProperty(ref _LoginEmaillook, value);}
- }
- private string _LoginNextStep = "Next Step";
- public string LoginNextStep
- {
- get { return _LoginNextStep; }
- set
- {
- SetProperty(ref _LoginNextStep, value);
- }
- }
- private string _LoginEmail = "";
- public string LoginEmail
- {
- get { return _LoginEmail; }
- set
- {
- SetProperty(ref _LoginEmail, value);
- if (LoginEmail == "")
- {
- LoginEmaillook = "";
- }
- else
- {
- CheckMail(LoginEmail);
- }
- CheckEnableNextStepEncrypt();
- }
- }
- private string _LoginEmailMsg = "Enter email address";
- public string LoginEmailMsg
- {
- get { return _LoginEmailMsg; }
- set
- {
- SetProperty(ref _LoginEmailMsg, value);
- }
- }
-
- public DelegateCommand LoginNextCommand { get; set; }
- public DelegateCommand GoLoginCommand { get; set; }
- LoginRegionViewModel(IRegionManager regionManager, IDialogService dialogService)
- {
- dialogs = dialogService;
-
- LoginNextCommand = new DelegateCommand(LoginNext);
- GoLoginCommand = new DelegateCommand(GoLogin);
- }
- private void LoginNext()
- {
-
-
- if (ServiceHelper.Ok_email(LoginEmail, "1") == "success")
- {
- LoginDialogViewModel.LoginEmail = LoginEmail;
- LoginDialogViewModel.RegionMan("LoginPasswordRegion");
- }
- else
- {
- LoginEmaillook = ServiceHelper.Ok_email(LoginEmail, "1");
- }
- ServiceHelper.ALLEmail = LoginEmail;
- }
- private void CheckMail(string mail)
- {
- string str = "^([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$";
- Regex mReg = new Regex(str);
- if (mReg.IsMatch(mail))
- {
- LoginEmaillook = "";
- }
- else
- {
- LoginEmaillook = "请输入正确的邮箱格式";
- }
- }
- private void GoLogin()
- {
- LoginDialogViewModel.Close();
- App.mainWindowViewModel.OpenRegister();
- }
- private void CheckEnableNextStepEncrypt()
- {
- EnableNextStep = true;
- if (string.IsNullOrEmpty(LoginEmail)||LoginEmaillook!="")
- {
- EnableNextStep = false;
- }
- }
- }
- }
|