58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
using Avalonia;
|
|
using Avalonia.Controls.ApplicationLifetimes;
|
|
using Avalonia.Styling;
|
|
using Avalonia.Themes.Fluent;
|
|
|
|
namespace Strata.Desktop;
|
|
|
|
internal static class Program
|
|
{
|
|
[STAThread]
|
|
public static int Main(string[] args)
|
|
{
|
|
try
|
|
{
|
|
if (args is ["--self-check-worker"])
|
|
{
|
|
try { CoreClient.WorkerSelfCheck().GetAwaiter().GetResult(); return 0; }
|
|
catch (Exception e) { Console.Error.WriteLine(e.Message); return 1; }
|
|
}
|
|
if (args is ["--self-check-tunnel-reconnect"])
|
|
{
|
|
try { CoreClient.ReconnectSelfCheck(false).GetAwaiter().GetResult(); return 0; }
|
|
catch (Exception e) { Console.Error.WriteLine(e.Message); return 1; }
|
|
}
|
|
if (args is ["--self-check-reconnect"])
|
|
{
|
|
try { CoreClient.ReconnectSelfCheck().GetAwaiter().GetResult(); return 0; }
|
|
catch (Exception e) { Console.Error.WriteLine(e.Message); return 1; }
|
|
}
|
|
if (args is ["--self-check"])
|
|
{
|
|
try { CoreClient.SelfCheck().GetAwaiter().GetResult(); return 0; }
|
|
catch (Exception e) { Console.Error.WriteLine(e.Message); return 1; }
|
|
}
|
|
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
|
return 0;
|
|
}
|
|
finally { CoreClient.Close(); }
|
|
}
|
|
public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>().UsePlatformDetect();
|
|
}
|
|
|
|
public sealed class App : Application
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
Name = "Strata";
|
|
RequestedThemeVariant = ThemeVariant.Dark;
|
|
Styles.Add(new FluentTheme());
|
|
}
|
|
public override void OnFrameworkInitializationCompleted()
|
|
{
|
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
|
desktop.MainWindow = new MainWindow();
|
|
base.OnFrameworkInitializationCompleted();
|
|
}
|
|
}
|