Files

43 lines
1.2 KiB
C#
Raw Permalink Normal View History

2024-01-04 16:27:14 +00:00
using System;
using Avalonia;
2024-01-01 11:57:46 +00:00
using Velopack;
namespace CSharpAvalonia;
2024-01-01 11:57:46 +00:00
class Program
{
2025-03-12 22:02:47 +00:00
public static MemoryLogger Log { get; private set; } = new();
2024-01-01 11:57:46 +00:00
// 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)
{
try {
// It's important to Run() the VelopackApp as early as possible in app startup.
VelopackApp.Build()
.OnFirstRun((v) => { /* Your first run code here */ })
2025-03-12 22:02:47 +00:00
.SetLogger(Log)
.Run();
// Now it's time to run Avalonia
2024-03-14 18:37:39 +00:00
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
} catch (Exception ex) {
string message = "Unhandled exception: " + ex.ToString();
Console.WriteLine(message);
throw;
}
2024-01-01 11:57:46 +00:00
}
// Avalonia configuration, don't remove method; also used by visual designer.
2024-01-01 11:57:46 +00:00
public static AppBuilder BuildAvaloniaApp()
{
return AppBuilder.Configure<App>()
2024-01-01 11:57:46 +00:00
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
}
2024-01-01 11:57:46 +00:00
}