-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathRegistrations.cs
46 lines (40 loc) · 2.09 KB
/
Registrations.cs
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
39
40
41
42
43
44
45
46
// Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
namespace ReactiveUI.Wpf;
/// <summary>
/// Registrations specific to the WPF platform.
/// </summary>
public class Registrations : IWantsToRegisterStuff
{
/// <inheritdoc/>
public void Register(Action<Func<object>, Type> registerFunction)
{
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(registerFunction);
#else
if (registerFunction is null)
{
throw new ArgumentNullException(nameof(registerFunction));
}
#endif
registerFunction(() => new PlatformOperations(), typeof(IPlatformOperations));
registerFunction(() => new ActivationForViewFetcher(), typeof(IActivationForViewFetcher));
registerFunction(() => new DependencyObjectObservableForProperty(), typeof(ICreatesObservableForProperty));
registerFunction(() => new StringConverter(), typeof(IBindingTypeConverter));
registerFunction(() => new SingleToStringTypeConverter(), typeof(IBindingTypeConverter));
registerFunction(() => new DoubleToStringTypeConverter(), typeof(IBindingTypeConverter));
registerFunction(() => new DecimalToStringTypeConverter(), typeof(IBindingTypeConverter));
registerFunction(() => new BooleanToVisibilityTypeConverter(), typeof(IBindingTypeConverter));
registerFunction(() => new AutoDataTemplateBindingHook(), typeof(IPropertyBindingHook));
registerFunction(() => new ComponentModelTypeConverter(), typeof(IBindingTypeConverter));
if (!ModeDetector.InUnitTestRunner())
{
// NB: On .NET Core, trying to touch DispatcherScheduler blows up :cry:
RxApp.MainThreadScheduler = new WaitForDispatcherScheduler(() => DispatcherScheduler.Current);
RxApp.TaskpoolScheduler = TaskPoolScheduler.Default;
}
RxApp.SuppressViewCommandBindingMessage = true;
}
}