コード例 #1
0
        /// <summary>
        /// Refresh current device to device list.
        /// </summary>
        public bool refreshDevice(DebugTokenDialog parent)
        {
            if (DevicePIN == "Not Attached")
            {
                _errors = "No device attached.\n";
                return(false);
            }

            if (KeyStorePassword == "")
            {
                if (!resetPassword())
                {
                    return(false);
                }
            }

            bool validatePW = true;

            while (validatePW)
            {
                if (createDebugToken())
                {
                    uploadDebugToken();
                }

                if ((_errors.Contains("invalid password")) || (_errors.Contains("password is not valid")) || (_errors.Contains("invalid store password")))
                {
                    if (MessageBox.Show("The specified password is invalid.\n\nPlease, enter the same one that you used to generate your BB ID Token.\n\nIf you don't remember it, you can unregister and register again using BlackBerry -> Signing menu.", _errors, MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Cancel)
                    {
                        return(false);
                    }
                    validatePW = true;
                    resetPassword();
                }
                else
                {
                    validatePW = false;
                }
            }

            if (_errors.Contains("Cannot connect:"))
            {
                MessageBox.Show(_errors, "Cannot connect", MessageBoxButtons.OK, MessageBoxIcon.Error);
                _initializedCorrectly = false;
                _tmpTokenAuthor       = "";
                _tmpAuthorID          = "";
                _authorID             = "";
                _companyName          = "";
                _tokenExpiryDate      = "";
                DevicePIN             = "Not Attached";
                return(false);
            }

            refreshScreen();
            return(true);
        }
コード例 #2
0
ファイル: DebugTokenData.cs プロジェクト: blackberry/VSPlugin
        /// <summary>
        /// Refresh current device to device list.
        /// </summary>
        public bool refreshDevice(DebugTokenDialog parent)
        {
            if (DevicePIN == "Not Attached")
            {
                _errors = "No device attached.\n";
                return false;
            }

            if (KeyStorePassword == "")
            {
                if (!resetPassword())
                    return false;
            }

            if (createDebugToken()) uploadDebugToken();

            if ((_errors.Contains("invalid password")) || (_errors.Contains("password is not valid")) || (_errors.Contains("invalid store password")))
            {
                MessageBox.Show("The specified password is invalid.\n\nPlease, enter the same one that you used to generate your BB ID Token.\n\nIf you don't remember it, you might close the next window, unregister and register again using BlackBerry -> Signing menu.",_errors, MessageBoxButtons.OK, MessageBoxIcon.Error);

                parent.Close();
                if (resetPassword())
                {
                    restart = true;
                }
                return false;
            }

            if (_errors.Contains("Cannot connect:"))
            {
                MessageBox.Show(_errors, "Cannot connect", MessageBoxButtons.OK, MessageBoxIcon.Error);
                _initializedCorrectly = false;
                _tmpTokenAuthor = "";
                _tmpAuthorID = "";
                _authorID = "";
                _companyName = "";
                _tokenExpiryDate = "";
                DevicePIN = "Not Attached";
                return false;
            }

            refreshScreen();
            return true;
        }
コード例 #3
0
ファイル: DebugTokenData.cs プロジェクト: blackberry/VSPlugin
        /// <summary>
        /// Add current device to device list.
        /// </summary>
        public bool addDevice(DebugTokenDialog parent)
        {
            if (DevicePIN == "Not Attached")
            {
                _errors = "No device attached.\n";
                return false;
            }

            if (KeyStorePassword == "")
            {
                if (!resetPassword())
                    return false;
            }

            bool validatePW = true;

            while (validatePW)
            {
                if (createDebugToken()) uploadDebugToken();

                if ((_errors.Contains("invalid password")) || (_errors.Contains("password is not valid")) || (_errors.Contains("invalid store password")))
                {
                    if (MessageBox.Show("The specified password is invalid.\n\nPlease, enter the same one that you used to generate your BB ID Token.\n\nIf you don't remember it, you can unregister and register again using BlackBerry -> Signing menu.", "Debug Tokens", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Cancel)
                        return false;
                    validatePW = true;
                    resetPassword();
                }
                else
                {
                    validatePW = false;
                }
            }

            if (_errors != "")
            {
                MessageBox.Show(_errors, "Debug Tokens", MessageBoxButtons.OK, MessageBoxIcon.Error);
                _initializedCorrectly = false;
                _tmpTokenAuthor = "";
                _tmpAuthorID = "";
                _authorID = "";
                _companyName = "";
                _tokenExpiryDate = "";
                return false;
            }

            refreshScreen();
            return true;
        }