WIP
This commit is contained in:
@@ -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);
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user