Program.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. .Start<MainWindow>();
  33. }
  34. static AppBuilder CustomPlatformDetect(this AppBuilder builder)
  35. {
  36. //This is needed because we still aren't ready to have MonoMac backend as default one
  37. if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
  38. return builder.UseSkia().UseMonoMac();
  39. return builder.UsePlatformDetect();
  40. }
  41. static void ConsoleSilencer()
  42. {
  43. Console.CursorVisible = false;
  44. while (true)
  45. Console.ReadKey(true);
  46. }
  47. }
  48. }