Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions src/AvaloniaInside.Shell/BindingNavigate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
private EventHandler? _singletonCanExecuteChanged;

public AvaloniaObject? Sender { get; internal set; }
public string Path { get; set; }

Check warning on line 19 in src/AvaloniaInside.Shell/BindingNavigate.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Path' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public NavigateType? Type { get; set; }
public IPageTransition? Transition { get; set; }

Expand All @@ -27,44 +27,44 @@
}

public bool CanExecute(object? parameter) => _singletonCanExecute;
public void Execute(object? parameter) => ExecuteAsync(parameter, CancellationToken.None);

Check warning on line 30 in src/AvaloniaInside.Shell/BindingNavigate.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

public async Task ExecuteAsync(object? parameter, CancellationToken cancellationToken)
{
if (Sender is not Visual visual) return;
if (visual.FindAncestorOfType<ShellView>() is not { } shell) return;
if (Sender is not Visual visual) return;
if (visual.FindAncestorOfType<ShellView>() is not { } shell) return;

_singletonCanExecute = false;
_singletonCanExecute = false;
_singletonCanExecuteChanged?.Invoke(this, EventArgs.Empty);
try
{
if (parameter != null)
await shell.Navigator.NavigateAsync(
Path,
Type,
parameter,
Sender,
true,
Transition,
cancellationToken);
else
await shell.Navigator.NavigateAsync(
Path,
Type,
Sender,
true,
Transition,
cancellationToken);
}
finally
{
_singletonCanExecute = true;
_singletonCanExecuteChanged?.Invoke(this, EventArgs.Empty);
try
{
if (parameter != null)
await shell.Navigator.NavigateAsync(
Path,
Type,
parameter,
Sender,
true,
Transition,
cancellationToken);
else
await shell.Navigator.NavigateAsync(
Path,
Type,
Sender,
true,
Transition,
cancellationToken);
}
finally
{
_singletonCanExecute = true;
_singletonCanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
}
}

public static implicit operator BindingNavigate(string path) => new BindingNavigate
{
Path = path
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
await newInstanceLifecycle.AppearAsync(cancellationToken);

if (hasArgument)
await newInstanceLifecycle.ArgumentAsync(argument, cancellationToken);

Check warning on line 51 in src/AvaloniaInside.Shell/DefaultNavigationUpdateStrategy.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'args' in 'Task INavigationLifecycle.ArgumentAsync(object args, CancellationToken cancellationToken)'.
}

if (!isSame && changes.Front != null)
if (!isSame && changes.Front != null && navigateType != NavigateType.Pop)
await _presenterProvider.For(navigateType).PresentAsync(shellView, changes.Front, navigateType, cancellationToken);
}

Expand Down
Loading