Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,23 @@ public static void Main(string[] args)
settings.IsZoomControlEnabled = false;
settings.AreBrowserAcceleratorKeysEnabled = false;
#endif
bool hasBlazorStarted = false;
blazorWebView.WebView.NavigationCompleted += async delegate
{
if (hasBlazorStarted)
return;
hasBlazorStarted = true;
await blazorWebView.WebView.ExecuteScriptAsync("Blazor.start()");
};

_ = StartBlazor(blazorWebView);
};

form.Controls.Add(blazorWebView);

Application.Run(form);
}

static async Task StartBlazor(BlazorWebView blazorWebView)
{
while (await blazorWebView.WebView.ExecuteScriptAsync("Blazor.start()") is "null")
{
await Task.Yield();
}
}

private static void LogException(object? error)
{
var errorMessage = error?.ToString() ?? "Unknown error";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,22 @@ public static void Main(string[] args)
settings.IsZoomControlEnabled = false;
settings.AreBrowserAcceleratorKeysEnabled = false;
}
blazorWebView.WebView.NavigationCompleted += async delegate
{
await blazorWebView.WebView.ExecuteScriptAsync("Blazor.start()");
};
_ = StartBlazor(blazorWebView);
};

form.Controls.Add(blazorWebView);

Application.Run(form);
}

static async Task StartBlazor(BlazorWebView blazorWebView)
{
while (await blazorWebView.WebView.ExecuteScriptAsync("Blazor.start()") is "null")
{
await Task.Yield();
}
}

private static void LogException(object? error, string reportedBy)
{
if (Services is not null && error is Exception exp)
Expand Down
Loading