Skip to content

Commit 9957d5c

Browse files
authored
Replace Locator with AppLocator and RxApp with RxSchedulers (#339)
Updated references from Locator to AppLocator and RxApp to RxSchedulers across README, test files, and source generator code for consistency with new APIs. Removed commented PolySharp polyfill configuration from the project file.
1 parent 3dfd83e commit 9957d5c

File tree

5 files changed

+8
-35
lines changed

5 files changed

+8
-35
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ public partial class MyReactiveControl : UserControl
575575
public MyReactiveControl()
576576
{
577577
InitializeComponent();
578-
ViewModel = Locator.Current.GetService<MyReactiveClass>();
578+
ViewModel = AppLocator.Current.GetService<MyReactiveClass>();
579579
}
580580
}
581581
```
@@ -584,7 +584,7 @@ this will generate the following code to enable you register the marked Views as
584584
```csharp
585585
using ReactiveUI.SourceGenerators;
586586

587-
Splat.Locator.CurrentMutable.RegisterViewsForViewModelsSourceGenerated();
587+
Splat.AppLocator.CurrentMutable.RegisterViewsForViewModelsSourceGenerated();
588588
```
589589

590590
### Usage IViewFor with ViewModel Name - Generic Types should be used with the fully qualified name, otherwise use nameof(ViewModelTypeName)

src/ReactiveUI.SourceGenerators.Execute/TestViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public partial class TestViewModel : ReactiveObject, IActivatableViewModel, IDis
3535
private readonly Subject<double?> _testSubject = new();
3636
private readonly Subject<double> _testNonNullSubject = new();
3737
private readonly Subject<int> _fromPartialTestSubject = new();
38-
private readonly IScheduler _scheduler = RxApp.MainThreadScheduler;
38+
private readonly IScheduler _scheduler = RxSchedulers.MainThreadScheduler;
3939

4040
[property: JsonInclude]
4141
[DataMember]

src/ReactiveUI.SourceGenerators.Execute/TestViewWpf.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public partial class TestViewWpf : Window
2121
/// </summary>
2222
public TestViewWpf()
2323
{
24-
Locator.CurrentMutable.RegisterLazySingleton<IViewFor<TestViewModel>>(() => new TestViewWpf());
24+
AppLocator.CurrentMutable.RegisterLazySingleton<IViewFor<TestViewModel>>(() => new TestViewWpf());
2525
ViewModel = TestViewModel.Instance;
2626
}
2727

src/ReactiveUI.SourceGenerators.Roslyn/ReactiveCommand/ReactiveCommandGenerator.Execute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public partial class ReactiveCommandGenerator
3636
private const string CreateT = ".CreateFromTask";
3737
private const string CanExecute = "CanExecute";
3838
private const string OutputScheduler = "OutputScheduler";
39-
private const string MainThreadScheduler = "RxApp.MainThreadScheduler";
40-
private const string TaskpoolScheduler = "RxApp.TaskpoolScheduler";
39+
private const string MainThreadScheduler = "RxSchedulers.MainThreadScheduler";
40+
private const string TaskpoolScheduler = "RxSchedulers.TaskpoolScheduler";
4141

4242
private static CommandInfo? GetMethodInfo(in GeneratorAttributeSyntaxContext context, CancellationToken token)
4343
{

src/ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,16 @@
1313

1414
<PackageDescription>A MVVM framework that integrates with the Reactive Extensions for .NET to create elegant, testable User Interfaces that run on any mobile or desktop platform. This is the Source Generators package for ReactiveUI</PackageDescription>
1515

16-
<!-- Necessary polyfills -->
17-
<!--<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
18-
<PolySharpIncludeGeneratedTypes>-->
19-
<!--System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute;
20-
System.Diagnostics.CodeAnalysis.MemberNotNullAttribute;
21-
System.Diagnostics.CodeAnalysis.NotNullAttribute;
22-
System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute;
23-
System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute;
24-
System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute;
25-
System.Runtime.CompilerServices.CallerArgumentExpressionAttribute;
26-
System.Runtime.CompilerServices.SkipLocalsInitAttribute;-->
27-
<!--System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute;
28-
System.Diagnostics.CodeAnalysis.NotNullWhenAttribute;
29-
System.Diagnostics.CodeAnalysis.UnscopedRefAttribute;
30-
System.Runtime.CompilerServices.IsExternalInit;
31-
System.Index;
32-
System.Range;
33-
</PolySharpIncludeGeneratedTypes>-->
3416
</PropertyGroup>
3517

3618
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
3719
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
3820
</PropertyGroup>
39-
<!-- Include PolySharp to generate polyfills for all projects (on their .NET Standard 2.x targets) -->
21+
4022
<ItemGroup>
41-
<!--<PackageReference Include="PolySharp">
42-
<PrivateAssets>all</PrivateAssets>
43-
<IncludeAssets>build; analyzers</IncludeAssets>
44-
</PackageReference>-->
4523
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" />
4624
</ItemGroup>
47-
25+
4826
<ItemGroup>
4927
<InternalsVisibleTo Include="ReactiveUI.CodeFixes" />
5028
</ItemGroup>
@@ -60,9 +38,4 @@
6038
<None Include="..\ReactiveUI.SourceGenerators.Roslyn480\bin\$(Configuration)\netstandard2.0\ReactiveUI.SourceGenerators.dll" PackagePath="analyzers\dotnet\roslyn4.8\cs" Pack="true" Visible="false" />
6139
<None Include="..\ReactiveUI.SourceGenerators.Roslyn4120\\bin\$(Configuration)\netstandard2.0\ReactiveUI.SourceGenerators.dll" PackagePath="analyzers\dotnet\roslyn4.12\cs" Pack="true" Visible="false" />
6240
</ItemGroup>
63-
64-
<!-- Include PolySharp generated code
65-
<ItemGroup>
66-
<Folder Include="Generated\" />
67-
</ItemGroup> -->
6841
</Project>

0 commit comments

Comments
 (0)