This commit is contained in:
Dan Clark
2024-11-19 09:37:18 +00:00
parent 748487031d
commit 71d297b343
10 changed files with 373 additions and 362 deletions
-7
View File
@@ -6,10 +6,3 @@ public record NavigateEventArgs(string Route,
object? Sender = null,
EventHandler? Navigated = null,
IDictionary<string, object>? Parameters = null);
public record NavigateTemplateEventArgs(object Region,
object Template,
object Content,
object? Sender = null,
IDictionary<string, object>? Parameters = null);
@@ -0,0 +1,7 @@
namespace Toolkit.Foundation;
public record NavigateTemplateEventArgs(object Region,
object Template,
object Content,
object? Sender = null,
IDictionary<string, object>? Parameters = null);
+2 -5
View File
@@ -37,8 +37,7 @@ public class Navigation(IServiceProvider provider,
.GetConstructors()
.FirstOrDefault()?
.GetParameters()
.Select(x =>
x?.Name is not null && arguments is not null && arguments.TryGetValue(x.Name, out object? argument)
.Select(x => x?.Name is not null && arguments is not null && arguments.TryGetValue(x.Name, out object? argument)
? argument
: null)
.Where(argument => argument is not null)
@@ -70,9 +69,7 @@ public class Navigation(IServiceProvider provider,
object? content = contentFactory.Create(descriptor, resolvedArguments);
if (content is not null)
{
Type navigationType = region is Type type ? type : region.GetType();
messenger.Send(new NavigateTemplateEventArgs(region, template, content, sender, parameters), navigationType.Name);
messenger.Send(new NavigateTemplateEventArgs(region, template, content, sender, parameters), region is string ? $"{region}" : region.GetType().Name);
if (currentSegmentIndex == segmentCount)
{
navigated?.Invoke(this, EventArgs.Empty);