Example #1
0
        public bool Logout(string apiToken)
        {
            string apiUrl      = App.Context.ServerAddress + string.Format(Constants.AppAPI.UserLogoutAPI, apiToken);
            var    apiResponse = NetWorkUtility.MakeRequestSync(apiUrl, "GET");
            var    result      = JsonConvert.DeserializeObject <LoginResponseModel>(apiResponse);

            if (bool.TryParse(result.data, out bool v))
            {
                return(v);
            }

            return(false);
        }
Example #2
0
        /// <summary>
        /// Query all Chat in of a event
        /// </summary>
        /// <param name="token"></param>
        /// <param name="eventID"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public List <ChatMessage> QueryChat(string token, int eventID, int type)
        {
            string apiUrl      = App.Context.ServerAddress + string.Format(Constants.AppAPI.GetChatAPI, token, eventID, type);
            var    apiResponse = NetWorkUtility.MakeRequestSync(apiUrl, "GET");

            if (apiResponse.Length > 25)
            {
                try
                {
                    var result = Utility.DeserializeObject <ListChatMessageResponseModel>(apiResponse);
                    return(result.data);
                }
                catch (Exception ex)
                {
                    //mvxLog.Error(ex.ToString());
                    //mvxLog.Error(ex.StackTrace);
                }
            }
            return(null);
        }
Example #3
0
        /// <summary>
        /// Query Chat in of a event by date
        /// </summary>
        /// <param name="token"></param>
        /// <param name="eventID"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public List <ChatMessage> QueryChat(string token, int eventID, int type, bool isNewQuery, DateTime createTime)
        {
            var createTimestr = string.Format("{0:yyyy/mm/dd hh:mm:ss}", createTime);
            var api           = isNewQuery ? Constants.AppAPI.GetNewChatAPI : Constants.AppAPI.GetOldChatAPI;

            string apiUrl      = App.Context.ServerAddress + string.Format(api, token, eventID, type, createTimestr);
            var    apiResponse = NetWorkUtility.MakeRequestSync(apiUrl, "GET");

            if (apiResponse.Length > 25)
            {
                try
                {
                    var result = JsonConvert.DeserializeObject <ListChatMessageResponseModel>(apiResponse);
                    return(result.data);
                }
                catch (Exception ex)
                {
                    //mvxLog.Error(ex.ToString());
                    //mvxLog.Error(ex.StackTrace);
                }
            }
            return(null);
        }