Desktop foundation / core (ubuntu-latest) (push) Failing after 28s
Desktop foundation / core (macos-latest) (push) Canceled after 0s
Desktop foundation / core (windows-latest) (push) Canceled after 0s
Linux / verify (push) Canceled after 0s
Linux / keyless-cuda (push) Canceled after 0s
Linux / static-cuda-package (push) Canceled after 0s
Linux / hosted-cuda-package (push) Canceled after 0s
Linux / linux-static-cli (push) Canceled after 0s
Linux / linux-cli-container (push) Canceled after 0s
Linux / release-cli (push) Canceled after 0s
64 lines
2.2 KiB
C#
64 lines
2.2 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-connection", var profile])
|
|
{
|
|
try { CoreClient.ConnectionSelfCheck(profile).GetAwaiter().GetResult(); return 0; }
|
|
catch (Exception e) { Console.Error.WriteLine(e.Message); return 1; }
|
|
}
|
|
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 = Environment.GetEnvironmentVariable("STRATA_NODE_ENDPOINT") != null
|
|
? new MainWindow() : new ConnectionWindow(desktop);
|
|
base.OnFrameworkInitializationCompleted();
|
|
}
|
|
}
|