about summary refs log tree commit diff
path: root/MatrixUtils.Desktop/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixUtils.Desktop/Program.cs')
-rw-r--r--MatrixUtils.Desktop/Program.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/MatrixUtils.Desktop/Program.cs b/MatrixUtils.Desktop/Program.cs
new file mode 100644
index 0000000..0f4c09c
--- /dev/null
+++ b/MatrixUtils.Desktop/Program.cs
@@ -0,0 +1,33 @@
+using Avalonia;
+using Microsoft.Extensions.Hosting;
+using Tmds.DBus.Protocol;
+
+namespace MatrixUtils.Desktop;
+
+internal class Program {
+    private static IHost appHost;
+    // Initialization code. Don't use any Avalonia, third-party APIs or any
+    // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
+    // yet and stuff might break.
+    // [STAThread]
+    public static Task Main(string[] args) {
+        try {
+            BuildAvaloniaApp()
+                .StartWithClassicDesktopLifetime(args);
+        }
+        catch (DBusException e) { }
+        catch (Exception e) {
+            Console.WriteLine(e);
+            throw;
+        }
+
+        return Task.CompletedTask;
+    }
+
+    // Avalonia configuration, don't remove; also used by visual designer.
+    public static AppBuilder BuildAvaloniaApp()
+        => AppBuilder.Configure<App>()
+            .UsePlatformDetect()
+            .WithInterFont()
+            .LogToTrace();
+}