From f49d87da696810bec734c5f90ab14bf9f1fdb2b0 Mon Sep 17 00:00:00 2001 From: Hunter Date: Sun, 7 Jun 2020 11:51:55 +0100 Subject: [PATCH 01/10] Add modal component service & creat add node modal --- .../Blockcore.Features.NodeHost/Startup.cs | 4 ++ .../UI/Modal.razor | 19 +++++++ .../UI/Modal.razor.cs | 45 ++++++++++++++++ .../UI/ModalService.cs | 28 ++++++++++ .../UI/Pages/AddNode.razor | 45 ++++++++++++++++ .../UI/Pages/Index.razor | 47 +++++----------- .../UI/Pages/_Host.cshtml | 1 + .../UI/ServiceCollectionExtension.cs | 13 +++++ .../UI/Shared/MainLayout.razor | 3 +- .../UI/_Imports.razor | 4 +- .../UI/wwwroot/css/site.css | 53 +++++++++++++++++++ 11 files changed, 227 insertions(+), 35 deletions(-) create mode 100644 src/Features/Blockcore.Features.NodeHost/UI/Modal.razor create mode 100644 src/Features/Blockcore.Features.NodeHost/UI/Modal.razor.cs create mode 100644 src/Features/Blockcore.Features.NodeHost/UI/ModalService.cs create mode 100644 src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor create mode 100644 src/Features/Blockcore.Features.NodeHost/UI/ServiceCollectionExtension.cs diff --git a/src/Features/Blockcore.Features.NodeHost/Startup.cs b/src/Features/Blockcore.Features.NodeHost/Startup.cs index dfb484cc0..7ca99860d 100644 --- a/src/Features/Blockcore.Features.NodeHost/Startup.cs +++ b/src/Features/Blockcore.Features.NodeHost/Startup.cs @@ -15,6 +15,7 @@ using Microsoft.OpenApi.Models; using Newtonsoft.Json; using Swashbuckle.AspNetCore.SwaggerUI; +using BlazorModal; namespace Blockcore.Features.NodeHost { @@ -82,6 +83,9 @@ public void ConfigureServices(IServiceCollection services) // The UI elements moved under the UI folder options.RootDirectory = "/UI/Pages"; }); + + services.AddBlazorModal(); + } if (hostSettings.EnableWS) diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Modal.razor b/src/Features/Blockcore.Features.NodeHost/UI/Modal.razor new file mode 100644 index 000000000..90620da59 --- /dev/null +++ b/src/Features/Blockcore.Features.NodeHost/UI/Modal.razor @@ -0,0 +1,19 @@ +@inherits BlazorModal.ModalBase + +
+ +
+ +
+
+

@Title

+ +
+
+ @Content +
+
+ +
\ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Modal.razor.cs b/src/Features/Blockcore.Features.NodeHost/UI/Modal.razor.cs new file mode 100644 index 000000000..64066e617 --- /dev/null +++ b/src/Features/Blockcore.Features.NodeHost/UI/Modal.razor.cs @@ -0,0 +1,45 @@ +using BlazorModal.Services; +using System; +using Microsoft.AspNetCore.Components; + +namespace BlazorModal +{ + public class ModalBase : ComponentBase, IDisposable + { + [Inject] ModalService ModalService { get; set; } + + protected bool IsVisible { get; set; } + protected string Title { get; set; } + protected RenderFragment Content { get; set; } + + protected override void OnInitialized() + { + ModalService.OnShow += ShowModal; + ModalService.OnClose += CloseModal; + } + + public void ShowModal(string title, RenderFragment content) + { + Title = title; + Content = content; + IsVisible = true; + + StateHasChanged(); + } + + public void CloseModal() + { + IsVisible = false; + Title = ""; + Content = null; + + StateHasChanged(); + } + + public void Dispose() + { + ModalService.OnShow -= ShowModal; + ModalService.OnClose -= CloseModal; + } + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/ModalService.cs b/src/Features/Blockcore.Features.NodeHost/UI/ModalService.cs new file mode 100644 index 000000000..333f7d405 --- /dev/null +++ b/src/Features/Blockcore.Features.NodeHost/UI/ModalService.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Components; +using System; + +namespace BlazorModal.Services +{ + public class ModalService + { + public event Action OnShow; + public event Action OnClose; + + public void Show(string title, Type contentType) + { + if (contentType.BaseType != typeof(ComponentBase)) + { + throw new ArgumentException($"{contentType.FullName} must be a Blazor Component"); + } + + var content = new RenderFragment(x => { x.OpenComponent(1, contentType); x.CloseComponent(); }); + + OnShow?.Invoke(title, content); + } + + public void Close() + { + OnClose?.Invoke(); + } + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor b/src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor new file mode 100644 index 000000000..6acd254ea --- /dev/null +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor @@ -0,0 +1,45 @@ +@using Blockcore.Utilities.Extensions + +@inject Blockcore.Connection.IConnectionManager ConnectionManager + +@if (ShowForm) +{ + +
+ +
+ +
+
+ +} +else +{ + + +} +@code +{ + bool ShowForm { get; set; } = true; + private string NodeIp { get; set; } + string Alert { get; set; } + private void Addnode() + { + + ShowForm = false; + + if (string.IsNullOrEmpty(this.NodeIp)) { this.Alert = "Please enter an IP address"; return; } + this.Alert = string.Empty; + + var endpoint = this.NodeIp.ToIPEndPoint(this.ConnectionManager.Network.DefaultPort); + + this.ConnectionManager.AddNodeAddress(endpoint); + + this.Alert = $"node {endpoint} added"; + } + + +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor index 4fdf5b4ef..4db71c7af 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor @@ -8,31 +8,20 @@ @inject Blockcore.Connection.IConnectionManager ConnectionManager @inject Blockcore.Interfaces.IInitialBlockDownloadState InitialBlockDownloadState @inject NavigationManager NavigationManager +@inject ModalService ModalService

@this.Network.CoinTicker.ToUpper() Network

-
- -
- -
- - -
+ + +
-
-
@Alert
-
- @{ if (this.InitialBlockDownloadState.IsInitialBlockDownload()) { @@ -179,29 +168,21 @@ + + } @code { - private string NodeIp { get; set; } - string Alert { get; set; } - private void Addnode() - { - if (string.IsNullOrEmpty(this.NodeIp)) { this.Alert = "Please enter an IP address"; return; } - this.Alert = string.Empty; - - var endpoint = this.NodeIp.ToIPEndPoint(this.ConnectionManager.Network.DefaultPort); - - this.ConnectionManager.AddNodeAddress(endpoint); - - this.Alert = $"node {endpoint} added"; - } private void Shutdown() { this.FullNode?.NodeLifetime.StopApplication(); } - private void NavigateToLogs() { NavigationManager.NavigateTo("logs"); } -} \ No newline at end of file + private void AddNode() + { + ModalService.Show("Add Node", typeof(AddNode)); + } +} diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/_Host.cshtml b/src/Features/Blockcore.Features.NodeHost/UI/Pages/_Host.cshtml index e46ad2d3b..4c54a0859 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Pages/_Host.cshtml +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/_Host.cshtml @@ -1,6 +1,7 @@ @page "/" @namespace Blockcore.Features.NodeHost.UI.Pages @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, BlazorModal @{ Layout = null; } diff --git a/src/Features/Blockcore.Features.NodeHost/UI/ServiceCollectionExtension.cs b/src/Features/Blockcore.Features.NodeHost/UI/ServiceCollectionExtension.cs new file mode 100644 index 000000000..02aa68abc --- /dev/null +++ b/src/Features/Blockcore.Features.NodeHost/UI/ServiceCollectionExtension.cs @@ -0,0 +1,13 @@ +using BlazorModal.Services; +using Microsoft.Extensions.DependencyInjection; + +namespace BlazorModal +{ + public static class ServiceCollectionExtensions + { + public static IServiceCollection AddBlazorModal(this IServiceCollection services) + { + return services.AddScoped(); + } + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Shared/MainLayout.razor b/src/Features/Blockcore.Features.NodeHost/UI/Shared/MainLayout.razor index 3fda61f89..dcf545a77 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Shared/MainLayout.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/Shared/MainLayout.razor @@ -1,5 +1,6 @@ @inherits LayoutComponentBase + @@ -11,7 +12,7 @@ @* *@ diff --git a/src/Features/Blockcore.Features.NodeHost/UI/_Imports.razor b/src/Features/Blockcore.Features.NodeHost/UI/_Imports.razor index 29e85b0da..96f2017c1 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/_Imports.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/_Imports.razor @@ -5,4 +5,6 @@ @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web @using Microsoft.JSInterop -@using Blockcore.Features.NodeHost.UI.Shared \ No newline at end of file +@using Blockcore.Features.NodeHost.UI.Shared +@using BlazorModal +@using BlazorModal.Services \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/wwwroot/css/site.css b/src/Features/Blockcore.Features.NodeHost/UI/wwwroot/css/site.css index 2f22560a1..b94c6f746 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/wwwroot/css/site.css +++ b/src/Features/Blockcore.Features.NodeHost/UI/wwwroot/css/site.css @@ -180,4 +180,57 @@ app { /* Never collapse the sidebar for wide screens */ display: block; } +} +.bm-container { + display: none; + align-items: center; + justify-content: center; + position: fixed; + width: 100%; + height: 100%; + z-index: 2; +} + +.bm-overlay { + display: block; + position: fixed; + width: 100%; + height: 100%; + z-index: 3; + background-color: rgba(0,0,0,0.5); +} + +.bm-active { + display: flex; +} + +.blazor-modal { + display: flex; + flex-direction: column; + width: 50rem; + background-color:#303030; + border-radius: 4px; + border: 1px solid rgba(0, 0, 0, 0.125); + padding: 1.5rem; + z-index: 4; +} + +.bm-header { + display: flex; + align-items: flex-start; + justify-content: space-between; + padding: 0 0 2rem 0; +} + +.bm-title { + margin-bottom: 0; +} + +.bm-close { + padding: 1rem; + margin: -1rem -1rem -1rem auto; + background-color: transparent; + border: 0; + -webkit-appearance: none; + cursor: pointer; } \ No newline at end of file From f9292e0cb53767cf8ef9d9e6bb04e8f0adfa2381 Mon Sep 17 00:00:00 2001 From: Hunter Date: Sun, 7 Jun 2020 13:27:28 +0100 Subject: [PATCH 02/10] Add error message --- .../UI/Pages/AddNode.razor | 19 ++++++------------- .../UI/Pages/Index.razor | 1 - 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor b/src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor index 6acd254ea..a37610396 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/AddNode.razor @@ -11,16 +11,14 @@ +
+
+ @Alert +
+
- } -else -{ - -} @code { bool ShowForm { get; set; } = true; @@ -29,16 +27,11 @@ else private void Addnode() { - ShowForm = false; - if (string.IsNullOrEmpty(this.NodeIp)) { this.Alert = "Please enter an IP address"; return; } this.Alert = string.Empty; - var endpoint = this.NodeIp.ToIPEndPoint(this.ConnectionManager.Network.DefaultPort); - this.ConnectionManager.AddNodeAddress(endpoint); - - this.Alert = $"node {endpoint} added"; + this.Alert = $"Added Node: {endpoint}"; } diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor index 4db71c7af..d9b709dc2 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor @@ -168,7 +168,6 @@ - } @code From 025b6a386b779ae95ce65c23360e97b1e5c4bd11 Mon Sep 17 00:00:00 2001 From: Hunter Date: Mon, 8 Jun 2020 18:37:12 +0100 Subject: [PATCH 03/10] move the code for blazor modal to its own feature --- .../UI => Blockcore/UI/BlazorModal}/Modal.razor | 2 +- .../UI => Blockcore/UI/BlazorModal}/Modal.razor.cs | 0 .../UI => Blockcore/UI/BlazorModal}/ModalService.cs | 0 .../UI/BlazorModal}/ServiceCollectionExtension.cs | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename src/{Features/Blockcore.Features.NodeHost/UI => Blockcore/UI/BlazorModal}/Modal.razor (93%) rename src/{Features/Blockcore.Features.NodeHost/UI => Blockcore/UI/BlazorModal}/Modal.razor.cs (100%) rename src/{Features/Blockcore.Features.NodeHost/UI => Blockcore/UI/BlazorModal}/ModalService.cs (100%) rename src/{Features/Blockcore.Features.NodeHost/UI => Blockcore/UI/BlazorModal}/ServiceCollectionExtension.cs (100%) diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Modal.razor b/src/Blockcore/UI/BlazorModal/Modal.razor similarity index 93% rename from src/Features/Blockcore.Features.NodeHost/UI/Modal.razor rename to src/Blockcore/UI/BlazorModal/Modal.razor index 90620da59..2362fc33c 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Modal.razor +++ b/src/Blockcore/UI/BlazorModal/Modal.razor @@ -1,4 +1,4 @@ -@inherits BlazorModal.ModalBase +@inherits ModalBase
diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Modal.razor.cs b/src/Blockcore/UI/BlazorModal/Modal.razor.cs similarity index 100% rename from src/Features/Blockcore.Features.NodeHost/UI/Modal.razor.cs rename to src/Blockcore/UI/BlazorModal/Modal.razor.cs diff --git a/src/Features/Blockcore.Features.NodeHost/UI/ModalService.cs b/src/Blockcore/UI/BlazorModal/ModalService.cs similarity index 100% rename from src/Features/Blockcore.Features.NodeHost/UI/ModalService.cs rename to src/Blockcore/UI/BlazorModal/ModalService.cs diff --git a/src/Features/Blockcore.Features.NodeHost/UI/ServiceCollectionExtension.cs b/src/Blockcore/UI/BlazorModal/ServiceCollectionExtension.cs similarity index 100% rename from src/Features/Blockcore.Features.NodeHost/UI/ServiceCollectionExtension.cs rename to src/Blockcore/UI/BlazorModal/ServiceCollectionExtension.cs From 77790fe517e8d41f175828c38bbae6419b896a48 Mon Sep 17 00:00:00 2001 From: Hunter Date: Tue, 9 Jun 2020 17:41:51 +0100 Subject: [PATCH 04/10] Fix modal --- .../UI/Shared/Modal.razor | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor b/src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor new file mode 100644 index 000000000..2362fc33c --- /dev/null +++ b/src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor @@ -0,0 +1,19 @@ +@inherits ModalBase + +
+ +
+ +
+
+

@Title

+ +
+
+ @Content +
+
+ +
\ No newline at end of file From 36d410e87912e98349573b08c2103621e96487da Mon Sep 17 00:00:00 2001 From: Hunter Date: Wed, 10 Jun 2020 10:25:33 +0100 Subject: [PATCH 05/10] Add refresh button --- src/Blockcore/UI/BlazorModal/Modal.razor | 19 ------------------- .../UI/Pages/Logs.razor | 8 ++++++++ 2 files changed, 8 insertions(+), 19 deletions(-) delete mode 100644 src/Blockcore/UI/BlazorModal/Modal.razor diff --git a/src/Blockcore/UI/BlazorModal/Modal.razor b/src/Blockcore/UI/BlazorModal/Modal.razor deleted file mode 100644 index 2362fc33c..000000000 --- a/src/Blockcore/UI/BlazorModal/Modal.razor +++ /dev/null @@ -1,19 +0,0 @@ -@inherits ModalBase - -
- -
- -
-
-

@Title

- -
-
- @Content -
-
- -
\ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor index d0b000de8..3319e59df 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor @@ -5,6 +5,7 @@

Node Logs

+
@@ -12,4 +13,11 @@
 @(((Blockcore.FullNode)this.FullNode).LastLogOutput.TrimStart(' '))
 
+} + +@code { + private async Task ReloadPage() + { + + } } \ No newline at end of file From fee81e60ea6d8dd3f14fb96f1c0ab77e6109b005 Mon Sep 17 00:00:00 2001 From: Hunter Date: Wed, 10 Jun 2020 11:12:18 +0100 Subject: [PATCH 06/10] Lay foundations for tx details --- .../UI/Pages/ColdStake.razor | 2 +- .../UI/Pages/ColdStakeView.razor | 11 ++++++--- .../UI/Pages/ViewTransaction.razor | 13 +++++++++++ .../UI/_Imports.razor | 4 +++- .../UI/Pages/Index.razor | 1 + .../UI/Pages/Logs.razor | 2 +- .../UI/Pages/ViewTransaction.razor | 13 +++++++++++ .../UI/Pages/WalletAccount.razor | 23 ++++++++----------- .../UI/Pages/Wallets.razor | 9 ++++---- .../UI/_Imports.razor | 4 +++- 10 files changed, 56 insertions(+), 26 deletions(-) create mode 100644 src/Features/Blockcore.Features.ColdStaking/UI/Pages/ViewTransaction.razor create mode 100644 src/Features/Blockcore.Features.Wallet/UI/Pages/ViewTransaction.razor diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStake.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStake.razor index 2c84cafb0..cbbc4587f 100644 --- a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStake.razor +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStake.razor @@ -120,7 +120,7 @@ } } - + } diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor index 1bf5d437c..04361c047 100644 --- a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor @@ -8,6 +8,7 @@ @inject NavigationManager NavigationManager @inject IWalletManager WalletManager @inject Network Network +@inject ModalService ModalService @{ @@ -77,6 +78,7 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle DATE/TIME AMOUNT BLOCK + DETAILS @@ -84,11 +86,14 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle { foreach (var transaction in history.TransactionsHistory) { - @* @onclick="() => { NavigateToViewTx(transaction.Id); }" *@ + @transaction.Type @String.Format("{0:f}", transaction.Timestamp) @transaction.Amount @transaction.ConfirmedInBlock + + + } } @@ -126,8 +131,8 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle NavigationManager.NavigateTo("coldstaking-delegate/" + walletName); } - private void NavigateToViewTx(uint256 txId) + private void ViewTransaction() { - NavigationManager.NavigateTo("coldStakeviewtx"); + ModalService.Show("Transaction Details", typeof(ViewTransaction)); } } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ViewTransaction.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ViewTransaction.razor new file mode 100644 index 000000000..7a7013a81 --- /dev/null +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ViewTransaction.razor @@ -0,0 +1,13 @@ +@if (ShowForm) +{ + +} + +@code +{ + bool ShowForm { get; set; } = true; + private void SubmitForm() + { + ShowForm = false; + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/_Imports.razor b/src/Features/Blockcore.Features.ColdStaking/UI/_Imports.razor index c3615efc7..b71f70d0c 100644 --- a/src/Features/Blockcore.Features.ColdStaking/UI/_Imports.razor +++ b/src/Features/Blockcore.Features.ColdStaking/UI/_Imports.razor @@ -1 +1,3 @@ -@using Microsoft.AspNetCore.Components.Web \ No newline at end of file +@using Microsoft.AspNetCore.Components.Web +@using BlazorModal +@using BlazorModal.Services \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor index d9b709dc2..4565233e5 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor @@ -141,6 +141,7 @@
+

Peers

diff --git a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor index 3319e59df..ab9af0dbf 100644 --- a/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor +++ b/src/Features/Blockcore.Features.NodeHost/UI/Pages/Logs.razor @@ -5,7 +5,7 @@

Node Logs

- +
diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/ViewTransaction.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/ViewTransaction.razor new file mode 100644 index 000000000..7a7013a81 --- /dev/null +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/ViewTransaction.razor @@ -0,0 +1,13 @@ +@if (ShowForm) +{ + +} + +@code +{ + bool ShowForm { get; set; } = true; + private void SubmitForm() + { + ShowForm = false; + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletAccount.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletAccount.razor index 9d5dfa56f..5bf4058e0 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletAccount.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletAccount.razor @@ -8,6 +8,7 @@ @inject NavigationManager NavigationManager @inject IWalletManager WalletManager @inject Network Network +@inject ModalService ModalService @{ var accountBalance = this.WalletManager.GetBalances(walletname, accountname).Single(); @@ -57,6 +58,7 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle + @@ -64,11 +66,14 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle { foreach (var transaction in history.TransactionsHistory) { - @*@onclick="() => { NavigateToViewTx(transaction.Id); }" > *@ - + + + } } @@ -80,31 +85,21 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle } - @code { - [Parameter] public string walletname { get; set; } [Parameter] public string accountname { get; set; } - private void NavigateToReceiveWallet(string walletName, string accountname) { NavigationManager.NavigateTo("walletreceive/" + walletName + "/" + accountname); } - private void NavigateToSendWallet(string walletName, string accountname) { NavigationManager.NavigateTo("walletsend/" + walletName + "/" + accountname); } - - private void NavigateToWallets() - { - NavigationManager.NavigateTo("wallets"); - } - - private void NavigateToViewTx(uint256 txId) + private void ViewTransaction() { - NavigationManager.NavigateTo("coldStakeviewtx"); + ModalService.Show("Transaction Details", typeof(ViewTransaction)); } } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor index e8624c9e8..fc77aca43 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor @@ -78,7 +78,6 @@

Balances

-
DATE/TIME AMOUNT BLOCKDETAILS
@transaction.Type
@transaction.Type @String.Format("{0:f}", transaction.Timestamp) @transaction.Amount @transaction.ConfirmedInBlock + +
@@ -100,10 +99,10 @@ - - + + } } } diff --git a/src/Features/Blockcore.Features.Wallet/UI/_Imports.razor b/src/Features/Blockcore.Features.Wallet/UI/_Imports.razor index c3615efc7..b71f70d0c 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/_Imports.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/_Imports.razor @@ -1 +1,3 @@ -@using Microsoft.AspNetCore.Components.Web \ No newline at end of file +@using Microsoft.AspNetCore.Components.Web +@using BlazorModal +@using BlazorModal.Services \ No newline at end of file From 5aafa05c26e3272b327f0291086fbbe6b6134a4b Mon Sep 17 00:00:00 2001 From: Hunter Date: Wed, 10 Jun 2020 15:22:49 +0100 Subject: [PATCH 07/10] Add wallet selection dropdown --- .../UI/Dropdown.razor | 33 +++++++++++++++++++ .../UI/DropdownListItem.razor | 12 +++++++ .../UI/Pages/ColdStakeEnableWallet.razor | 1 - .../UI/Pages/ColdStakeView.razor | 32 ++++++++++++++++-- .../UI/Dropdown.razor | 33 +++++++++++++++++++ .../UI/DropdownListItem.razor | 12 +++++++ .../UI/Pages/WalletReceive.razor | 27 +++++++++++++-- .../UI/Pages/WalletSend.razor | 24 +++++++++++++- .../{WalletAccount.razor => WalletView.razor} | 27 +++++++++++++-- .../UI/Pages/Wallets.razor | 2 +- 10 files changed, 192 insertions(+), 11 deletions(-) create mode 100644 src/Features/Blockcore.Features.ColdStaking/UI/Dropdown.razor create mode 100644 src/Features/Blockcore.Features.ColdStaking/UI/DropdownListItem.razor create mode 100644 src/Features/Blockcore.Features.Wallet/UI/Dropdown.razor create mode 100644 src/Features/Blockcore.Features.Wallet/UI/DropdownListItem.razor rename src/Features/Blockcore.Features.Wallet/UI/Pages/{WalletAccount.razor => WalletView.razor} (82%) diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Dropdown.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Dropdown.razor new file mode 100644 index 000000000..a6ee2c3fd --- /dev/null +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Dropdown.razor @@ -0,0 +1,33 @@ +@typeparam TItem + + +@code { + [Parameter] + public RenderFragment InitialTip{get;set;} + [Parameter] + public RenderFragment ChildContent{get;set;} + [Parameter] + public EventCallback OnSelected {get;set;} + + private bool show = false; + private RenderFragment Tip ; + + protected override void OnInitialized(){ this.Tip = InitialTip; } + public async Task HandleSelect(TItem item, RenderFragment contentFragment) + { + this.Tip= contentFragment.Invoke(item); + this.show=false; + StateHasChanged(); + await this.OnSelected.InvokeAsync(item); + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/DropdownListItem.razor b/src/Features/Blockcore.Features.ColdStaking/UI/DropdownListItem.razor new file mode 100644 index 000000000..0979f10a3 --- /dev/null +++ b/src/Features/Blockcore.Features.ColdStaking/UI/DropdownListItem.razor @@ -0,0 +1,12 @@ +@typeparam TItem +@ChildContent(Item) + +@code { + [CascadingParameter(Name="Dropdown")] + public Dropdown Dropdown {get;set;} + + [Parameter] + public TItem Item{get;set;} + [Parameter] + public RenderFragment ChildContent {get;set;} +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeEnableWallet.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeEnableWallet.razor index 48c20286a..06a93a3b5 100644 --- a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeEnableWallet.razor +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeEnableWallet.razor @@ -3,7 +3,6 @@ @using Blockcore.Features.ColdStaking @using Blockcore.Features.Wallet.Interfaces @using Blockcore.Base.Deployments -@using NBitcoin; @inject IWalletManager WalletManager @inject NavigationManager NavigationManager diff --git a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor index 04361c047..ffcda5d29 100644 --- a/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor +++ b/src/Features/Blockcore.Features.ColdStaking/UI/Pages/ColdStakeView.razor @@ -11,10 +11,22 @@ @inject ModalService ModalService @{ -
-

Cold Staking - @walletname

+

Cold Staking

+ + @walletname + + @{ + foreach (var walletName in this.WalletManager.GetWalletsNames()) { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + @walletName + } + } + } + + + + + +
+ +@code { + [Parameter] + public RenderFragment InitialTip{get;set;} + [Parameter] + public RenderFragment ChildContent{get;set;} + [Parameter] + public EventCallback OnSelected {get;set;} + + private bool show = false; + private RenderFragment Tip ; + + protected override void OnInitialized(){ this.Tip = InitialTip; } + public async Task HandleSelect(TItem item, RenderFragment contentFragment) + { + this.Tip= contentFragment.Invoke(item); + this.show=false; + StateHasChanged(); + await this.OnSelected.InvokeAsync(item); + } +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/DropdownListItem.razor b/src/Features/Blockcore.Features.Wallet/UI/DropdownListItem.razor new file mode 100644 index 000000000..0979f10a3 --- /dev/null +++ b/src/Features/Blockcore.Features.Wallet/UI/DropdownListItem.razor @@ -0,0 +1,12 @@ +@typeparam TItem +@ChildContent(Item) + +@code { + [CascadingParameter(Name="Dropdown")] + public Dropdown Dropdown {get;set;} + + [Parameter] + public TItem Item{get;set;} + [Parameter] + public RenderFragment ChildContent {get;set;} +} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletReceive.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletReceive.razor index 79c76b37a..a47066ed9 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletReceive.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletReceive.razor @@ -7,15 +7,27 @@ @inject IWalletManager WalletManager @inject NavigationManager NavigationManager +@{
-

Receive to @walletname

+

Receive

+ + @walletname + + @{ + foreach (var walletName in this.WalletManager.GetWalletsNames()) { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + @walletName + } + } + } + +
-@{ var result = this.WalletManager.GetUnusedAddress(new WalletAccountReference(walletname, accountname)); -
@@ -46,4 +58,13 @@ var result = this.WalletManager.GetUnusedAddress(new WalletAccountReference(wall public string walletname { get; set; } [Parameter] public string accountname { get; set; } + private void NavigateToReceiveWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletreceive/" + walletName + "/" + accountname); + } + private void OnSelected(string selection) + { + Console.WriteLine(selection); + NavigateToReceiveWallet(selection,"account 0"); + } } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor index ff395abb2..303c26fac 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor @@ -16,8 +16,21 @@ @{
-

Send coins from @walletname

+

Send coins

+ + @walletname + + @{ + foreach (var walletName in this.WalletManager.GetWalletsNames()) { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + @walletName + } + } + } + +
@@ -285,4 +298,13 @@ { NavigationManager.NavigateTo("walletbroadcasttx/" + walletName + "/" + accountname); } + private void NavigateToSendWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletsend/" + walletName + "/" + accountname); + } + private void OnSelected(string selection) + { + Console.WriteLine(selection); + NavigateToSendWallet(selection,"account 0"); + } } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletAccount.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletView.razor similarity index 82% rename from src/Features/Blockcore.Features.Wallet/UI/Pages/WalletAccount.razor rename to src/Features/Blockcore.Features.Wallet/UI/Pages/WalletView.razor index 5bf4058e0..c24875a0d 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletAccount.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletView.razor @@ -1,4 +1,4 @@ -@page "/walletaccount/{walletname}/{accountname}" +@page "/walletview/{walletname}/{accountname}" @using Blockcore.Features.Wallet.Interfaces @using NBitcoin; @@ -14,8 +14,21 @@ var accountBalance = this.WalletManager.GetBalances(walletname, accountname).Single();
-

Wallet - @walletname

+

Wallet

+ + @walletname + + @{ + foreach (var walletName in this.WalletManager.GetWalletsNames()) { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + @walletName + } + } + } + +
@@ -58,13 +61,21 @@ var result = this.WalletManager.GetUnusedAddress(new WalletAccountReference(wall public string walletname { get; set; } [Parameter] public string accountname { get; set; } + private void NavigateToWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletview/" + walletName + "/" + accountname); + } private void NavigateToReceiveWallet(string walletName, string accountname) { NavigationManager.NavigateTo("walletreceive/" + walletName + "/" + accountname); } + private void NavigateToSendWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletsend/" + walletName + "/" + accountname); + } private void OnSelected(string selection) { Console.WriteLine(selection); - NavigateToReceiveWallet(selection,"account 0"); + NavigateToWallet(selection,"account 0"); } } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor index 303c26fac..40be9438a 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor @@ -31,6 +31,9 @@ } +
@@ -298,13 +301,22 @@ { NavigationManager.NavigateTo("walletbroadcasttx/" + walletName + "/" + accountname); } + private void NavigateToWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletview/" + walletName + "/" + accountname); + } + private void NavigateToReceiveWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletreceive/" + walletName + "/" + accountname); + } private void NavigateToSendWallet(string walletName, string accountname) { NavigationManager.NavigateTo("walletsend/" + walletName + "/" + accountname); } + private void OnSelected(string selection) { Console.WriteLine(selection); - NavigateToSendWallet(selection,"account 0"); + NavigateToWallet(selection,"account 0"); } } \ No newline at end of file diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletView.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletView.razor index c24875a0d..6223f0d56 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletView.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/WalletView.razor @@ -30,10 +30,11 @@ var accountBalance = this.WalletManager.GetBalances(walletname, accountname).Sin + Receive + - + Send +
@@ -103,6 +104,10 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle public string walletname { get; set; } [Parameter] public string accountname { get; set; } + private void NavigateToWallet(string walletName, string accountname) + { + NavigationManager.NavigateTo("walletview/" + walletName + "/" + accountname); + } private void NavigateToReceiveWallet(string walletName, string accountname) { NavigationManager.NavigateTo("walletreceive/" + walletName + "/" + accountname); @@ -115,10 +120,6 @@ var model = WalletModelBuilder.GetHistory(this.WalletManager, Network, new Walle { ModalService.Show("Transaction Details", typeof(ViewTransaction)); } - private void NavigateToWallet(string walletName, string accountname) - { - NavigationManager.NavigateTo("walletview/" + walletName + "/" + accountname); - } private void OnSelected(string selection) { Console.WriteLine(selection); From ffa179dd4d6e1ecb374abacf76f4d5b9332da41e Mon Sep 17 00:00:00 2001 From: dangershony Date: Thu, 11 Jun 2020 00:13:50 +0100 Subject: [PATCH 09/10] Move some components to node host --- src/Blockcore/UI/BlazorModal/ModalService.cs | 1 + .../UI/BlazorModal/ServiceCollectionExtension.cs | 13 ------------- .../MvcBuilderExtensions.cs | 6 ++++++ .../UI/Shared}/Modal.razor.cs | 0 4 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 src/Blockcore/UI/BlazorModal/ServiceCollectionExtension.cs rename src/{Blockcore/UI/BlazorModal => Features/Blockcore.Features.NodeHost/UI/Shared}/Modal.razor.cs (100%) diff --git a/src/Blockcore/UI/BlazorModal/ModalService.cs b/src/Blockcore/UI/BlazorModal/ModalService.cs index 333f7d405..2f9ff3412 100644 --- a/src/Blockcore/UI/BlazorModal/ModalService.cs +++ b/src/Blockcore/UI/BlazorModal/ModalService.cs @@ -6,6 +6,7 @@ namespace BlazorModal.Services public class ModalService { public event Action OnShow; + public event Action OnClose; public void Show(string title, Type contentType) diff --git a/src/Blockcore/UI/BlazorModal/ServiceCollectionExtension.cs b/src/Blockcore/UI/BlazorModal/ServiceCollectionExtension.cs deleted file mode 100644 index 02aa68abc..000000000 --- a/src/Blockcore/UI/BlazorModal/ServiceCollectionExtension.cs +++ /dev/null @@ -1,13 +0,0 @@ -using BlazorModal.Services; -using Microsoft.Extensions.DependencyInjection; - -namespace BlazorModal -{ - public static class ServiceCollectionExtensions - { - public static IServiceCollection AddBlazorModal(this IServiceCollection services) - { - return services.AddScoped(); - } - } -} \ No newline at end of file diff --git a/src/Features/Blockcore.Features.NodeHost/MvcBuilderExtensions.cs b/src/Features/Blockcore.Features.NodeHost/MvcBuilderExtensions.cs index 7e7809b0f..b0a1bf3e0 100644 --- a/src/Features/Blockcore.Features.NodeHost/MvcBuilderExtensions.cs +++ b/src/Features/Blockcore.Features.NodeHost/MvcBuilderExtensions.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using BlazorModal.Services; using Blockcore.Builder.Feature; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; @@ -40,5 +41,10 @@ public static IMvcBuilder AddControllers(this IMvcBuilder builder, IEnumerable(); + } } } diff --git a/src/Blockcore/UI/BlazorModal/Modal.razor.cs b/src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor.cs similarity index 100% rename from src/Blockcore/UI/BlazorModal/Modal.razor.cs rename to src/Features/Blockcore.Features.NodeHost/UI/Shared/Modal.razor.cs From 6bdfd6c9bcbd8b86340433e096a0e3968699fbe2 Mon Sep 17 00:00:00 2001 From: dangershony Date: Thu, 11 Jun 2020 00:34:09 +0100 Subject: [PATCH 10/10] Fix wallet sync calculation --- .../UI/Pages/Wallets.razor | 208 +++++++++--------- 1 file changed, 110 insertions(+), 98 deletions(-) diff --git a/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor b/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor index 0165b00dd..2eb1579ba 100644 --- a/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor +++ b/src/Features/Blockcore.Features.Wallet/UI/Pages/Wallets.razor @@ -14,105 +14,115 @@ @inject Blockcore.Interfaces.IInitialBlockDownloadState InitialBlockDownloadState @{ -
-

Wallets

-
- - - - +
+

Wallets

+
+ + + + +
-
-
-
-
-
-
Main Balance
-
-
-
-

@totalBalance()

-

@this.Network.CoinTicker.ToUpper()

+
+
+
+
+
Main Balance
+
+
+
+

@totalBalance()

+

@this.Network.CoinTicker.ToUpper()

+
+
@totalUnconfirmedBalance() (unconfirmed)
-
@totalUnconfirmedBalance() (unconfirmed)
-
-
-
-
-
Wallet Status
-
-
-
-

@this.WalletSyncManager.WalletTip.Height / @ChainIndexer.Height

+
+
+
+
Wallet Status
+
+
+
+

@this.WalletSyncManager.WalletTip.Height / @ChainIndexer.Height

+
+
+
+
+ @if (InSync() < 100) + { + + } + else + { + + } +
-
-
- @if (InSync()<100) { - - } else { - - } -
-
-
- @if (InSync()<100) { -
Syncing - @InSync()%
- } else { + @if (InSync() < 100) + { +
Syncing - @InSync()%
+ } + else + {
Synced
- } + } +
-
-
-
-
-
-

Balances

-
-
@walletName @accountBalance.AmountConfirmed @accountBalance.AmountUnconfirmed
+ +
- - - - - - - - - - @{ - foreach (var walletName in this.WalletManager.GetWalletsNames()) - { - foreach (var account in this.WalletManager.GetAccounts(walletName)) +
+
+
+
+

Balances

+
+
WALLETCONFIRMED BALANCEUNCONFIRMED BALANCEDETAILS
+ + + + + + + + + + @{ + foreach (var walletName in this.WalletManager.GetWalletsNames()) { - var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); - - - - - - + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); + + + + + + + } } } - } - -
WALLETCONFIRMED BALANCEUNCONFIRMED BALANCEDETAILS
@walletName@accountBalance.AmountConfirmed@accountBalance.AmountUnconfirmed - -
@walletName@accountBalance.AmountConfirmed@accountBalance.AmountUnconfirmed + +
+ + +
- } @code { @@ -163,36 +173,38 @@ private dynamic totalBalance() { dynamic balance = 0; - foreach (var walletName in this.WalletManager.GetWalletsNames()) - { - foreach (var account in this.WalletManager.GetAccounts(walletName)) - { - var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); - balance = balance + accountBalance.AmountConfirmed; - } - } + foreach (var walletName in this.WalletManager.GetWalletsNames()) + { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); + balance = balance + accountBalance.AmountConfirmed; + } + } return balance; } private dynamic totalUnconfirmedBalance() { dynamic balance = 0; - foreach (var walletName in this.WalletManager.GetWalletsNames()) - { - foreach (var account in this.WalletManager.GetAccounts(walletName)) - { - var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); - balance = balance + accountBalance.AmountUnconfirmed; - } - } + foreach (var walletName in this.WalletManager.GetWalletsNames()) + { + foreach (var account in this.WalletManager.GetAccounts(walletName)) + { + var accountBalance = this.WalletManager.GetBalances(walletName, account.Name).Single(); + balance = balance + accountBalance.AmountUnconfirmed; + } + } return balance; } private dynamic InSync() { + decimal wt = (decimal)this.WalletSyncManager.WalletTip.Height; + decimal ct = (decimal)this.ChainIndexer.Height; + dynamic syncPercent = 0; - syncPercent = (this.WalletSyncManager.WalletTip.Height / this.ChainIndexer.Height) * 100; + syncPercent = (int)(((decimal)wt / (decimal)ct) * 100); return syncPercent; } - } \ No newline at end of file