public static void PullMessages(string memId, string uid, int page, int count, GroupOwnerTypeEnum type, Action<MessageModel> callback) { var webClient = new WebClient(); webClient.DownloadStringCompleted += (sender, e) => { try { var data = RDN.Portable.Classes.Utilities.Json.DeserializeObject<MessageModel>(e.Result); callback(data); } catch (Exception exception) { } }; Random random = new Random(); webClient.Encoding = System.Text.Encoding.UTF8; webClient.DownloadStringAsync(new Uri(MobileConfig.MEMBER_MESSAGES_URL + "mid=" + memId.ToString() + "&t=" + type + "&uid=" + uid.ToString() + "&p=" + page + "&c=" + count + "&r=" + random.Next())); }
public static MessageModel GetMessagesForOwner(GroupOwnerTypeEnum ownerType, Guid memId, int page, int count) { MessageModel mess = new MessageModel(); try { mess.IdOfEntity = memId; mess.OwnerType = ownerType; var dc = new ManagementContext(); GetGroupMessages(memId, mess, dc, page, count); //this is the conversation with my self. I don't know ye why this shows up talking to one self. var personalConvo = mess.Conversations.Where(x => x.ConversationWithUser == memId).FirstOrDefault(); if (personalConvo != null) mess.Conversations.Remove(personalConvo); } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return mess; }