Exemplo n.º 1
0
        private async Task TryLogin(string mail, string password, bool isRememberPassword)
        {
            try
            {
                IsFailedLogin.Value = false;
                NowTryLogin.Value   = true;

                var isLoginSuccess = await _DiscordContext.TryLogin(mail, password, isRememberPassword);

                if (isLoginSuccess)
                {
                    IsLoginSuccess.Value = true;

                    await Task.Delay(TimeSpan.FromSeconds(1));

                    _NavigationService.Navigate(PageTokens.LoggedInProcessPageToken, null);

                    _NavigationService.ClearHistory();
                }
                else
                {
                    // ログイン失敗
                    IsFailedLogin.Value = true;

                    await Task.Delay(TimeSpan.FromSeconds(0.5));
                }

                // パスワードを保存しない場合は、以前入力されたログイン資格情報を削除
                if (!isRememberPassword)
                {
                    _DiscordContext.RemoveRecentLoginAccount();
                }
            }
            finally
            {
                NowTryLogin.Value = false;
            }
        }