AppBuilderExtensions.cs 635 B

123456789101112131415161718192021
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using Avalonia.Controls;
  4. using Avalonia.Threading;
  5. using ReactiveUI;
  6. namespace Avalonia
  7. {
  8. public static class AppBuilderExtensions
  9. {
  10. public static TAppBuilder UseReactiveUI<TAppBuilder>(this TAppBuilder builder)
  11. where TAppBuilder : AppBuilderBase<TAppBuilder>, new()
  12. {
  13. return builder.AfterSetup(_ =>
  14. {
  15. RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
  16. });
  17. }
  18. }
  19. }