Skip to content
Merged
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
21 changes: 12 additions & 9 deletions Daybreak/Views/App.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,22 +307,25 @@ private async void OnThemeChange()
/*
* Below code hooks into the webview to set the trade chat theme based on the current application theme.
*/
if (Global.CoreWebView2 is null)
await this.blazorHostWindow.Dispatcher.InvokeAsync(async () =>
{
return;
}
if (Global.CoreWebView2 is null)
{
return;
}

if (this.tradeChatThemeSetterScript is not null)
{
Global.CoreWebView2.RemoveScriptToExecuteOnDocumentCreated(this.tradeChatThemeSetterScript);
this.tradeChatThemeSetterScript = default;
}
if (this.tradeChatThemeSetterScript is not null)
{
Global.CoreWebView2.RemoveScriptToExecuteOnDocumentCreated(this.tradeChatThemeSetterScript);
this.tradeChatThemeSetterScript = default;
}

this.tradeChatThemeSetterScript = await Global.CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync(@$"
this.tradeChatThemeSetterScript = await Global.CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync(@$"
if (location.origin === 'https://kamadan.gwtoolbox.com' ||
location.origin === 'https://ascalon.gwtoolbox.com') {{
localStorage.setItem('mode', '{(this.themeManager.CurrentTheme?.Mode is LightDarkMode.Light ? "light" : "dark")}');
}}");
});
}

private void LoadMenuCategories()
Expand Down
Loading