コード例 #1
0
        private void GetNewPassword(OfxDownloadData ofxData)
        {
            var info = OfxRequest.GetSignonInfo(this.myMoney, ofxData.OnlineAccount);

            ChangePasswordDialog dialog = new ChangePasswordDialog(info, ofxData.OnlineAccount, this.myMoney);

            dialog.Owner = Application.Current.MainWindow;

            if (dialog.ShowDialog() == true)
            {
                ofxData.Message     = "New password is accepted";
                ofxData.LinkCaption = this.tryAgainCaption = "Try Download Again";
                ofxData.OfxError    = OfxErrorCode.None;
                ofxData.Error       = null;
            }
            else
            {
                Exception ex = dialog.Error;
                if (ex != null)
                {
                    ofxData.Message = ex.Message;
                }
                else
                {
                    ofxData.Message = "User cancelled";
                }
            }
        }
コード例 #2
0
        // background thread
        private void ChangePassword(object state)
        {
            OfxRequest req = new OfxRequest(this.account, this.money, null);

            try
            {
                req.ChangePassword(this.account, newPassword, out logFile);
            }
            catch (Exception e)
            {
                Error = e;
            }
            if (cancelled)
            {
                return;
            }

            UiDispatcher.BeginInvoke(new Action(() =>
            {
                if (this.Error != null)
                {
                    // The error might be about the new password being invalid for some reason, so show
                    // the message and let user try again.
                    ShowError(this.Error.Message);
                    EnableButtons();
                }
                else
                {
                    this.DialogResult     = true;
                    this.account.Password = this.GetUserDefinedField("NewPassword");
                    this.Close();
                }
            }));
        }
コード例 #3
0
        private void GetLogin(OfxDownloadData ofxData)
        {
            var info = OfxRequest.GetSignonInfo(this.myMoney, ofxData.OnlineAccount);

            string msg = (ofxData.Error != null) ? ofxData.Error.Message : null;

            OfxLoginDialog login = new OfxLoginDialog(info, ofxData.OnlineAccount, null, ofxData.OfxError, msg);

            login.Owner = Application.Current.MainWindow;

            if (login.ShowDialog() == true)
            {
                ofxData.Message     = "New credentials are ready.";
                ofxData.LinkCaption = this.tryAgainCaption = "Try Download Again";
                ofxData.OfxError    = OfxErrorCode.None;
                ofxData.Error       = null;
            }
            else
            {
                ofxData.Message = "User cancelled";
            }
        }
コード例 #4
0
        private void GetAuthenticationToken(OfxDownloadData ofxData, OfxErrorCode code)
        {
            var info = OfxRequest.GetSignonInfo(this.myMoney, ofxData.OnlineAccount);

            if (info != null)
            {
                PromptForAuthToken(ofxData, info, code);

                if (string.IsNullOrWhiteSpace(ofxData.OnlineAccount.AuthToken))
                {
                    // user cancelled.
                    ofxData.Message = "User cancelled";
                    return;
                }
                else
                {
                    ofxData.Message     = "Your authorization token is ready to use";
                    ofxData.LinkCaption = this.tryAgainCaption = "Try Download Again";
                    ofxData.OfxError    = OfxErrorCode.None;
                    ofxData.Error       = null;
                }
            }
        }