Skip to content

Commit 14c39cf

Browse files
committed
Added ElectronBootstrap method to Startup.cs.
1 parent a91597d commit 14c39cf

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

WebFrontend/.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"electronnet.cli": {
6+
"version": "11.5.1",
7+
"commands": [
8+
"electronize"
9+
]
10+
}
11+
}
12+
}

WebFrontend/Startup.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using CryptoStatsSource;
55
using Database;
66
using ElectronNET.API;
7+
using ElectronNET.API.Entities;
78
using MatBlazor;
89
using Microsoft.AspNetCore.Builder;
910
using Microsoft.AspNetCore.Hosting;
@@ -89,7 +90,24 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
8990
endpoints.MapBlazorHub();
9091
endpoints.MapFallbackToPage("/_Host");
9192
});
92-
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
93+
94+
if (HybridSupport.IsElectronActive)
95+
{
96+
ElectronBootstrap();
97+
}
98+
}
99+
100+
public async void ElectronBootstrap()
101+
{
102+
var url = new BrowserWindowOptions();
103+
url.Show = false;
104+
url.Height = 940;
105+
url.Width = 1152;
106+
var browserWindow = await Electron.WindowManager.CreateWindowAsync(url);
107+
await browserWindow.WebContents.Session.ClearCacheAsync();
108+
browserWindow.RemoveMenu();
109+
browserWindow.OnReadyToShow += () => browserWindow.Show();
110+
browserWindow.SetTitle("Crypto Portfolio Tracker");
93111
}
94112
}
95113
}

0 commit comments

Comments
 (0)