Task DownloadTransactions(TransactionDownloadEvent <Transaction> downloadEvent) { AddIndexBefore = false; AddIndex = GetRow("Notes"); var rows = GetHeaderSectionRows("Notes"); IsBusy = false; foreach (var item in downloadEvent.Items) { if (!item.Result.Ok) { UIApp.Toast(Tr.Get("TransactionDownloadResult.DownloadFailed", item.ServiceNode.GetName())); } } var transactions = downloadEvent.GetSortedTransactions(TransactionSortMode.TimestampDescening); if (transactions.Count > 0 && _listView != null) { RemoveView(GetRow("Info")); RemoveView(GetRow("Add")); if (!UIAppSettings.AppReady) { UIAppSettings.AppReady = true; UIApp.Current.SaveSettings(); } _listView.Update(transactions); UIApp.Run(UpdateNotes); if (downloadEvent.HasMore) { if (_more == null) { _more = AddButtonRow("MoreButton", More); } } else { RemoveView(_more); _more = null; } } else { if (ServiceNodeManager.Current.HadUnlockedServiceNode && UIAppSettings.AppReady) { Toast("NoNotes"); } } return(Task.CompletedTask); }
Task AccountTransactionsDownloaded(TransactionDownloadEvent <Transaction> downloadedEvent) { AddIndexBefore = false; AddIndex = GetRow("RecentTransactions"); var rows = GetHeaderSectionRows("RecentTransactions"); var transactions = downloadedEvent.GetSortedTransactions(TransactionSortMode.TimestampDescening); if (transactions.Count > 0) { for (var i = 0; i < transactions.Count; i++) { var transaction = transactions[i]; var endpoint = transaction.Tag as ServiceNode; if (i < rows.Count && rows[i] is ButtonViewRow <VerifyTransactionView> button) { button.View.Update(transaction.Transaction as AttachementDataTransaction); button.RowLayout.SetAccentColor(endpoint.AccentColor); } else { button = AddButtonViewRow(new VerifyTransactionView(transaction.Transaction as AttachementDataTransaction), Select); button.RowLayout.SetAccentColor(endpoint.AccentColor); } button.Tag = transaction; AddIndex = button; } if (downloadedEvent.HasMore) { if (_more == null) { _more = AddButtonRow("MoreButton", More); } } else { RemoveView(_more); _more = null; } } else { Toast("NoTransactions"); } IsBusy = false; return(Task.CompletedTask); }