public SignInPanelViewModel(IContainerExtension container) : base(container) { channel = GrpcChannel.ForAddress("https://localhost:5001"); accountsClient = new AccountsClient(channel); EventAggregator.GetEvent <SignUpSuccessEvent>().Subscribe(signUpArgs => this.signUpArgs = signUpArgs); }
public void OnLoaded(SignInPanel view) { // 1. Login info from SignUpView if (signUpArgs != null) { IsRememberMe = false; IsAutoSignIn = false; Email = signUpArgs.Username; Password = signUpArgs.Password; SignInCommand.Execute(null); signUpArgs = null; return; } // 2. If there is some residual information on username or password text box, no login information is loaded from elsewhere. if (!string.IsNullOrEmpty(Email) || !string.IsNullOrEmpty(Password)) { return; } // 3. No login info from config file. if (!CanSignIn(ConfigureFile.GetValue <string>(ConfigureKeys.Username), ConfigureFile.GetValue <string>(ConfigureKeys.Password))) { return; } // 4. Login info from config file. IsRememberMe = true; IsAutoSignIn = ConfigureFile.GetValue <bool>(ConfigureKeys.AutoSignIn); Email = ConfigureFile.GetValue <string>(ConfigureKeys.Username); Password = ConfigureFile.GetValue <string>(ConfigureKeys.Password).DecryptByDes(); if (IsAutoSignIn) { SignInCommand.Execute(null); } }