Skip to content

Commit

Permalink
fix: Some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
HMBSbige committed Aug 17, 2021
1 parent d53700e commit a0db7cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
12 changes: 4 additions & 8 deletions NatTypeTester/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using ModernWpf;
using ModernWpf.Controls;
using NatTypeTester.ViewModels;
using ReactiveUI;
Expand All @@ -13,13 +12,10 @@ namespace NatTypeTester
{
public partial class MainWindow : ISingletonDependency
{
public IServiceProvider ServiceProvider { get; set; } = null!;

public MainWindow(MainWindowViewModel viewModel)
public MainWindow(MainWindowViewModel viewModel, IServiceProvider serviceProvider)
{
InitializeComponent();
ViewModel = viewModel;
ThemeManager.Current.ApplicationTheme = default;

this.WhenActivated(d =>
{
Expand All @@ -43,7 +39,7 @@ public MainWindow(MainWindowViewModel viewModel)
{
if (args.EventArgs.IsSettingsSelected)
{
ViewModel.Router.Navigate.Execute(ServiceProvider.GetRequiredService<SettingViewModel>());
ViewModel.Router.Navigate.Execute(serviceProvider.GetRequiredService<SettingViewModel>());
return;
}

Expand All @@ -56,12 +52,12 @@ public MainWindow(MainWindowViewModel viewModel)
{
case @"1":
{
ViewModel.Router.Navigate.Execute(ServiceProvider.GetRequiredService<RFC5780ViewModel>());
ViewModel.Router.Navigate.Execute(serviceProvider.GetRequiredService<RFC5780ViewModel>());
break;
}
case @"2":
{
ViewModel.Router.Navigate.Execute(ServiceProvider.GetRequiredService<RFC3489ViewModel>());
ViewModel.Router.Navigate.Execute(serviceProvider.GetRequiredService<RFC3489ViewModel>());
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion NatTypeTester/Views/RFC3489View.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public RFC3489View(RFC3489ViewModel viewModel)
.Subscribe(_ => TestButton.Command.Execute(default))
.DisposeWith(d);

ViewModel.TestClassicNatType.ThrownExceptions.Subscribe(async ex => await ex.HandleExceptionWithContentDialogAsync()).DisposeWith(d);
ViewModel.TestClassicNatType.ThrownExceptions.Subscribe(ex => _ = ex.HandleExceptionWithContentDialogAsync()).DisposeWith(d);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion NatTypeTester/Views/RFC5780View.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public RFC5780View(RFC5780ViewModel viewModel)
.Subscribe(_ => DiscoveryButton.Command.Execute(default))
.DisposeWith(d);

ViewModel.DiscoveryNatType.ThrownExceptions.Subscribe(async ex => await ex.HandleExceptionWithContentDialogAsync()).DisposeWith(d);
ViewModel.DiscoveryNatType.ThrownExceptions.Subscribe(ex => _ = ex.HandleExceptionWithContentDialogAsync()).DisposeWith(d);
});
}
}
Expand Down

0 comments on commit a0db7cc

Please sign in to comment.