-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrating NavigationResult to Prism.Core
- Loading branch information
Showing
12 changed files
with
136 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System; | ||
using System; | ||
using Prism.Commands; | ||
using Prism.Mvvm; | ||
using Prism.Navigation; | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using Prism.Regions; | ||
|
||
namespace Prism.Navigation; | ||
|
||
#nullable enable | ||
/// <summary> | ||
/// Provides a wrapper for a Navigation Result | ||
/// </summary> | ||
public interface INavigationResult | ||
{ | ||
/// <summary> | ||
/// Indicates that the navigation was successful and no Navigation Errors occurred | ||
/// </summary> | ||
bool Success { get; } | ||
|
||
/// <summary> | ||
/// If <c>true</c> this indicates that the Navigation Event was cancelled. | ||
/// </summary> | ||
bool Cancelled { get; } | ||
|
||
/// <summary> | ||
/// The Exception if one occurred. | ||
/// </summary> | ||
Exception? Exception { get; } | ||
|
||
/// <summary> | ||
/// If the <see cref="INavigationResult"/> is the result of Region Navigation | ||
/// This will provide the associate <see cref="NavigationContext"/> | ||
/// </summary> | ||
NavigationContext? Context { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using Prism.Regions; | ||
|
||
namespace Prism.Navigation; | ||
|
||
#nullable enable | ||
/// <summary> | ||
/// Default implementation for the <see cref="INavigationResult"/> | ||
/// </summary> | ||
public record NavigationResult : INavigationResult | ||
{ | ||
private readonly bool? _success; | ||
|
||
/// <summary> | ||
/// Initializes a new Navigation Result | ||
/// </summary> | ||
public NavigationResult() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new NavigationResult | ||
/// </summary> | ||
/// <param name="success"></param> | ||
public NavigationResult(bool success) | ||
{ | ||
_success = success; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new NavigationResult | ||
/// </summary> | ||
/// <param name="context"></param> | ||
/// <param name="success"></param> | ||
public NavigationResult(NavigationContext context, bool success) | ||
{ | ||
Context = context; | ||
_success = success; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new NavigationResult | ||
/// </summary> | ||
/// <param name="context"></param> | ||
/// <param name="exception"></param> | ||
public NavigationResult(NavigationContext context, Exception exception) | ||
{ | ||
Context = context; | ||
Exception = exception; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public bool Success => _success ?? Exception is null; | ||
|
||
/// <inheritdoc /> | ||
public bool Cancelled => | ||
Exception is NavigationException navigationException | ||
&& navigationException.Message == NavigationException.IConfirmNavigationReturnedFalse; | ||
|
||
/// <inheritdoc /> | ||
public Exception? Exception { get; init; } | ||
|
||
/// <inheritdoc /> | ||
public NavigationContext? Context { get; init; } | ||
} |
Oops, something went wrong.