Example #1
0
        private async Task InvokeLogin()
        {
            var isLoggedIn = false;

            do
            {
                var loginData = await _dialogCordinator.ShowNtLogin(this);

                if (loginData == null)
                {
                    // User has cancelled Login, Should exist.
                    Application.Current.Shutdown();
                }

                IsBusy = true;
                var errorMsg = new NtRef <string>();
                isLoggedIn = await _currentUserService.Authenticate(loginData.Username, loginData.Password, errorMsg);

                IsBusy = false;
                if (!isLoggedIn)
                {
                    await _dialogCordinator.ShowNtOkDialog(this, "Authentication Failed", errorMsg);
                }
            }while (!isLoggedIn);

            _eventAggregator.PublishOnUIThread(new UserLoggedInMessage(this));
        }