Exemple #1
0
        private void getTokenStatus()
        {
            try
            {
                if (!validateApiAccount(Context))
                {
                    MessageBox.Show("Pleasse fill in Api Account first.");
                    return;
                }

                GetTokenStatusCall gtsc = new GetTokenStatusCall(Context);
                TokenStatusType    tst  = gtsc.GetTokenStatus();
                textBox1.Text = tst.Status.ToString();
                textBox2.Text = tst.EIASToken;
                textBox3.Text = tst.ExpirationTime.ToString();
                if (tst.Status == TokenStatusCodeType.RevokedByApp ||
                    tst.Status == TokenStatusCodeType.RevokedByeBay ||
                    tst.Status == TokenStatusCodeType.RevokedByUser)
                {
                    textBox4.Enabled = true;
                    textBox4.Text    = tst.RevocationTime.ToString();
                }
                else
                {
                    textBox4.Enabled = false;
                    textBox4.Text    = "";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// Checks the token validity.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns></returns>
        public Task <bool> CheckTokenValidity(string token)
        {
            GetTokenStatusCall tokenStatusCall = new GetTokenStatusCall(GetContext(token));

            return(Task.Run(() => {
                TokenStatusType tokenStatus = tokenStatusCall.GetTokenStatus();
                if (tokenStatus.StatusSpecified && tokenStatus.Status == TokenStatusCodeType.Active)
                {
                    return true;
                }
                return false;
            }));
        }