Router - Added reload

Workshop - Added image management to existing entries
Workshop - Fixed pagination in layouts page
This commit is contained in:
RobertBeekman authored and Robert committed 2024-01-28 22:43:35 +01:00
1 parent 19082481c3
commit 78b96deeab
25 files changed
+328 -100

No files matched your search

@@ -27,6 +27,12 @@ public interface IRouter
/// <param name="options">Optional navigation options used to control navigation behaviour.</param>
/// <returns>A task representing the operation</returns>
Task Navigate(string path, RouterNavigationOptions? options = null);
/// <summary>
/// Asynchronously reloads the current route
/// </summary>
/// <returns>A task representing the operation</returns>
Task Reload();
/// <summary>
/// Asynchronously navigates back to the previous active route.
@@ -79,6 +79,19 @@ internal class Router : CorePropertyChanged, IRouter, IDisposable
await Dispatcher.UIThread.InvokeAsync(() => InternalNavigate(path, options));
}
/// <inheritdoc />
public async Task Reload()
{
string path = _currentRouteSubject.Value ?? "blank";
// Routing takes place on the UI thread with processing heavy tasks offloaded by the router itself
await Dispatcher.UIThread.InvokeAsync(async () =>
{
await InternalNavigate("blank", new RouterNavigationOptions {AddToHistory = false, RecycleScreens = false, EnableLogging = false});
await InternalNavigate(path, new RouterNavigationOptions {AddToHistory = false, RecycleScreens = false});
});
}
private async Task InternalNavigate(string path, RouterNavigationOptions options)
{
if (_root == null)