void AddInboxes(StackPage page, long accountId, Func <ButtonRow, Task> action, InboxRecordDownloadEvent downloadResult) { page.RemoveHeaderSection("Inboxes"); page.AddIndex = page.GetRow("Title"); page.AddIndex = page.AddHeaderRow("Inboxes"); var result = downloadResult; //if(result == null) //result = await node.DownloadInboxRecords(accountId); if (result.Result == MessageNodeEventResultTypes.Ok) { foreach (var item in result.InboxRecords) { var button = page.AddButtonRow(null, action); page.AddIndex = button; var inboxName = item.InboxRecord?.Title; if (inboxName == null) { inboxName = Tr.Get("Common.Inbox"); } button.SetMultilineText(inboxName, Tr.Get("Common.InboxName", accountId, item.KeyIndex)); button.SetDetailViewIcon(Icons.Inbox); button.Tag = item; } } else { if (result.Result == MessageNodeEventResultTypes.InvalidAccount) { page.AddIndex = page.AddInfoRow("InvalidAccount"); } else { page.AddIndex = page.AddInfoRow("DownloadFailed"); } } page.AddIndex = page.AddFooterRow(); }
public void HandleTransactions(TransactionDownloadResult <Transaction> download) { if (download.Transactions.Count == 0) { if (_page.GetRow("NoMessageFound") == null) { _page.AddIndex = _header; _page.AddInfoRow("NoMessageFound"); } } else { _page.RemoveView(_page.GetRow("NoMessageFound")); var diff = ListDiff.Compute(_messageRows, download.Transactions, (a, b) => (a.Tag as MessageViewBase).Transaction.TransactionId == b.TransactionId); diff.Process(_messageRows, download.Transactions, (message) => { _page.RemoveView(message); return(true); }, (idx, item) => { _page.AddIndexBefore = false; if (idx == 0) { _page.AddIndex = _header; } else { _page.AddIndex = _messageRows[idx - 1]; } var r = AddMessageRow(item); _messageRows.Insert(idx, r); }); _page.AddIndex = null; } }