-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
38 lines (31 loc) · 1.13 KB
/
Program.cs
File metadata and controls
38 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#nullable disable
using System.Reactive.Concurrency;
using ReactiveUI.Builder;
using Terminal.Gui.App;
using Terminal.Gui.Configuration;
namespace ReactiveExample;
public static class Program
{
internal static ReactiveUIBuilder _rxApp;
private static async Task Main (string[] args)
{
var smokeTest = args.Length > 0 && args [0] == "--smoke-test";
ConfigurationManager.Enable (ConfigLocations.All);
using IApplication app = Application.Create ();
app.Init ();
_rxApp = RxAppBuilder.CreateReactiveUIBuilder ();
_rxApp.WithMainThreadScheduler (new TerminalScheduler (app));
_rxApp.WithTaskPoolScheduler (TaskPoolScheduler.Default);
if (smokeTest)
{
using CancellationTokenSource cts = new (TimeSpan.FromSeconds (2));
using LoginView smokeLoginView = new (new LoginViewModel ());
await app.RunAsync (smokeLoginView, cts.Token);
Console.WriteLine ("Smoke test passed.");
return;
}
LoginView loginView = new (new LoginViewModel ());
app.Run (loginView);
loginView.Dispose ();
}
}