Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Mar 28, 2024
1 parent ae91076 commit df97c45
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions LightBulb/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Reflection;
using System.Threading;
using Avalonia;
using LightBulb.Utils;

namespace LightBulb;

Expand Down Expand Up @@ -46,6 +47,13 @@ out var isOnlyRunningInstance
{
return builder.StartWithClassicDesktopLifetime(args);
}
catch (Exception ex)
{
if (OperatingSystem.IsWindows())
_ = NativeMethods.Windows.MessageBox(0, ex.ToString(), "Fatal Error", 0x10);

throw;
}
finally
{
// Clean up after application shutdown
Expand Down
12 changes: 12 additions & 0 deletions LightBulb/Utils/NativeMethods.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Runtime.InteropServices;

namespace LightBulb.Utils;

internal static class NativeMethods
{
public static class Windows
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int MessageBox(nint hWnd, string text, string caption, uint type);
}
}

0 comments on commit df97c45

Please sign in to comment.