Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ReactiveUI.Maui/Common/RoutedViewHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public RoutedViewHost()
HorizontalContentAlignment = HorizontalAlignment.Stretch;
VerticalContentAlignment = VerticalAlignment.Stretch;

var platform = Locator.Current.GetService<IPlatformOperations>();
var platform = AppLocator.Current.GetService<IPlatformOperations>();
Func<string?> platformGetter = () => default;

if (platform is null)
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI.Maui/Common/ViewModelViewHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public partial class ViewModelViewHost : TransitioningContentControl, IViewFor,
#endif
public ViewModelViewHost()
{
var platform = Locator.Current.GetService<IPlatformOperations>();
var platform = AppLocator.Current.GetService<IPlatformOperations>();
Func<string?> platformGetter = () => default;

if (platform is null)
Expand Down
8 changes: 4 additions & 4 deletions src/ReactiveUI.Maui/ReactiveShellContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public partial class ReactiveShellContent<TViewModel> : ShellContent, IActivatab
/// </summary>
public ReactiveShellContent()
{
var view = Locator.Current.GetService<IViewFor<TViewModel>>(Contract);
var view = AppLocator.Current.GetService<IViewFor<TViewModel>>(Contract);
if (view is not null)
{
ContentTemplate = new DataTemplate(() => view);
Expand Down Expand Up @@ -80,14 +80,14 @@ public string? Contract

private static void ViewModelChanged(BindableObject bindable, object oldValue, object newValue)
{
if (Locator.Current is null)
if (AppLocator.Current is null)
{
throw new NullReferenceException(nameof(Locator.Current));
throw new NullReferenceException(nameof(AppLocator.Current));
}

if (bindable is ReactiveShellContent<TViewModel> svm)
{
var view = Locator.Current.GetService<IViewFor<TViewModel>>(svm.Contract);
var view = AppLocator.Current.GetService<IViewFor<TViewModel>>(svm.Contract);
if (view is not null)
{
svm.ContentTemplate = new DataTemplate(() => view);
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI.Maui/RoutedViewHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public RoutedViewHost()
await SyncNavigationStacksAsync();
});

var screen = Locator.Current.GetService<IScreen>() ?? throw new Exception("You *must* register an IScreen class representing your App's main Screen");
var screen = AppLocator.Current.GetService<IScreen>() ?? throw new Exception("You *must* register an IScreen class representing your App's main Screen");
Router = screen.Router;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI.Winforms/ReactiveUI.Winforms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Compile Include="..\ReactiveUI.Wpf\Rx\**\*.cs" LinkBase="Rx" Exclude="..\ReactiveUI.Wpf\Rx\**\Dispatcher*.cs;..\ReactiveUI.Wpf\Rx\Internal\*.cs;..\ReactiveUI.Wpf\Rx\Concurrency\*.cs;..\ReactiveUI.Wpf\Rx\Linq\ControlObservable.cs" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net4')) or $(TargetFramework.EndsWith('-windows10.0.17763.0'))">
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<Compile Include="..\ReactiveUI.Wpf\Rx\Concurrency\ControlScheduler.cs" LinkBase="Rx\Concurrency" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/ReactiveUI.Wpf/Common/RoutedViewHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public RoutedViewHost()
HorizontalContentAlignment = HorizontalAlignment.Stretch;
VerticalContentAlignment = VerticalAlignment.Stretch;

var platform = Locator.Current.GetService<IPlatformOperations>();
var platform = AppLocator.Current.GetService<IPlatformOperations>();
Func<string?> platformGetter = () => default;

if (platform is null)
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI.Wpf/Common/ViewModelViewHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public ViewModelViewHost()
DefaultStyleKey = typeof(ViewModelViewHost);
#endif

var platform = Locator.Current.GetService<IPlatformOperations>();
var platform = AppLocator.Current.GetService<IPlatformOperations>();
Func<string?> platformGetter = () => default;

if (platform is null)
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI.Wpf/ReactiveUI.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<Compile Remove="Rx\Internal\Constants.cs;Rx\**\Dispatcher*.cs;Rx\**\Control*.cs" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net46')) or $(TargetFramework.EndsWith('-windows10.0.17763.0'))">
<ItemGroup Condition="$(TargetFramework.StartsWith('net46'))">
<Compile Include="Rx\Internal\Constants.cs;Rx\**\Dispatcher*.cs" />
</ItemGroup>
</Project>
7 changes: 3 additions & 4 deletions src/ReactiveUI.Wpf/Rx/Concurrency/DispatcherScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
namespace System.Reactive.Concurrency;

/// <summary>
/// Represents an object that schedules units of work on a <see cref="System.Windows.Threading.Dispatcher"/>.
/// The <see cref="DispatcherScheduler"/> schedules units of work on a <see cref="System.Windows.Threading.Dispatcher"/>.
/// </summary>
/// <remarks>
/// This scheduler type is typically used indirectly through the <see cref="Linq.DispatcherObservable.ObserveOnDispatcher{TSource}(IObservable{TSource})"/> and <see cref="Linq.DispatcherObservable.SubscribeOnDispatcher{TSource}(IObservable{TSource})"/> methods that use the Dispatcher on the calling thread.
/// </remarks>
/// <seealso cref="System.Reactive.Concurrency.LocalScheduler" />
/// <seealso cref="System.Reactive.Concurrency.ISchedulerPeriodic" />
public class DispatcherScheduler : LocalScheduler, ISchedulerPeriodic
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI/Activation/ViewForMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class ViewForMixins
private static readonly MemoizingMRUCache<Type, IActivationForViewFetcher?> _activationFetcherCache =
new(
(t, _) =>
Locator.Current
AppLocator.Current
.GetServices<IActivationForViewFetcher?>()
.Aggregate((count: 0, viewFetcher: default(IActivationForViewFetcher?)), (acc, x) =>
{
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI/Bindings/Command/CommandBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static CommandBinder()
{
RxApp.EnsureInitialized();

_binderImplementation = Locator.Current.GetService<ICommandBinderImplementation>() ??
_binderImplementation = AppLocator.Current.GetService<ICommandBinderImplementation>() ??
new CommandBinderImplementation();
}

Expand Down
4 changes: 2 additions & 2 deletions src/ReactiveUI/Bindings/Command/CreatesCommandBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal static class CreatesCommandBinding
{
private static readonly MemoizingMRUCache<Type, ICreatesCommandBinding?> _bindCommandCache =
new(
(t, _) => Locator.Current.GetServices<ICreatesCommandBinding>()
(t, _) => AppLocator.Current.GetServices<ICreatesCommandBinding>()
.Aggregate((score: 0, binding: (ICreatesCommandBinding?)null), (acc, x) =>
{
var score = x.GetAffinityForObject(t, false);
Expand All @@ -26,7 +26,7 @@ internal static class CreatesCommandBinding

private static readonly MemoizingMRUCache<Type, ICreatesCommandBinding?> _bindCommandEventCache =
new(
(t, _) => Locator.Current.GetServices<ICreatesCommandBinding>()
(t, _) => AppLocator.Current.GetServices<ICreatesCommandBinding>()
.Aggregate((score: 0, binding: (ICreatesCommandBinding?)null), (acc, x) =>
{
var score = x.GetAffinityForObject(t, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace ReactiveUI;
public class PropertyBinderImplementation : IPropertyBinderImplementation
{
private static readonly MemoizingMRUCache<(Type fromType, Type toType), IBindingTypeConverter?> _typeConverterCache = new(
(types, _) => Locator.Current.GetServices<IBindingTypeConverter?>()
(types, _) => AppLocator.Current.GetServices<IBindingTypeConverter?>()
.Aggregate((currentAffinity: -1, currentBinding: default(IBindingTypeConverter)), (acc, x) =>
{
var score = x?.GetAffinityForObjects(types.fromType, types.toType) ?? -1;
Expand All @@ -25,7 +25,7 @@ public class PropertyBinderImplementation : IPropertyBinderImplementation
[SuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = "Marked as Preserve")]
[SuppressMessage("Trimming", "IL2026:Calling members annotated with 'RequiresUnreferencedCodeAttribute' may break functionality when trimming application code.", Justification = "Marked as Preserve")]
private static readonly MemoizingMRUCache<(Type? fromType, Type? toType), ISetMethodBindingConverter?> _setMethodCache = new(
(type, _) => Locator.Current.GetServices<ISetMethodBindingConverter>()
(type, _) => AppLocator.Current.GetServices<ISetMethodBindingConverter>()
.Aggregate((currentAffinity: -1, currentBinding: default(ISetMethodBindingConverter)), (acc, x) =>
{
var score = x.GetAffinityForObjects(type.fromType, type.toType);
Expand Down Expand Up @@ -314,7 +314,7 @@ public IDisposable BindTo<TValue, TTarget, TTValue>(
private bool EvalBindingHooks<TViewModel, TView>(TViewModel? viewModel, TView view, Expression vmExpression, Expression viewExpression, BindingDirection direction)
where TViewModel : class
{
var hooks = Locator.Current.GetServices<IPropertyBindingHook>();
var hooks = AppLocator.Current.GetServices<IPropertyBindingHook>();
view.ArgumentNullExceptionThrowIfNull(nameof(view));

Func<IObservedChange<object, object?>[]> vmFetcher = vmExpression is not null
Expand Down
6 changes: 3 additions & 3 deletions src/ReactiveUI/Mixins/DependencyResolverMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class DependencyResolverMixins
/// <summary>
/// This method allows you to initialize resolvers with the default
/// ReactiveUI types. All resolvers used as the default
/// Locator.Current.
/// AppLocator.Current.
/// If no namespaces are passed in, all registrations will be checked.
/// </summary>
/// <param name="resolver">The resolver to initialize.</param>
Expand All @@ -28,10 +28,10 @@ public static class DependencyResolverMixins
#endif
public static void InitializeReactiveUI(this IMutableDependencyResolver resolver, params RegistrationNamespace[] registrationNamespaces)
{
if (AppBuilder.UsingBuilder && !ModeDetector.InUnitTestRunner() && ReferenceEquals(resolver, Locator.CurrentMutable))
if (AppBuilder.UsingBuilder && !ModeDetector.InUnitTestRunner() && ReferenceEquals(resolver, AppLocator.CurrentMutable))
{
// If the builder has been used for the default resolver in a non-test environment,
// do not re-register defaults via reflection for Locator.CurrentMutable.
// do not re-register defaults via reflection for AppLocator.CurrentMutable.
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class ReactiveNotifyPropertyChangedMixin
[SuppressMessage("Trimming", "IL2026:Calling members annotated with 'RequiresUnreferencedCodeAttribute' may break functionality when trimming application code.", Justification = "Marked as Preserve")]
private static readonly MemoizingMRUCache<(Type senderType, string propertyName, bool beforeChange), ICreatesObservableForProperty?> _notifyFactoryCache =
new(
(t, _) => Locator.Current.GetServices<ICreatesObservableForProperty>()
(t, _) => AppLocator.Current.GetServices<ICreatesObservableForProperty>()
.Aggregate((score: 0, binding: (ICreatesObservableForProperty?)null), (acc, x) =>
{
var score = x.GetAffinityForObject(t.senderType, t.propertyName, t.beforeChange);
Expand Down
7 changes: 0 additions & 7 deletions src/ReactiveUI/ReactiveUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([System.String]::Copy('$(TargetFramework)').EndsWith('-windows10.0.19041.0'))">10.0.19041.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([System.String]::Copy('$(TargetFramework)').EndsWith('-windows10.0.17763.0'))">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([System.String]::Copy('$(TargetFramework)').EndsWith('-windows10.0.19041.0'))">10.0.19041.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion Condition="$([System.String]::Copy('$(TargetFramework)').EndsWith('-windows10.0.17763.0'))">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
<WindowsSdkPackageVersion Condition="$([System.String]::Copy('$(TargetFramework)').EndsWith('-windows10.0.19041.0'))">10.0.19041.57</WindowsSdkPackageVersion>
<WindowsSdkPackageVersion Condition="$([System.String]::Copy('$(TargetFramework)').EndsWith('-windows10.0.17763.0'))">10.0.17763.57</WindowsSdkPackageVersion>
<DefineConstants>$(DefineConstants);WINUI_TARGET</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net8.0')) or $(TargetFramework.StartsWith('net9.0')) or $(TargetFramework.StartsWith('net10.0'))">
Expand All @@ -33,10 +30,6 @@
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
<Compile Include="Platforms\netstandard2.0\**\*.cs" />
<Compile Include="Platforms\shared\**\*.cs" />
<PackageReference Include="System.ComponentModel" />
<PackageReference Include="System.Diagnostics.Contracts" />
<PackageReference Include="System.Dynamic.Runtime" />
<PackageReference Include="System.Runtime.Serialization.Primitives" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) or $(TargetFramework.StartsWith('net4'))">
Expand Down
4 changes: 2 additions & 2 deletions src/ReactiveUI/Suspension/SuspensionHostExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static IDisposable SetupDefaultSuspendResume(this ISuspensionHost item, I
item.ArgumentNullExceptionThrowIfNull(nameof(item));

var ret = new CompositeDisposable();
suspensionDriver ??= driver ?? Locator.Current.GetService<ISuspensionDriver>();
suspensionDriver ??= driver ?? AppLocator.Current.GetService<ISuspensionDriver>();

if (suspensionDriver is null)
{
Expand Down Expand Up @@ -115,7 +115,7 @@ private static IObservable<Unit> EnsureLoadAppState(this ISuspensionHost item, I
return Observable.Return(Unit.Default);
}

suspensionDriver ??= driver ?? Locator.Current.GetService<ISuspensionDriver>();
suspensionDriver ??= driver ?? AppLocator.Current.GetService<ISuspensionDriver>();

if (suspensionDriver is null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI/View/DefaultViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private static string InterfaceifyTypeName(string typeName)
return null;
}

var service = Locator.Current.GetService(viewType, contract);
var service = AppLocator.Current.GetService(viewType, contract);

if (service is not IViewFor view)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ReactiveUI/View/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ public static class ViewLocator
/// </exception>
[SuppressMessage("Microsoft.Reliability", "CA1065", Justification = "Exception required to keep interface same.")]
public static IViewLocator Current =>
Locator.Current.GetService<IViewLocator>() ?? throw new ViewLocatorNotFoundException("Could not find a default ViewLocator. This should never happen, your dependency resolver is broken");
AppLocator.Current.GetService<IViewLocator>() ?? throw new ViewLocatorNotFoundException("Could not find a default ViewLocator. This should never happen, your dependency resolver is broken");
}
Loading