private string ConvertAmount(long value, bool integer) { var grams = BindConvert.Grams(value, true); var split = grams.Split(' '); var gem = split[0] == "\uD83D\uDC8E"; var amount = split[gem ? 1 : 0].Split('.'); if (integer) { if (gem) { return($"\uD83D\uDC8E {amount[0]}"); } return(amount[0]); } if (!gem) { return($".{amount[1]} \uD83D\uDC8E"); } return($".{amount[1]}"); }
private string ConvertAmount(long value) { if (value > 0) { return(BindConvert.Grams(value, false)); } return(string.Empty); }
private string ConvertText(WalletInfoState state, long amount) { switch (state) { case WalletInfoState.Created: return(Strings.Resources.WalletCongratulationsinfo); case WalletInfoState.Ready: return(Strings.Resources.WalletReadyInfo); case WalletInfoState.Sent: return(string.Format(Strings.Resources.WalletSendDoneText, BindConvert.Grams(amount, false))); case WalletInfoState.TooBad: return(Strings.Resources.WalletTooBadInfo); default: return(null); } }
private string ConvertBalance(long value) { return(string.Format(Strings.Resources.WalletSendBalance, BindConvert.Grams(value, true))); }
private string ConvertAmount(long value) { return(BindConvert.Grams(value, true)); }
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.InRecycleQueue) { return; } if (args.Item is DateTime dateHeader) { var border = args.ItemContainer.ContentTemplateRoot as Border; var label = border.Child as TextBlock; label.Text = BindConvert.DayGrouping(dateHeader); return; } var item = args.Item as RawTransaction; var root = args.ItemContainer.ContentTemplateRoot as Grid; var content = root.Children[0] as Grid; var headline = content.Children[0] as TextBlock; var address = content.Children[1] as TextBlock; var message = content.Children[2] as TextBlock; var fees = content.Children[3] as TextBlock; var timestamp = content.Children[4] as TextBlock; headline.Inlines.Clear(); long amount = 0; IList <byte> comment = null; if (item.InMsg != null) { amount = item.InMsg.Value; comment = item.InMsg.Message; } foreach (var msg in item.OutMsgs) { amount -= msg.Value; if (comment == null || comment.IsEmpty()) { comment = msg.Message; } } amount -= item.Fee; if (amount > 0) { headline.Inlines.Add(new Run { Text = ConvertAmount(amount), Foreground = new SolidColorBrush(Windows.UI.Colors.Green), FontWeight = FontWeights.SemiBold }); headline.Inlines.Add(new Run { Text = $" {Strings.Resources.WalletFrom}" }); address.Text = ConvertAddress(item.InMsg.Source); } else { headline.Inlines.Add(new Run { Text = ConvertAmount(amount), Foreground = new SolidColorBrush(Windows.UI.Colors.Red), FontWeight = FontWeights.SemiBold }); if (item.OutMsgs.IsEmpty()) { address.Text = Strings.Resources.WalletTransactionFee; } else { headline.Inlines.Add(new Run { Text = $" {Strings.Resources.WalletTo}" }); address.Text = ConvertAddress(item.OutMsgs[0].Destination); } } if (comment != null && comment.Count > 0) { message.Text = Encoding.UTF8.GetString(comment.ToArray()); message.Visibility = Visibility.Visible; } else { message.Visibility = Visibility.Collapsed; } if (item.StorageFee != 0 || item.OtherFee != 0) { fees.Text = string.Format(Strings.Resources.WalletBlockchainFees, BindConvert.Grams(-item.StorageFee - item.OtherFee, false)); fees.Visibility = Visibility.Visible; } else { fees.Visibility = Visibility.Collapsed; } timestamp.Text = BindConvert.Current.Date((int)item.Utime); }