private void GetCanDesktopsFailed(
            string hostName,
            string username,
            string password,
            bool cardLogin,
            Exception ex)
        {
            var wx = ex as WebException;

            if (wx != null && wx.Status == WebExceptionStatus.ProtocolError && cardLogin)
            {
                var ask = new AskPinDialog();
                _resources.Add(Disposable.Create(ask.Close));
                var result = ask.ShowDialog();
                var pin    = ask.Pin.SecurePassword.String();
                if (result.HasValue && result.Value)
                {
                    Connect(hostName, username, pin, true);
                }
            }
            else
            {
                _loginState.OnNext(new LoginState(LoginStatus.Disconnected, ex));
            }
        }
Exemplo n.º 2
0
        private void GetCanDesktopsFailed(
            string hostName,
            string username,
            string password,
            bool cardLogin,
            Exception ex)
        {
            var wx = ex as WebException;

            if (wx != null && wx.Status == WebExceptionStatus.ProtocolError && cardLogin)
            {
                _dispatcher.Dispatch(
                    () =>
                {
                    var ask = new AskPinDialog();
                    _resources.Add(Disposable.Create(
                                       () => _dispatcher.Dispatch(ask.Close)));
                    if (!ask.IsDisposed)
                    {
                        var result = ask.ShowDialog();
                        if (result == DialogResult.Retry)
                        {
                            Connect(hostName, username, ask.Pin, true);
                        }
                    }
                });
            }
            else
            {
                _loginState.OnNext(new LoginState(LoginStatus.Disconnected, ex));
            }
        }