コード例 #1
0
        /// <summary>
        /// Method to test the credentials for the ARM API
        /// </summary>
        /// <param name="bw">The Background worker object</param>
        /// <param name="e">The Event Args object</param>
        private void DoWork_TestARMAPI(BackgroundWorker bw, DoWorkEventArgs e)
        {
            try
            {
                string errorMsg = string.Empty;
                string armToken = string.Empty;
                this.isAPITestValid = TestAPIUtil.TestARMAPIToken(this.creds, out armToken, out errorMsg);

                if (this.CheckIfBWorkerCancelled(bw, e))
                {
                    return;
                }

                if (!this.isAPITestValid)
                {
                    this.apiTestFailedError = errorMsg;
                }
                else
                {
                    if (TestAPIUtil.TestARMAPI(this.creds, armToken, out errorMsg))
                    {
                        this.isAPITestValid = true;
                    }
                    else
                    {
                        this.apiTestFailedError = errorMsg;
                        this.isAPITestValid     = false;
                    }
                }

                if (this.CheckIfBWorkerCancelled(bw, e))
                {
                    return;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        /// <summary>
        /// Method to test the credentials for the Partner Center API
        /// </summary>
        /// <param name="bw">the Background worker object</param>
        /// <param name="e">the Event Args object</param>
        private void DoWork_TestPCAPI(BackgroundWorker bw, DoWorkEventArgs e)
        {
            try
            {
                string errorMsg = string.Empty;
                this.isAPITestValid = TestAPIUtil.TestPCAPI(this.creds, out errorMsg);

                if (!this.isAPITestValid)
                {
                    this.apiTestFailedError = errorMsg;
                }

                if (this.CheckIfBWorkerCancelled(bw, e))
                {
                    return;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }