private async void Send() { try { Navigation.Navigate(uri: Navigation.SendingAlias); var error = await SendSwapAsync(); if (error != null) { Navigation.Navigate( uri: Navigation.MessageAlias, context: MessageViewModel.Error( text: error.Description, goBackPages: 2)); return; } Navigation.Navigate( uri: Navigation.MessageAlias, context: MessageViewModel.Success( text: "Sending was successful", nextAction: () => { DialogViewer?.HideConversionConfirmationDialog(); })); } catch (Exception e) { Navigation.Navigate( uri: Navigation.MessageAlias, context: MessageViewModel.Error( text: "An error has occurred while sending swap.", goBackPages: 2)); Log.Error(e, "Swap error."); } }
private void OnAccountCreated(IAccount account) { App.UseAccount(account, restartTerminal: true); DialogViewer?.HideCreateWalletDialog(false); DialogViewer?.HideStartDialog(); }
private async void Send() { try { DialogViewer.PushPage(Dialogs.Convert, Pages.Sending); var error = await ConvertAsync(); if (error != null) { if (error.Code == Errors.PriceHasChanged) { DialogViewer.PushPage(Dialogs.Convert, Pages.Message, MessageViewModel.Message( title: Resources.SvFailed, text: error.Description, backAction: BackToConfirmation)); } else { DialogViewer.PushPage(Dialogs.Convert, Pages.Message, MessageViewModel.Error( text: error.Description, backAction: BackToConfirmation)); } return; } DialogViewer.PushPage(Dialogs.Convert, Pages.Message, MessageViewModel.Success( text: Resources.SvOrderMatched, nextAction: () => { DialogViewer?.HideDialog(Dialogs.Convert); OnSuccess?.Invoke(this, EventArgs.Empty); }), closeAction: () => OnSuccess?.Invoke(this, EventArgs.Empty)); } catch (Exception e) { DialogViewer.PushPage(Dialogs.Convert, Pages.Message, MessageViewModel.Error( text: "An error has occurred while sending swap.", backAction: BackToConfirmation)); Log.Error(e, "Swap error."); } }
private async void Send() { var account = App.AtomixApp.Account; try { Navigation.Navigate(uri: Navigation.SendingAlias); var error = await account .SendAsync(Currency, To, Amount, Fee, FeePrice); if (error != null) { Navigation.Navigate( uri: Navigation.MessageAlias, context: MessageViewModel.Error( text: error.Description, goBackPages: 2)); return; } Navigation.Navigate( uri: Navigation.MessageAlias, context: MessageViewModel.Success( text: "Sending was successful", nextAction: () => { DialogViewer?.HideSendDialog(); })); } catch (Exception e) { Navigation.Navigate( uri: Navigation.MessageAlias, context: MessageViewModel.Error( text: "An error has occurred while sending transaction.", goBackPages: 2)); Log.Error(e, "Transaction send error."); } }
private async void Send() { var wallet = (HdWallet)App.Account.Wallet; var keyStorage = wallet.KeyStorage; var tezos = Currency; var tezosAccount = App.Account .GetCurrencyAccount <TezosAccount>("XTZ"); try { DialogViewer.PushPage(Dialogs.Delegate, Pages.Delegating); await tezosAccount.AddressLocker .LockAsync(WalletAddress.Address); var tx = new TezosTransaction { StorageLimit = Currency.StorageLimit, GasLimit = Currency.GasLimit, From = WalletAddress.Address, To = To, Fee = Fee.ToMicroTez(), Currency = Currency.Name, CreationTime = DateTime.UtcNow, UseRun = true, UseOfflineCounter = true, OperationType = OperationType.Delegation }; using var securePublicKey = App.Account.Wallet.GetPublicKey( currency: Currency, keyIndex: WalletAddress.KeyIndex, keyType: WalletAddress.KeyType); var _ = await tx.FillOperationsAsync( securePublicKey : securePublicKey, tezosConfig : Currency, headOffset : TezosConfig.HeadOffset); var signResult = await tx .SignAsync(keyStorage, WalletAddress, Currency); if (!signResult) { Log.Error("Transaction signing error"); DialogViewer.PushPage(Dialogs.Delegate, Pages.Message, MessageViewModel.Error( text: "Transaction signing error", backAction: BackToConfirmation)); return; } var result = await tezos.BlockchainApi .TryBroadcastAsync(tx); if (result.Error != null) { DialogViewer.PushPage(Dialogs.Delegate, Pages.Message, MessageViewModel.Error( text: result.Error.Description, backAction: BackToConfirmation)); return; } DialogViewer.PushPage(Dialogs.Delegate, Pages.Message, MessageViewModel.Success( text: $"Successful delegation!", tezos.TxExplorerUri, result.Value, nextAction: () => { DialogViewer.HideDialog(Dialogs.Delegate); _onDelegate?.Invoke(); })); } catch (Exception e) { DialogViewer.PushPage(Dialogs.Delegate, Pages.Message, MessageViewModel.Error( text: "An error has occurred while delegation.", backAction: BackToConfirmation)); Log.Error(e, "delegation send error."); } finally { tezosAccount.AddressLocker.Unlock(WalletAddress.Address); } }
private void BackToConfirmation() { DialogViewer.Back(Dialogs.Delegate); // to delegating view DialogViewer.Back(Dialogs.Delegate); // to confirmation view }
private void OnRegisterClick() { DialogViewer?.HideLoginDialog(hideOverlay: false); DialogViewer?.ShowRegisterDialog(RegisterViewModel); }
private void BackToConfirmation() { DialogViewer.Back(Dialogs.Convert); // to sending view DialogViewer.Back(Dialogs.Convert); // to confirmation view }
private void OnBackToLoginClick() { DialogViewer?.HideRegisterDialog(hideOverlay: false); DialogViewer?.ShowLoginDialog(LoginViewModel); }
//private ICommand _restoreByFileCommand; //public ICommand RestoreByFileCommand => _restoreByFileCommand ?? (_restoreByFileCommand = new Command(() => //{ //})); private void OnCanceled() { DialogViewer?.HideCreateWalletDialog(false); }
public GameManager() { dialogViewer = new DialogViewer(); }