Ver Fonte

fix: RxUI usage errors and drop ReactiveUI.Fody

Bruce Wayne há 4 anos atrás
pai
commit
39f7a2efd5

+ 34 - 12
NatTypeTester.Models/Config.cs

@@ -1,24 +1,46 @@
-using ReactiveUI.Fody.Helpers;
+using JetBrains.Annotations;
+using ReactiveUI;
 using STUN.Enums;
 using Volo.Abp.DependencyInjection;
 
 namespace NatTypeTester.Models
 {
-	public class Config : ISingletonDependency
+	[UsedImplicitly]
+	public record Config : ReactiveRecord, ISingletonDependency
 	{
-		[Reactive]
-		public string StunServer { get; set; } = @"stun.syncthing.net";
+		private string _stunServer = @"stun.syncthing.net";
+		public string StunServer
+		{
+			get => _stunServer;
+			set => this.RaiseAndSetIfChanged(ref _stunServer, value);
+		}
 
-		[Reactive]
-		public ProxyType ProxyType { get; set; } = ProxyType.Plain;
+		private ProxyType _proxyType = ProxyType.Plain;
+		public ProxyType ProxyType
+		{
+			get => _proxyType;
+			set => this.RaiseAndSetIfChanged(ref _proxyType, value);
+		}
 
-		[Reactive]
-		public string ProxyServer { get; set; } = @"127.0.0.1:1080";
+		private string _proxyServer = @"127.0.0.1:1080";
+		public string ProxyServer
+		{
+			get => _proxyServer;
+			set => this.RaiseAndSetIfChanged(ref _proxyServer, value);
+		}
 
-		[Reactive]
-		public string? ProxyUser { get; set; }
+		private string? _proxyUser;
+		public string? ProxyUser
+		{
+			get => _proxyUser;
+			set => this.RaiseAndSetIfChanged(ref _proxyUser, value);
+		}
 
-		[Reactive]
-		public string? ProxyPassword { get; set; }
+		private string? _proxyPassword;
+		public string? ProxyPassword
+		{
+			get => _proxyPassword;
+			set => this.RaiseAndSetIfChanged(ref _proxyPassword, value);
+		}
 	}
 }

+ 0 - 3
NatTypeTester.Models/FodyWeavers.xml

@@ -1,3 +0,0 @@
-<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
-  <ReactiveUI />
-</Weavers>

+ 1 - 1
NatTypeTester.Models/NatTypeTester.Models.csproj

@@ -3,7 +3,7 @@
   <Import Project="..\common.props" />
 
   <ItemGroup>
-    <PackageReference Include="ReactiveUI.Fody" Version="15.1.1" />
+    <PackageReference Include="ReactiveUI" Version="15.1.1" />
     <PackageReference Include="Volo.Abp.Core" Version="4.4.0" />
   </ItemGroup>
 

+ 0 - 3
NatTypeTester.ViewModels/FodyWeavers.xml

@@ -1,3 +0,0 @@
-<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
-  <ReactiveUI />
-</Weavers>

+ 1 - 1
NatTypeTester.ViewModels/NatTypeTester.ViewModels.csproj

@@ -3,7 +3,7 @@
   <Import Project="..\common.props" />
 
   <ItemGroup>
-    <PackageReference Include="ReactiveUI.Fody" Version="15.1.1" />
+    <PackageReference Include="ReactiveUI" Version="15.1.1" />
     <PackageReference Include="Volo.Abp.Core" Version="4.4.0" />
   </ItemGroup>
 

+ 0 - 2
NatTypeTester.ViewModels/RFC3489ViewModel.cs

@@ -2,7 +2,6 @@ using Dns.Net.Abstractions;
 using JetBrains.Annotations;
 using NatTypeTester.Models;
 using ReactiveUI;
-using ReactiveUI.Fody.Helpers;
 using STUN.Client;
 using STUN.Proxy;
 using STUN.StunResult;
@@ -26,7 +25,6 @@ namespace NatTypeTester.ViewModels
 
 		private IDnsClient DnsClient => LazyServiceProvider.LazyGetRequiredService<IDnsClient>();
 
-		[Reactive]
 		public ClassicStunResult Result3489 { get; set; }
 
 		public ReactiveCommand<Unit, Unit> TestClassicNatType { get; }

+ 0 - 2
NatTypeTester.ViewModels/RFC5780ViewModel.cs

@@ -2,7 +2,6 @@ using Dns.Net.Abstractions;
 using JetBrains.Annotations;
 using NatTypeTester.Models;
 using ReactiveUI;
-using ReactiveUI.Fody.Helpers;
 using STUN.Client;
 using STUN.Proxy;
 using STUN.StunResult;
@@ -26,7 +25,6 @@ namespace NatTypeTester.ViewModels
 
 		private IDnsClient DnsClient => LazyServiceProvider.LazyGetRequiredService<IDnsClient>();
 
-		[Reactive]
 		public StunResult5389 Result5389 { get; set; }
 
 		public ReactiveCommand<Unit, Unit> DiscoveryNatType { get; }