Files
UVtools/UVtools.WPF/Program.cs
T
Tiago Conceição 5da3c7e173 v1.1.3
* (Add) Auto-updater: When a new version is detected UVtools still show the same green button at top,
on click, it will prompt for auto or manual update.
On Linux and Mac the script will kill all UVtools instances and auto-upgrade.
On Windows the user must close all instances and continue with the shown MSI installation
* (Add) Tool profiles: Create and remove named presets for some tools
* (Add) Event handler for handling non-UI thread exceptions
* (Fix) Mac: File - Open in a new window was not working
* (Fix) Tool - Rotate: Allow negative angles
* (Fix) Tool - Rotate: The operation was inverting the angle
* (Fix) Tools: Select normal layers can crash the program with small files with low layer count, eg: 3 layers total
2020-11-05 18:27:44 +00:00

57 lines
2.0 KiB
C#

using System;
using System.Diagnostics;
using Avalonia;
using Avalonia.Threading;
using UVtools.WPF.Extensions;
namespace UVtools.WPF
{
public static class Program
{
public static string[] Args;
public static Stopwatch ProgramStartupTime;
// 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 void Main(string[] args)
{
ProgramStartupTime = Stopwatch.StartNew();
Args = args;
// Add the event handler for handling non-UI thread exceptions to the event.
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
}
private static async void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
try
{
Exception ex = (Exception)e.ExceptionObject;
string errorMsg = "An application error occurred. Please contact the administrator with the following information:\n\n" +
$"{ex}";
await App.MainWindow.MessageBoxError(errorMsg, "Fatal Non-UI Error");
}
catch (Exception exc)
{
}
}
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new Win32PlatformOptions { AllowEglInitialization = true})
.With(new X11PlatformOptions { UseGpu = true, UseEGL = true })
.With(new MacOSPlatformOptions { ShowInDock = true })
.With(new AvaloniaNativePlatformOptions { UseGpu = true })
.UseSkia()
.LogToDebug();
}
}