Beispiel #1
0
        //
        // Get the user profile after signed in
        //
        public bool tpGetProfile(out string error_msg)
        {
            error_msg = "";

            try
            {
                string url = API_GET_PROFILE + this.Token;

                string response = WebRequest(Method.GET, url, string.Empty);
                if (response.Length > 0)
                {
                    DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(tpModels.User));
                    MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(response));
                    this.User = (tpModels.User)ser.ReadObject(ms);
                    ms.Close();
                    if (this.User.email != null)
                    {
                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                error_msg = "Failed to get the user profile.";
                return(false);
            }
            error_msg = "Failed to get a server response.";
            return(false);
        }
Beispiel #2
0
        //
        // Get the user profile after signed in
        //
        public bool tpGetProfile(out string error_msg)
        {
            error_msg = "";

            try
            {
                string url = API_GET_PROFILE + this.Token;

                string response = WebRequest(Method.GET, url, string.Empty);
                if (response.Length > 0)
                {
                    DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(tpModels.User));
                    MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(response));
                    this.User = (tpModels.User)ser.ReadObject(ms);
                    ms.Close();
                    if (this.User.email != null)
                    {
                        return true;
                    }
                }
            }
            catch (Exception e)
            {
                error_msg = "Failed to get the user profile.";
                return false;
            }
            error_msg = "Failed to get a server response.";
            return false;
        }