Display error message box on UI thread

This commit is contained in:
Stone_Red
2026-01-13 23:23:39 +01:00
parent 92ecd2e93d
commit c4517fb8ac
@@ -221,13 +221,16 @@ public partial class PluginWindow : Window, IPluginWindow
catch (Exception ex) catch (Exception ex)
{ {
App.Logger.LogError($"\"{PluginMetadata.Name}\" - {ex}", source: "Plugin"); App.Logger.LogError($"\"{PluginMetadata.Name}\" - {ex}", source: "Plugin");
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox _ = await Dispatcher.InvokeAsync(async () =>
{ {
Title = $"Error \"{PluginMetadata.Name}\"", Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
Content = "File execution error:\n" + ex, {
CloseButtonText = "Ok" Title = $"Error \"{PluginMetadata.Name}\"",
}; Content = "File execution error:\n" + ex,
_ = await messageBox.ShowDialogAsync(); CloseButtonText = "Ok"
};
_ = await messageBox.ShowDialogAsync();
});
Exit(); Exit();
return; return;
} }