/// <summary> /// TODO : Add summary here. /// </summary> /// <param name="result"></param> public void BeginEditFolderRequest(Action<ActionResult, IPrivateMessageFolderRequest> result) { var web = new Web.WebGet(); var url = string.Format("{0}/{1}?action=editfolders", Constants.BASE_URL, Constants.PRIVATE_MESSAGE_URI); web.LoadAsync(url, (status, args) => { IPrivateMessageFolderRequest request = null; switch (status) { case ActionResult.Success: request = AwfulPrivateMessageParser.ParseEditFolderPage(args.Document); break; } result(status, request); }); }
private void GetMessageRequest(string url, Action<ActionResult, IPrivateMessageRequest> result) { var web = new Web.WebGet(); web.LoadAsync(url, (webResult, args) => { IPrivateMessageRequest request = null; if (webResult == ActionResult.Success) { request = AwfulPrivateMessageParser .ParseNewPrivateMessageFormDocument(args.Document); } result(webResult, request); }); }
/// <summary> /// /// </summary> /// <param name="result"></param> public void FetchFoldersAsync(Action<Models.ActionResult, ICollection<IPrivateMessageFolder>> result) { // pull inbox html from server string url = string.Format("{0}/{1}?folderid={2}", Constants.BASE_URL, Constants.PRIVATE_MESSAGE_URI, 0); var web = new Web.WebGet(); web.LoadAsync(url, (status, args) => { List<IPrivateMessageFolder> folders = null; switch (status) { case ActionResult.Success: folders = new List<IPrivateMessageFolder>(); folders.AddRange(AwfulPrivateMessageParser.ParseFolderList(args.Document)); if (folders.Count > 0) { // let's cheat a little bit by parsing the inbox as well... var messages = AwfulPrivateMessageParser.ParseMessageList(args.Document); foreach (var message in messages) { folders[0].Messages.Add(message); } } break; } result(status, folders); }); }
public void FetchMessageAsync(int privateMessageId, Action<ActionResult, IPrivateMessage> result) { var web = new Web.WebGet(); var url = string.Format("{0}/{1}?action=show&privatemessageid={2}", Constants.BASE_URL, Constants.PRIVATE_MESSAGE_URI, privateMessageId); web.LoadAsync(url, (status, args) => { IPrivateMessage message = null; if (status == ActionResult.Success) { var doc = args.Document; message = AwfulPrivateMessageParser.ParsePrivateMessageDocument(doc); } result(status, message); }); }
/// <summary> /// TODO: Add summary here. /// </summary> /// <param name="folderID"></param> /// <param name="result"></param> public void FetchFolderAsync(int folderID, Action<Models.ActionResult, IPrivateMessageFolder> result) { string url = string.Format("{0}/{1}?folderid={2}", Constants.BASE_URL, Constants.PRIVATE_MESSAGE_URI, folderID); var web = new Web.WebGet(); web.LoadAsync(url, (status, args) => { IPrivateMessageFolder folder = null; switch (status) { case ActionResult.Success: folder = AwfulPrivateMessageParser.ParsePrivateMessageFolder(args.Document); break; } result(status, folder); }); }