async Task Verify(ButtonViewRow <VerifyFileView> button) { if (!(button.Tag is VerifyFileJson verify)) { return; } if (string.IsNullOrEmpty(verify.link)) { await Verify(verify); } else { var result = await DisplayVerifyFileAction(); if (result == VerifyFileAction.Verify) { await Verify(verify); } else if (result == VerifyFileAction.OpenLink) { if (!string.IsNullOrEmpty(verify.link)) { UIApp.OpenUrl(new Uri(verify.link)); } } } }
async Task Reload(ButtonViewRow <TodoListDownloadErrorView> arg) { IsBusy = true; await TodoList.DownloadTransactions(); IsBusy = false; }
async Task SetPurchase(ButtonViewRow <PurchaseInfoView> button) { var purchaseInfo = button.Tag as PurchaseInfo; _purchasePage.SetPurchaseId(purchaseInfo.PurchaseItemId); await Navigation.PopAsync(); }
protected override void UpdateRow(ButtonViewRow <NoteView> row, TransactionDownloadData <Transaction> newItem) { var noteData = NoteApp.Current.GetNoteData(newItem); var serviceNode = noteData.ServiceNode; row.View.Update(noteData); row.RowLayout.SetAccentColor(serviceNode.AccentColor); }
async Task EditFile(ButtonViewRow <VerifyFileView> button) { var cancel = Tr.Get("Common.Cancel"); var moveUp = Tr.Get("Common.MoveUp"); var moveDown = Tr.Get("Common.MoveDown"); var edit = Tr.Get("Common.Edit"); var delete = Tr.Get("Common.Delete"); var openlink = T("OpenLink"); var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, null, moveUp, moveDown, edit, delete, openlink); if (result == edit) { await VerificationFilePage.Open(this, button.Tag as VerifyFileJson); } else if (result == delete) { Status.RemoveBusyView(button); RemoveView(button); Status.ReValidate(); } else if (result == moveUp || result == moveDown) { var idx = StackLayout.Children.IndexOf(button); if (idx > 0) { var hasNext = (StackLayout.Children[idx + 1] as StackRow)?.Tag is VerifyFileJson; var hasPrev = (StackLayout.Children[idx - 1] as StackRow)?.Tag is VerifyFileJson; if (hasNext && result == moveDown) { StackLayout.Children.RemoveAt(idx); StackLayout.Children.Insert(idx + 1, button); } else if (hasPrev && result == moveUp) { StackLayout.Children.RemoveAt(idx); StackLayout.Children.Insert(idx - 1, button); } } } else if (result == openlink) { if (button.Tag is VerifyFileJson verify && !string.IsNullOrEmpty(verify.link)) { UIApp.OpenUrl(new Uri(verify.link)); } } }
async Task Select(ButtonViewRow <VerifyTransactionView> button) { IsBusy = true; if (button.Tag is TransactionDownloadData <Transaction> transaction) { var verification = await VerifyApp.Current.GetVerificationResult(transaction); if (verification != null) { await Navigation.PushAsync(new VerifyPage(verification)); } } IsBusy = false; }
async Task DisplayKeyAction(ButtonViewRow <ClientAccountView> button) { var cancel = Tr.Get("Common.Cancel"); var export = T("ExportButton"); var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, null, export); if (result == export) { var ac = WalletApp.CurrentCoreAccount; if (ac != null) { await Navigation.PushAsync(new ExportAccountPage(ac, WalletApp.MinPasswordLength)); } } }
async Task PurchaseAction(ButtonViewRow <ChainPurchaseView> button) { var view = button.Tag as ChainPurchaseView; var status = view.Status; if (status == ChainItemStatus.New && await ItemAction(ChainItemAction.Delete) == ChainItemAction.Delete) { view.Purchase.Status = view.Status = ChainItemStatus.Delete; _purchases.Remove(view.Purchase); RemoveView(button); } else if (status == ChainItemStatus.Live && await ItemAction(ChainItemAction.Revoke) == ChainItemAction.Revoke) { view.Purchase.Status = view.Status = ChainItemStatus.Revoked; } _endPointStatus.ReValidate(); }
async Task ChainKeyAction(ButtonViewRow <ChainSignedPublicKeyView> button) { var view = button.Tag as ChainSignedPublicKeyView; var status = view.Status; if (status == ChainItemStatus.New && await ItemAction(ChainItemAction.Delete) == ChainItemAction.Delete) { view.PublicKey.Status = view.Status = ChainItemStatus.Delete; _chainKeys.Remove(view.PublicKey); RemoveView(button); } else if (status == ChainItemStatus.Live && await ItemAction(ChainItemAction.Revoke) == ChainItemAction.Revoke) { view.PublicKey.Status = view.Status = ChainItemStatus.Revoked; } _endPointStatus.ReValidate(); }
async Task KeyAction(ButtonViewRow <ClientAccountView> button) { var key = button.Tag as ChainKeyStore; var flags = key.PublicChainKey.Flags; var action = await DisplayKeyAction(flags.HasFlag(PublicChainKeyFlags.ChainAdminKey)); if (action == ChainKeyAction.Export) { await Navigation.PushAsync(new ExportAccountPage(key, WalletApp.MinPasswordLength)); } else if (action == ChainKeyAction.EditChain) { var chainInfo = (await WalletApp.Client.DownloadChainInfo(key.ChainId)).Data; if (chainInfo != null) { await Navigation.PushAsync(new ChainPage(chainInfo, key)); } else { await MessageAsync("ChainInfoDownloadFailed"); } } }
void UpdateSecretKeyButton() { if (!TodoList.LastDownloadResult.Ok) { if (_downloadErrorButton == null) { AddIndex = GetRow("Title"); _downloadErrorButton = AddButtonViewRow(new TodoListDownloadErrorView(), Reload); _downloadErrorButton.RowStyle = Theme.CancelButton; AddIndex = null; } } else { if (_downloadErrorButton != null) { RemoveView(_downloadErrorButton); _downloadErrorButton = null; } } var secretKeyMissing = TodoList.HasMissingSecretKeys; if (secretKeyMissing && _importSecretButton == null) { AddIndex = GetRow("Title"); _importSecretButton = AddButtonViewRow(new TodoListSecretErrorView(), Import); _importSecretButton.RowStyle = Theme.CancelButton; AddIndex = null; } if (!secretKeyMissing && _importSecretButton != null) { RemoveView(_importSecretButton); _importSecretButton = null; } }
async Task Import(ButtonViewRow <TodoListSecretErrorView> button) { await Navigation.PushAsync(new MissingSecretKeysPage <GroupSubmitAccount>(TodoList.MissingSecretKeys.Values, TodoList.ServiceNode.GetSubmitAccounts <GroupSubmitAccount>(TodoList.Index))); }
async Task Note(ButtonViewRow <NoteView> button) { await _page.Navigation.PushAsync(new NoteInfoPage(button.View.NoteData)); }