Use nullable references for navigation state properties
MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/TestDialogViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/TestDialogViewModel.cs
@@ -28,7 +28,7 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
protected override void OnDialogClosed()
{
- _navigationState.HomeScreen().Router.NavigateAndReset.Execute(new AddWalletPageViewModel(_navigationState));
+ _navigationState.HomeScreen?.Invoke().Router.NavigateAndReset.Execute(new AddWalletPageViewModel(_navigationState));
}
public void Close()

MODIFY
WalletWasabi.Fluent/ViewModels/NavBarItemViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBarItemViewModel.cs
@@ -28,7 +28,7 @@ namespace WalletWasabi.Fluent.ViewModels
public string UrlPathSegment { get; } = Guid.NewGuid().ToString().Substring(0, 5);
- public IScreen HostScreen => _navigationState.HomeScreen();
+ public IScreen HostScreen => _navigationState.HomeScreen?.Invoke();
public bool IsExpanded
{
@@ -64,10 +64,10 @@ namespace WalletWasabi.Fluent.ViewModels
{
case NavigationTarget.Default:
case NavigationTarget.Home:
- _navigationState.HomeScreen().Router.Navigate.Execute(this);
+ _navigationState.HomeScreen?.Invoke().Router.Navigate.Execute(this);
break;
case NavigationTarget.Dialog:
- _navigationState.DialogScreen().Router.Navigate.Execute(this);
+ _navigationState.DialogScreen?.Invoke().Router.Navigate.Execute(this);
break;
}
}
@@ -78,10 +78,10 @@ namespace WalletWasabi.Fluent.ViewModels
{
case NavigationTarget.Default:
case NavigationTarget.Home:
- _navigationState.HomeScreen().Router.NavigateAndReset.Execute(this);
+ _navigationState.HomeScreen?.Invoke().Router.NavigateAndReset.Execute(this);
break;
case NavigationTarget.Dialog:
- _navigationState.DialogScreen().Router.NavigateAndReset.Execute(this);
+ _navigationState.DialogScreen?.Invoke().Router.NavigateAndReset.Execute(this);
break;
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/NavigationStateViewModel.cs
WalletWasabi.Fluent/ViewModels/NavigationStateViewModel.cs
@@ -13,10 +13,10 @@ namespace WalletWasabi.Fluent.ViewModels
public class NavigationStateViewModel
{
- public Func<IScreen> HomeScreen { get; set; }
- public Func<IScreen> DialogScreen { get; set; }
- public Func<IDialogHost> DialogHost { get; set; }
- public Func<IRoutableViewModel> CancelView { get; set; }
- public Func<IRoutableViewModel> NextView { get; set; }
+ public Func<IScreen>? HomeScreen { get; set; }
+ public Func<IScreen>? DialogScreen { get; set; }
+ public Func<IDialogHost>? DialogHost { get; set; }
+ public Func<IRoutableViewModel>? CancelView { get; set; }
+ public Func<IRoutableViewModel>? NextView { get; set; }
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
@@ -19,11 +19,11 @@ namespace WalletWasabi.Fluent.ViewModels
{
Title = "Settings";
- NextCommand = ReactiveCommand.Create(() => navigationState.HomeScreen().Router.Navigate.Execute(new AddWalletPageViewModel(navigationState)));
+ NextCommand = ReactiveCommand.Create(() => navigationState.HomeScreen?.Invoke().Router.Navigate.Execute(new AddWalletPageViewModel(navigationState)));
OpenDialogCommand = ReactiveCommand.CreateFromTask(async () => await ConfirmSetting.Handle("Please confirm the setting:").ToTask());
- OpenDialogScreenCommand = ReactiveCommand.Create(() => navigationState.DialogScreen().Router.Navigate.Execute(new AddWalletPageViewModel(navigationState)));
+ OpenDialogScreenCommand = ReactiveCommand.Create(() => navigationState.DialogScreen?.Invoke().Router.Navigate.Execute(new AddWalletPageViewModel(navigationState)));
ConfirmSetting = new Interaction<string, bool>();

Use nullable references for navigation state properties