Allow subscription keys to be resolved by reflection
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<UserControl
|
||||
<SettingsExpander
|
||||
x:Class="Bitvault.Avalonia.AddItemNavigationView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<SettingsExpander Header="Add item" IsClickEnabled="True" />
|
||||
</UserControl>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Header="Add item"
|
||||
IsClickEnabled="True" />
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Avalonia.Controls;
|
||||
using Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class AddItemNavigationView : UserControl
|
||||
public partial class AddItemNavigationView :
|
||||
SettingsExpander
|
||||
{
|
||||
public AddItemNavigationView() => InitializeComponent();
|
||||
public AddItemNavigationView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -136,6 +136,13 @@ public partial class App : Application
|
||||
services.AddHandler<AggregateItemContentViewModelHandler>();
|
||||
services.AddHandler<AggregateItemContentFromCategoryViewModelHandler>();
|
||||
|
||||
services.AddTemplate<ItemSectionViewModel, ItemSectionView>();
|
||||
|
||||
services.AddTemplate<ItemTextEntryViewModel, ItemTextEntryView>();
|
||||
services.AddTemplate<ItemPasswordEntryViewModel, ItemPasswordEntryView>();
|
||||
services.AddTemplate<ItemMaskedTextEntryViewModel, ItemMaskedTextEntryView>();
|
||||
services.AddTemplate<ItemDropdownEntryViewModel, ItemDropdownEntryView>();
|
||||
|
||||
services.AddTemplate<ItemCommandHeaderViewModel, ItemCommandHeaderView>("ItemCommandHeader");
|
||||
|
||||
services.AddTemplate<FavouriteItemActionViewModel, FavouriteItemActionView>();
|
||||
@@ -146,11 +153,6 @@ public partial class App : Application
|
||||
services.AddTemplate<EditItemActionViewModel, EditItemActionView>();
|
||||
services.AddTemplate<DeleteItemActionViewModel, DeleteItemActionView>();
|
||||
|
||||
services.AddTemplate<ItemTextEntryViewModel, ItemTextEntryView>();
|
||||
services.AddTemplate<ItemPasswordEntryViewModel, ItemPasswordEntryView>();
|
||||
services.AddTemplate<ItemMaskedTextEntryViewModel, ItemMaskedTextEntryView>();
|
||||
services.AddTemplate<ItemDropdownEntryViewModel, ItemDropdownEntryView>();
|
||||
|
||||
services.AddHandler<ConfirmUpdateItemHandler>(nameof(ItemState.Write));
|
||||
services.AddHandler<ConfirmCreateItemHandler>(nameof(ItemState.New));
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Bitvault.Avalonia.ItemDropdownEntryView">
|
||||
Welcome to Avalonia!
|
||||
</UserControl>
|
||||
<SettingsExpander
|
||||
x:Class="Bitvault.Avalonia.ItemDropdownEntryView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:ItemDropdownEntryViewModel"
|
||||
Header="{Binding Key}">
|
||||
<SettingsExpander.Footer>
|
||||
<TextBox MinWidth="264" />
|
||||
</SettingsExpander.Footer>
|
||||
</SettingsExpander>
|
||||
@@ -1,12 +1,10 @@
|
||||
using Avalonia.Controls;
|
||||
using Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
namespace Bitvault.Avalonia
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class ItemDropdownEntryView :
|
||||
SettingsExpander
|
||||
{
|
||||
public partial class ItemDropdownEntryView : UserControl
|
||||
{
|
||||
public ItemDropdownEntryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
public ItemDropdownEntryView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Bitvault.Avalonia.ItemMaskedTextEntryView">
|
||||
Welcome to Avalonia!
|
||||
</UserControl>
|
||||
<SettingsExpander
|
||||
x:Class="Bitvault.Avalonia.ItemMaskedTextEntryView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:ItemMaskedTextEntryViewModel"
|
||||
Header="{Binding Key}">
|
||||
<SettingsExpander.Footer>
|
||||
<TextBox MinWidth="264" />
|
||||
</SettingsExpander.Footer>
|
||||
</SettingsExpander>
|
||||
@@ -1,12 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
using Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
namespace Bitvault.Avalonia
|
||||
{
|
||||
public partial class ItemMaskedTextEntryView : UserControl
|
||||
public partial class ItemMaskedTextEntryView :
|
||||
SettingsExpander
|
||||
{
|
||||
public ItemMaskedTextEntryView()
|
||||
{
|
||||
public ItemMaskedTextEntryView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Bitvault.Avalonia.ItemPasswordEntryView">
|
||||
Welcome to Avalonia!
|
||||
</UserControl>
|
||||
<SettingsExpander
|
||||
x:Class="Bitvault.Avalonia.ItemPasswordEntryView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:ItemPasswordEntryViewModel"
|
||||
Header="{Binding Key}">
|
||||
<SettingsExpander.Footer>
|
||||
<TextBox
|
||||
MinWidth="264"
|
||||
Classes="revealPasswordButton"
|
||||
PasswordChar="●" />
|
||||
</SettingsExpander.Footer>
|
||||
</SettingsExpander>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using Avalonia.Controls;
|
||||
using Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
namespace Bitvault.Avalonia
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class ItemPasswordEntryView :
|
||||
SettingsExpander
|
||||
{
|
||||
public partial class ItemPasswordEntryView : UserControl
|
||||
{
|
||||
public ItemPasswordEntryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
public ItemPasswordEntryView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.ItemSectionView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:ItemSectionViewModel">
|
||||
<ItemsControl ItemTemplate="{ReflectionBinding Template}" ItemsSource="{Binding}" />
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class ItemSectionView :
|
||||
UserControl
|
||||
{
|
||||
public ItemSectionView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Bitvault.Avalonia.ItemTextEntryView">
|
||||
Welcome to Avalonia!
|
||||
</UserControl>
|
||||
<SettingsExpander
|
||||
x:Class="Bitvault.Avalonia.ItemTextEntryView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:ItemTextEntryViewModel"
|
||||
Header="{Binding Key}">
|
||||
<SettingsExpander.Footer>
|
||||
<TextBox MinWidth="264" />
|
||||
</SettingsExpander.Footer>
|
||||
</SettingsExpander>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using Avalonia.Controls;
|
||||
using Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
namespace Bitvault.Avalonia
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class ItemTextEntryView :
|
||||
SettingsExpander
|
||||
{
|
||||
public partial class ItemTextEntryView : UserControl
|
||||
{
|
||||
public ItemTextEntryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
public ItemTextEntryView() =>
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public class AggregateItemContentFromCategoryViewModelHandler(IItemConfigurationCollection configurations,
|
||||
IServiceFactory serviceFactory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<AggerateEventArgs<IItemEntryViewModel, string>>
|
||||
@@ -15,12 +16,21 @@ public class AggregateItemContentFromCategoryViewModelHandler(IItemConfiguration
|
||||
{
|
||||
if (factory.Invoke() is ItemConfiguration configuration)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
foreach (ItemSectionConfiguration section in configuration.Sections)
|
||||
{
|
||||
foreach (ItemEntryConfiguration entryConfiguration in section.Entries)
|
||||
if (serviceFactory.Create<ItemSectionViewModel>($"{nameof(ItemSection)}{index}") is ItemSectionViewModel sectionViewModel)
|
||||
{
|
||||
var dod = await mediator.Handle<ItemEntryConfiguration, IItemEntryViewModel?>(entryConfiguration,
|
||||
entryConfiguration.GetType().Name);
|
||||
publisher.Publish(Create.As(sectionViewModel), nameof(ItemContentViewModel));
|
||||
foreach (ItemEntryConfiguration entryConfiguration in section.Entries)
|
||||
{
|
||||
if (await mediator.Handle<ItemEntryConfiguration, IItemEntryViewModel?>(entryConfiguration,
|
||||
entryConfiguration.GetType().Name) is IItemEntryViewModel entryViewModel)
|
||||
{
|
||||
publisher.Publish(Create.As(entryViewModel), $"{nameof(ItemSection)}{index}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,22 +8,16 @@ public class ConfirmCreateItemHandler(IMediator mediator,
|
||||
{
|
||||
public async Task Handle(ConfirmEventArgs<Item> args)
|
||||
{
|
||||
ItemHeaderConfiguration? configuration = await mediator.Handle<ConfirmEventArgs<Item>,
|
||||
ItemHeaderConfiguration>(args);
|
||||
string? name = await mediator.Handle<ConfirmEventArgs<Item>,
|
||||
string?>(args, nameof(ItemHeader));
|
||||
|
||||
if (configuration is not null)
|
||||
if (name is not null)
|
||||
{
|
||||
publisher.Publish(Notify.As(configuration));
|
||||
|
||||
Guid id = Guid.NewGuid();
|
||||
|
||||
string? name = configuration.Name;
|
||||
string? category = configuration.Name;
|
||||
|
||||
publisher.Publish(Created.As(new Item<(Guid, string)>((id, name))));
|
||||
|
||||
await mediator.Handle<CreateEventArgs<(Guid, string, string,
|
||||
ItemConfiguration)>, bool>(new CreateEventArgs<(Guid, string, string, ItemConfiguration)>((id, name, category,
|
||||
ItemConfiguration)>, bool>(new CreateEventArgs<(Guid, string, string, ItemConfiguration)>((id, name, "",
|
||||
new ItemConfiguration())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
[Notification(typeof(AggerateEventArgs<ItemNavigationViewModel>), nameof(ItemCollectionViewModel))]
|
||||
[Notification(typeof(CreateEventArgs<ItemNavigationViewModel>), nameof(ItemCollectionViewModel))]
|
||||
[Notification(typeof(InsertEventArgs<ItemNavigationViewModel>), nameof(ItemCollectionViewModel))]
|
||||
[Notification(typeof(MoveToEventArgs<ItemNavigationViewModel>), nameof(ItemCollectionViewModel))]
|
||||
|
||||
@@ -44,13 +44,25 @@ public record ItemConfiguration
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static ItemConfiguration Login => new()
|
||||
{
|
||||
Sections = new List<ItemSectionConfiguration>
|
||||
{
|
||||
|
||||
new()
|
||||
{
|
||||
Entries = new List<ItemEntryConfiguration>
|
||||
{
|
||||
new TextEntryConfiguration
|
||||
{
|
||||
Label = "Username"
|
||||
},
|
||||
new PasswordEntryConfiguration
|
||||
{
|
||||
Label = "Password"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -58,7 +70,16 @@ public record ItemConfiguration
|
||||
{
|
||||
Sections = new List<ItemSectionConfiguration>
|
||||
{
|
||||
|
||||
new()
|
||||
{
|
||||
Entries = new List<ItemEntryConfiguration>
|
||||
{
|
||||
new PasswordEntryConfiguration
|
||||
{
|
||||
Label = "Password"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public record ItemContent;
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
[Notification(typeof(CreateEventArgs<ItemSectionViewModel>), nameof(ItemContentViewModel))]
|
||||
public partial class ItemContentViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory, IMediator mediator,
|
||||
IPublisher publisher,
|
||||
@@ -9,7 +10,7 @@ public partial class ItemContentViewModel(IServiceProvider provider,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template,
|
||||
ItemState state = ItemState.Read) :
|
||||
ObservableCollection<IItemEntryViewModel>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
ObservableCollection<ItemSectionViewModel>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
IItemEntryViewModel,
|
||||
INotificationHandler<NotifyEventArgs<ItemCategory<string>>>
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ public partial class ItemDropdownEntryViewModel(IServiceProvider provider,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer) :
|
||||
Observable(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
IDisposer disposer,
|
||||
string? key = default,
|
||||
object? value = default) : Observable<string, object?>(provider, factory, mediator, publisher, subscriber, disposer, key, value),
|
||||
IItemEntryViewModel;
|
||||
|
||||
@@ -8,7 +8,7 @@ public class ItemDropdownEntryViewModelHandler(IServiceFactory serviceFactory) :
|
||||
public Task<IItemEntryViewModel?> Handle(DropdownEntryConfiguration args,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (serviceFactory.Create<ItemDropdownEntryViewModel>() is ItemDropdownEntryViewModel viewModel)
|
||||
if (serviceFactory.Create<ItemDropdownEntryViewModel>(args.Label, args.Value ?? new object()) is ItemDropdownEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public record ItemHeader;
|
||||
@@ -3,9 +3,11 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class ItemHeaderViewModel : Observable<string, string>,
|
||||
[Notification(typeof(ConfirmEventArgs<Item>), nameof(ItemHeader))]
|
||||
public partial class ItemHeaderViewModel :
|
||||
Observable<string, string>,
|
||||
IHandler<ValidationEventArgs<Item>, bool>,
|
||||
IHandler<ConfirmEventArgs<Item>, ItemHeaderConfiguration>,
|
||||
IHandler<ConfirmEventArgs<Item>, string?>,
|
||||
INotificationHandler<UpdateEventArgs<Item>>,
|
||||
INotificationHandler<ConfirmEventArgs<Item>>,
|
||||
INotificationHandler<CancelEventArgs<Item>>,
|
||||
@@ -38,9 +40,6 @@ public partial class ItemHeaderViewModel : Observable<string, string>,
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public Task<ItemHeaderConfiguration> Handle(ConfirmEventArgs<Item> args,
|
||||
CancellationToken cancellationToken) => Task.FromResult(new ItemHeaderConfiguration { Name = Value! });
|
||||
|
||||
public Task Handle(UpdateEventArgs<Item> args) =>
|
||||
Task.FromResult(State = ItemState.Write);
|
||||
|
||||
@@ -69,4 +68,7 @@ public partial class ItemHeaderViewModel : Observable<string, string>,
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task<string?> Handle(ConfirmEventArgs<Item> args,
|
||||
CancellationToken cancellationToken) => Task.FromResult(Value);
|
||||
}
|
||||
@@ -7,5 +7,7 @@ public partial class ItemMaskedTextEntryViewModel(IServiceProvider provider,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer) : Observable(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
IItemEntryViewModel;
|
||||
IDisposer disposer,
|
||||
string? key = default,
|
||||
object? value = default) : Observable<string, object?>(provider, factory, mediator, publisher, subscriber, disposer, key, value),
|
||||
IItemEntryViewModel;
|
||||
|
||||
@@ -8,7 +8,7 @@ public class ItemMaskedTextEntryViewModelHandler(IServiceFactory serviceFactory)
|
||||
public Task<IItemEntryViewModel?> Handle(MaskedTextEntryConfiguration args,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (serviceFactory.Create<ItemMaskedTextEntryViewModel>() is ItemMaskedTextEntryViewModel viewModel)
|
||||
if (serviceFactory.Create<ItemMaskedTextEntryViewModel>(args.Label, args.Value ?? new object()) is ItemMaskedTextEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
}
|
||||
|
||||
@@ -7,5 +7,7 @@ public partial class ItemPasswordEntryViewModel(IServiceProvider provider,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer) : Observable(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
IItemEntryViewModel;
|
||||
IDisposer disposer,
|
||||
string? key = default,
|
||||
object? value = default) : Observable<string, object?>(provider, factory, mediator, publisher, subscriber, disposer, key, value),
|
||||
IItemEntryViewModel;
|
||||
|
||||
@@ -8,7 +8,7 @@ public class ItemPasswordEntryViewModelHandler(IServiceFactory serviceFactory) :
|
||||
public Task<IItemEntryViewModel?> Handle(PasswordEntryConfiguration args,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (serviceFactory.Create<ItemPasswordEntryViewModel>() is ItemPasswordEntryViewModel viewModel)
|
||||
if (serviceFactory.Create<ItemPasswordEntryViewModel>(args.Label, args.Value ?? new object()) is ItemPasswordEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public record ItemSection;
|
||||
@@ -0,0 +1,17 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
[Notification(typeof(CreateEventArgs<IItemEntryViewModel>), nameof(Section))]
|
||||
public partial class ItemSectionViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer,
|
||||
string section) : ObservableCollection<IItemEntryViewModel>(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string section = section;
|
||||
}
|
||||
@@ -7,5 +7,7 @@ public partial class ItemTextEntryViewModel(IServiceProvider provider,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer) : Observable(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
IItemEntryViewModel;
|
||||
IDisposer disposer,
|
||||
string? key = default,
|
||||
string? value = default) : Observable<string, string>(provider, factory, mediator, publisher, subscriber, disposer, key, value),
|
||||
IItemEntryViewModel;
|
||||
|
||||
@@ -8,7 +8,7 @@ public class ItemTextEntryViewModelHandler(IServiceFactory serviceFactory) :
|
||||
public Task<IItemEntryViewModel?> Handle(TextEntryConfiguration args,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (serviceFactory.Create<ItemTextEntryViewModel>() is ItemTextEntryViewModel viewModel)
|
||||
if (serviceFactory.Create<ItemTextEntryViewModel>(args.Label, args.Value ?? "") is ItemTextEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user