예제 #1
0
        private async void ButtonLogin_OnClicked(object sender, EventArgs e)
        {
            ViewModel.IsLoggingIn  = true;
            ViewModel.Status       = "Logging in...";
            ViewModel.StatusDetail = null;

            string userName = ViewModel.UserName;
            string password = ViewModel.Password;

            DijnetLoginResult loginResult = await authClient.LoginAsync(userName, password);

            if (loginResult.Success)
            {
                bool             remember   = ViewModel.Remember;
                bool             autoLogin  = ViewModel.AutoLogin;
                DijnetCredential credential = new DijnetCredential(userName, password, remember, autoLogin);

                await credentialManager.UpdateCredentialAsync(credential);
                await OnLoginSuccess(loginResult.CookieContainer, loginResult.Url);
            }
            else
            {
                ViewModel.Status       = "Failed to log in!";
                ViewModel.StatusDetail = loginResult.Error;
                ViewModel.IsLoggingIn  = false;
            }
        }