Set services in blazor directly instead of routing them through the static resource

This commit is contained in:
Timothy Baldridge 2022-01-20 21:07:41 -07:00
parent 33965286fc
commit 71cbc118d7
2 changed files with 2 additions and 3 deletions

View File

@ -8,8 +8,7 @@
mc:Ignorable="d" mc:Ignorable="d"
Title="MainWindow" Height="750" Width="1200" MinHeight="750" MinWidth="1200"> Title="MainWindow" Height="750" Width="1200" MinHeight="750" MinWidth="1200">
<Grid Background="#121212"> <Grid Background="#121212">
<blazor:BlazorWebView HostPage="wwwroot\index.html" Services="{StaticResource services}" <blazor:BlazorWebView HostPage="wwwroot\index.html" x:Name="BlazorWebView">
x:Name="blazorWebView1">
<blazor:BlazorWebView.RootComponents> <blazor:BlazorWebView.RootComponents>
<blazor:RootComponent Selector="#app" ComponentType="{x:Type local:Main}" /> <blazor:RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
</blazor:BlazorWebView.RootComponents> </blazor:BlazorWebView.RootComponents>

View File

@ -20,8 +20,8 @@ public partial class MainWindow
_logger = logger; _logger = logger;
_loggerProvider = loggerProvider; _loggerProvider = loggerProvider;
_systemParams = systemParams; _systemParams = systemParams;
Resources.Add("services", serviceProvider);
InitializeComponent(); InitializeComponent();
BlazorWebView.Services = serviceProvider;
try try
{ {