From aefa631ff3f648060f5c0fe5d51aee89e3898a85 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 9 Feb 2021 22:55:40 -0500 Subject: Discord RPC; About window --- Erable/Program.cs | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'Erable/Program.cs') diff --git a/Erable/Program.cs b/Erable/Program.cs index f461a79..9999bee 100644 --- a/Erable/Program.cs +++ b/Erable/Program.cs @@ -1,6 +1,5 @@ using System; using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; using Avalonia.ReactiveUI; namespace Erable @@ -13,13 +12,29 @@ namespace Erable public static void Main(string[] args) { Console.WriteLine("Erable: Audio Player by Alee Productions"); - Console.WriteLine("Running on .NET " + Environment.Version + ", and " + Environment.OSVersion); + + AppDomain.CurrentDomain.UnhandledException += ErrorHandler; + #if DEBUG - Console.WriteLine("Opening MainWindow..."); + Console.WriteLine("Running on .NET " + Environment.Version + ", and " + Environment.OSVersion); + Console.WriteLine("Opening window..."); #endif - try { BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); }catch (Exception ex) { Console.WriteLine(ex); } - } + + DiscordRpc.Initialize(); + + BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); + + } + static void ErrorHandler(object sender, UnhandledExceptionEventArgs e) + { + Console.WriteLine("Oh no! An error has occurred!"); + Console.WriteLine("OS Version: " + Environment.OSVersion); + Console.WriteLine(".NET Version: " + Environment.Version); + Console.WriteLine("Report this to the developers..."); + Console.WriteLine("Did this crashed? " + e.IsTerminating); + } + // Avalonia configuration, don't remove; also used by visual designer. static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() -- cgit v1.2.3