Update avalonia

This commit is contained in:
TheXamlGuy
2024-07-23 22:37:36 +01:00
parent afe2222201
commit e7d505448e
5 changed files with 33 additions and 23 deletions
+26 -17
View File
@@ -2,23 +2,29 @@
namespace Wallet;
public partial class CommentEntryCollectionViewModel(IServiceProvider provider,
IServiceFactory factory,
IMediator mediator,
IPublisher publisher,
ISubscriber subscriber,
IDisposer disposer,
IContentTemplate template,
ItemState state,
ItemEntryConfiguration<ICollection<Comment>> configuration,
string key,
ICollection<Comment> value,
bool isConcealed,
bool isRevealed,
double width) : ItemEntryCollectionViewModel<ICommentEntryViewModel, ICollection<Comment>>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width),
public partial class CommentEntryCollectionViewModel : ItemEntryCollectionViewModel<ICommentEntryViewModel, ICollection<Comment>>,
INotificationHandler<CreateEventArgs<Comment>>
{
public IContentTemplate Template { get; set; } = template;
public CommentEntryCollectionViewModel(IServiceProvider provider,
IServiceFactory factory,
IMediator mediator,
IPublisher publisher,
ISubscriber subscriber,
IDisposer disposer,
IContentTemplate template,
ItemState state,
ItemEntryConfiguration<ICollection<Comment>> configuration,
string key,
ICollection<Comment> value,
bool isConcealed,
bool isRevealed,
double width) : base(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width)
{
Template = template;
UpdateState();
}
public IContentTemplate Template { get; set; }
public Task Handle(CreateEventArgs<Comment> args)
{
@@ -31,9 +37,12 @@ public partial class CommentEntryCollectionViewModel(IServiceProvider provider,
return Task.CompletedTask;
}
protected override void OnStateChanged()
protected override void OnStateChanged() =>
UpdateState();
private void UpdateState()
{
if (State is ItemState.Write)
if (State is ItemState.Write or ItemState.New)
{
Add<CreateCommentEntryViewModel>();
}