Fixed more edge cases
This commit is contained in:
@@ -100,7 +100,7 @@ public partial class App : Application
|
||||
|
||||
services.AddScoped<IValueStore<Item>, ValueStore<Item>>();
|
||||
|
||||
services.AddHandler<ConfirmItemHandler>(ServiceLifetime.Singleton);
|
||||
services.AddHandler<ConfirmItemHandler>(ServiceLifetime.Scoped);
|
||||
services.AddHandler<ArchiveItemHandler>(ServiceLifetime.Scoped);
|
||||
|
||||
services.AddHandler<ItemActivatedHandler>();
|
||||
|
||||
@@ -6,32 +6,15 @@
|
||||
x:DataType="vm:ItemNavigationViewModel"
|
||||
IsSelected="{Binding Selected}">
|
||||
<Interaction.Behaviors>
|
||||
<!--<EventTriggerBehavior EventName="Loaded">
|
||||
<ConditionAction>
|
||||
<ConditionAction.Condition>
|
||||
<ConditionalExpression ForwardChaining="And">
|
||||
<ComparisonCondition LeftOperand="{Binding Selected}" RightOperand="True" />
|
||||
</ConditionalExpression>
|
||||
</ConditionAction.Condition>
|
||||
<NavigateAction
|
||||
Context="{Binding Named, StringFormat='{}{0}:ContentHeader'}"
|
||||
Route="ItemCommandHeader"
|
||||
Scope="self" />
|
||||
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:Content'}" Route="Item">
|
||||
<NavigateAction.ParameterBindings>
|
||||
<ParameterBinding Key="Immutable" Value="{x:True}" />
|
||||
<ParameterBinding Key="Id" Value="{Binding Id}" />
|
||||
<ParameterBinding Key="Name" Value="{Binding Name}" />
|
||||
</NavigateAction.ParameterBindings>
|
||||
</NavigateAction>
|
||||
</ConditionAction>
|
||||
</EventTriggerBehavior>-->
|
||||
<DataTriggerBehavior Binding="{Binding Selected}" Value="True">
|
||||
<NavigateAction
|
||||
Context="{Binding Named, StringFormat='{}{0}:ContentHeader'}"
|
||||
Route="ItemCommandHeader"
|
||||
Scope="self" />
|
||||
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:Content'}" Route="Item">
|
||||
<NavigateAction
|
||||
Context="{Binding Named, StringFormat='{}{0}:Content'}"
|
||||
Route="Item"
|
||||
Scope="self">
|
||||
<NavigateAction.ParameterBindings>
|
||||
<ParameterBinding Key="Immutable" Value="{x:True}" />
|
||||
<ParameterBinding Key="Id" Value="{Binding Id}" />
|
||||
|
||||
@@ -46,6 +46,6 @@ public class ConfirmItemHandler(IMediator mediator,
|
||||
|
||||
public async Task Handle(ConfirmEventArgs<Item> args)
|
||||
{
|
||||
await mediator.Handle<ConfirmEventArgs<Item>, bool>(args);
|
||||
ItemHeaderConfiguration? headerConfiguration = await mediator.Handle<ConfirmEventArgs<Item>, ItemHeaderConfiguration>(args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public record ItemHeaderConfiguration
|
||||
{
|
||||
public string? Name { get; init; }
|
||||
}
|
||||
@@ -11,18 +11,19 @@ public partial class ItemHeaderViewModel(IServiceProvider provider,
|
||||
IDisposer disposer,
|
||||
bool immutable,
|
||||
string? value = null) : ObservableViewModel<string, string>(provider, factory, mediator, publisher, subscriber, disposer, value),
|
||||
IHandler<ConfirmEventArgs<Item>, bool>
|
||||
|
||||
IHandler<ValidationEventArgs<Item>, bool>,
|
||||
IHandler<ConfirmEventArgs<Item>, ItemHeaderConfiguration>
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool immutable = immutable;
|
||||
|
||||
public Task<bool> Handle(ConfirmEventArgs<Item> args,
|
||||
public Task<bool> Handle(ValidationEventArgs<Item> args,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// we need to work on the local validation layer
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public void Invoke(ItemConfiguration args) =>
|
||||
args.Name = Value;
|
||||
public Task<ItemHeaderConfiguration> Handle(ConfirmEventArgs<Item> args,
|
||||
CancellationToken cancellationToken) => Task.FromResult(new ItemHeaderConfiguration { Name = Value });
|
||||
}
|
||||
|
||||
@@ -9,9 +9,6 @@ public partial class ItemViewModel :
|
||||
[ObservableProperty]
|
||||
private int? id;
|
||||
|
||||
[ObservableProperty]
|
||||
private string named;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool immutable;
|
||||
|
||||
@@ -22,13 +19,12 @@ public partial class ItemViewModel :
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template,
|
||||
NamedComponent named,
|
||||
IValueStore<Item> foom,
|
||||
bool immutable = true,
|
||||
int? id = null,
|
||||
string? name = null) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
Template = template;
|
||||
Named = $"{named}";
|
||||
Id = id;
|
||||
Immutable = immutable;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user