浏览代码

fix: Some warnings

Bruce Wayne 4 年之前
父节点
当前提交
a0db7cc27a

+ 4 - 8
NatTypeTester/MainWindow.xaml.cs

@@ -1,5 +1,4 @@
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
-using ModernWpf;
 using ModernWpf.Controls;
 using ModernWpf.Controls;
 using NatTypeTester.ViewModels;
 using NatTypeTester.ViewModels;
 using ReactiveUI;
 using ReactiveUI;
@@ -13,13 +12,10 @@ namespace NatTypeTester
 {
 {
 	public partial class MainWindow : ISingletonDependency
 	public partial class MainWindow : ISingletonDependency
 	{
 	{
-		public IServiceProvider ServiceProvider { get; set; } = null!;
-
-		public MainWindow(MainWindowViewModel viewModel)
+		public MainWindow(MainWindowViewModel viewModel, IServiceProvider serviceProvider)
 		{
 		{
 			InitializeComponent();
 			InitializeComponent();
 			ViewModel = viewModel;
 			ViewModel = viewModel;
-			ThemeManager.Current.ApplicationTheme = default;
 
 
 			this.WhenActivated(d =>
 			this.WhenActivated(d =>
 			{
 			{
@@ -43,7 +39,7 @@ namespace NatTypeTester
 				{
 				{
 					if (args.EventArgs.IsSettingsSelected)
 					if (args.EventArgs.IsSettingsSelected)
 					{
 					{
-						ViewModel.Router.Navigate.Execute(ServiceProvider.GetRequiredService<SettingViewModel>());
+						ViewModel.Router.Navigate.Execute(serviceProvider.GetRequiredService<SettingViewModel>());
 						return;
 						return;
 					}
 					}
 
 
@@ -56,12 +52,12 @@ namespace NatTypeTester
 					{
 					{
 						case @"1":
 						case @"1":
 						{
 						{
-							ViewModel.Router.Navigate.Execute(ServiceProvider.GetRequiredService<RFC5780ViewModel>());
+							ViewModel.Router.Navigate.Execute(serviceProvider.GetRequiredService<RFC5780ViewModel>());
 							break;
 							break;
 						}
 						}
 						case @"2":
 						case @"2":
 						{
 						{
-							ViewModel.Router.Navigate.Execute(ServiceProvider.GetRequiredService<RFC3489ViewModel>());
+							ViewModel.Router.Navigate.Execute(serviceProvider.GetRequiredService<RFC3489ViewModel>());
 							break;
 							break;
 						}
 						}
 					}
 					}

+ 1 - 1
NatTypeTester/Views/RFC3489View.xaml.cs

@@ -53,7 +53,7 @@ namespace NatTypeTester.Views
 						.Subscribe(_ => TestButton.Command.Execute(default))
 						.Subscribe(_ => TestButton.Command.Execute(default))
 						.DisposeWith(d);
 						.DisposeWith(d);
 
 
-				ViewModel.TestClassicNatType.ThrownExceptions.Subscribe(async ex => await ex.HandleExceptionWithContentDialogAsync()).DisposeWith(d);
+				ViewModel.TestClassicNatType.ThrownExceptions.Subscribe(ex => _ = ex.HandleExceptionWithContentDialogAsync()).DisposeWith(d);
 			});
 			});
 		}
 		}
 	}
 	}

+ 1 - 1
NatTypeTester/Views/RFC5780View.xaml.cs

@@ -67,7 +67,7 @@ namespace NatTypeTester.Views
 						.Subscribe(_ => DiscoveryButton.Command.Execute(default))
 						.Subscribe(_ => DiscoveryButton.Command.Execute(default))
 						.DisposeWith(d);
 						.DisposeWith(d);
 
 
-				ViewModel.DiscoveryNatType.ThrownExceptions.Subscribe(async ex => await ex.HandleExceptionWithContentDialogAsync()).DisposeWith(d);
+				ViewModel.DiscoveryNatType.ThrownExceptions.Subscribe(ex => _ = ex.HandleExceptionWithContentDialogAsync()).DisposeWith(d);
 			});
 			});
 		}
 		}
 	}
 	}