@@ -16,7 +16,7 @@ namespace SecureFolderFS.Sdk.ViewModels.Views.Overlays
1616 [ Bindable ( true ) ]
1717 public sealed partial class WizardOverlayViewModel : OverlayViewModel , IStagingView , INavigatable , IDisposable
1818 {
19- [ ObservableProperty ] private IStagingView ? _CurrentViewModel ;
19+ [ ObservableProperty ] private IViewDesignation ? _CurrentViewModel ;
2020
2121 public IVaultCollectionModel VaultCollectionModel { get ; }
2222
@@ -40,10 +40,10 @@ public override void OnDisappearing()
4040 /// <inheritdoc />
4141 public async Task < IResult > TryContinueAsync ( CancellationToken cancellationToken )
4242 {
43- if ( CurrentViewModel is null )
43+ if ( CurrentViewModel is not IStagingView stagingView )
4444 return Result . Failure ( null ) ;
4545
46- var result = await CurrentViewModel . TryContinueAsync ( cancellationToken ) ;
46+ var result = await stagingView . TryContinueAsync ( cancellationToken ) ;
4747 if ( result . Successful )
4848 NavigationRequested ? . Invoke ( this , new WizardNavigationRequestedEventArgs ( result , CurrentViewModel ) ) ;
4949
@@ -53,10 +53,10 @@ public async Task<IResult> TryContinueAsync(CancellationToken cancellationToken)
5353 /// <inheritdoc />
5454 public async Task < IResult > TryCancelAsync ( CancellationToken cancellationToken )
5555 {
56- if ( CurrentViewModel is null )
56+ if ( CurrentViewModel is not IStagingView stagingView )
5757 return Result . Failure ( null ) ;
5858
59- var result = await CurrentViewModel . TryCancelAsync ( cancellationToken ) ;
59+ var result = await stagingView . TryCancelAsync ( cancellationToken ) ;
6060 if ( result . Successful )
6161 NavigationRequested ? . Invoke ( this , new DismissNavigationRequestedEventArgs ( CurrentViewModel ) ) ;
6262
@@ -78,26 +78,22 @@ private async Task CancellationAsync(IEventDispatch? eventDispatch, Cancellation
7878 eventDispatch ? . PreventForwarding ( ) ;
7979 }
8080
81- partial void OnCurrentViewModelChanging ( IStagingView ? oldValue , IStagingView ? newValue )
81+ partial void OnCurrentViewModelChanging ( IViewDesignation ? oldValue , IViewDesignation ? newValue )
8282 {
83- if ( oldValue is not null )
84- {
85- oldValue . PropertyChanged -= CurrentViewModel_PropertyChanged ;
86- oldValue . OnDisappearing ( ) ;
87- }
83+ oldValue ? . PropertyChanged - = CurrentViewModel_PropertyChanged ;
84+ oldValue ? . OnDisappearing ( ) ;
85+
86+ newValue ? . PropertyChanged += CurrentViewModel_PropertyChanged;
87+ newValue ? . OnAppearing ( ) ;
88+ Title = newValue ? . Title ;
8889
8990 if ( newValue is OverlayViewModel overlayViewModel)
9091 {
91- overlayViewModel . PropertyChanged += CurrentViewModel_PropertyChanged ;
92- overlayViewModel . OnAppearing ( ) ;
93-
9492 CanContinue = overlayViewModel . CanContinue ;
9593 CanCancel = overlayViewModel . CanCancel ;
9694 PrimaryText = overlayViewModel . PrimaryText ;
9795 SecondaryText = overlayViewModel . SecondaryText ;
9896 }
99-
100- Title = newValue ? . Title ;
10197 }
10298
10399 private void CurrentViewModel_PropertyChanged ( object ? sender , PropertyChangedEventArgs e )
0 commit comments