示例#1
0
        public async Task <bool> Login(string UserName, string Password)
        {
            var client         = new HttpClient();
            var PostDataString = "email=" + UserName + "&password="******"application/x-www-form-urlencoded")));

            using (HttpContent content = response.Content)
            {
                var serializer = new DataContractJsonSerializer(typeof(IbmQx_UserLogin));
                var data       = serializer.ReadObject(await content.ReadAsStreamAsync()) as IbmQx_UserLogin;
                if (data != null)
                {
                    AuthenticationData = data;
                    data.TokenEndTime  = DateTime.Now.AddSeconds(data.Ttl - 10);
                    return(_storage.SaveAuthenticationData(data));
                }
                return(false);
            }
        }
示例#2
0
 public IbmQX()
 {
     _storage           = new Storage();
     AuthenticationData = _storage.LoadAuthenticationData();
 }