Program.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Diagnostics;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Threading;
  6. using Avalonia;
  7. namespace ControlCatalog.NetCore
  8. {
  9. static class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. if (args.Contains("--wait-for-attach"))
  14. {
  15. Console.WriteLine("Attach debugger and use 'Set next statement'");
  16. while (true)
  17. {
  18. Thread.Sleep(100);
  19. if (Debugger.IsAttached)
  20. break;
  21. }
  22. }
  23. if (args.Contains("--fbdev"))
  24. AppBuilder.Configure<App>().InitializeWithLinuxFramebuffer(tl =>
  25. {
  26. tl.Content = new MainView();
  27. System.Threading.ThreadPool.QueueUserWorkItem(_ => ConsoleSilencer());
  28. });
  29. else
  30. AppBuilder.Configure<App>()
  31. .CustomPlatformDetect()
  32. .UseReactiveUI()
  33. .Start<MainWindow>();
  34. }
  35. static AppBuilder CustomPlatformDetect(this AppBuilder builder)
  36. {
  37. //This is needed because we still aren't ready to have MonoMac backend as default one
  38. if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
  39. return builder.UseSkia().UseMonoMac();
  40. return builder.UsePlatformDetect();
  41. }
  42. static void ConsoleSilencer()
  43. {
  44. Console.CursorVisible = false;
  45. while (true)
  46. Console.ReadKey(true);
  47. }
  48. }
  49. }