コード例 #1
0
        /// <summary>
        /// Logs the user in with a token.
        /// </summary>
        public async void LoginWithToken(string?token)
        {
            if (token is null)
            {
                return;
            }

            await _discordService.LoginAsync(token, LoginType.Fresh);
        }
コード例 #2
0
        private async void InitializeLogin()
        {
            // Login if possible
            await _storageService.AccountInfoStorage.LoadAsync();

            AccountInfo?activeAccount = _storageService.AccountInfoStorage.ActiveAccount;

            if (activeAccount is not null)
            {
                bool success = await _discordService.LoginAsync(activeAccount.Token, LoginType.StartupLogin);

                if (!success)
                {
                    WindowState = WindowHostState.LoginFailed;
                }
            }
            else
            {
                WindowState = WindowHostState.LoggedOut;
            }
        }