void UpdateTasks(TodoTaskStatusTypes status, string headerName, List <ButtonRow> taskButtons, string noIdentifier) { var header = GetRow <HeaderRow>(headerName); var tasks = TodoList.GetTasks(status, TodoListSortMethod.ByTimestampDesc); if (tasks.Count > 0) { RemoveView(GetRow(noIdentifier)); var diff = ListDiff.Compute(taskButtons, tasks, (a, b) => (a.Tag as TodoTask).Id == b.Id); diff.Process(taskButtons, tasks, (row) => { RemoveView(row); return(true); }, (idx, item) => { AddIndexBefore = false; if (idx == 0) { AddIndex = header; } else { AddIndex = taskButtons[idx - 1]; } var b = AddTaskButtonRow(item); taskButtons.Insert(idx, b); }); } else { taskButtons.Clear(); ClearHeaderSection(headerName); AddIndex = header; AddIndexBefore = false; AddInfoRow(noIdentifier); } }
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; } }