Ensure containers show up in the menu when they are created

This commit is contained in:
TheXamlGuy
2024-05-12 17:09:59 +01:00
parent 4171a31f85
commit 5292896e13
6 changed files with 33 additions and 8 deletions
+8 -1
View File
@@ -1,3 +1,10 @@
namespace Toolkit.Foundation; namespace Toolkit.Foundation;
public record Activated; public record Activated<TValue>(TValue? Value = default);
public record Activated
{
public static Activated<TValue> As<TValue>(TValue value) => new(value);
public static Activated<TValue> As<TValue>() where TValue : new() => new(new TValue());
}
@@ -20,6 +20,6 @@ public class ConfigurationInitializer<TConfiguration>(IConfigurationReader<TConf
} }
} }
await publisher.PublishUI(new Changed<TConfiguration>(configuration)); await publisher.PublishUI(new Activated<TConfiguration>(configuration));
} }
} }
@@ -1,6 +1,6 @@
namespace Toolkit.Foundation; namespace Toolkit.Foundation;
public interface IContainer<T> public interface IValueStore<T>
{ {
T? Value { get; } T? Value { get; }
+4 -3
View File
@@ -92,12 +92,13 @@ public partial class ObservableViewModel<TKey, TValue>(IServiceProvider provider
IMediator mediator, IMediator mediator,
IPublisher publisher, IPublisher publisher,
ISubscriber subscriber, ISubscriber subscriber,
IDisposer disposer) : ObservableViewModel(provider, factory, mediator, publisher, subscriber, disposer) IDisposer disposer,
where TValue : notnull TValue? value = null) : ObservableViewModel(provider, factory, mediator, publisher, subscriber, disposer)
where TValue : class
{ {
[ObservableProperty] [ObservableProperty]
private TKey? key; private TKey? key;
[ObservableProperty] [ObservableProperty]
private TValue? value; private TValue? value = value;
} }
@@ -1,7 +1,7 @@
namespace Toolkit.Foundation; namespace Toolkit.Foundation;
public class Container<T> : public class ValueStore<T> :
IContainer<T> IValueStore<T>
{ {
public T? Value { get; private set; } public T? Value { get; private set; }
+17
View File
@@ -0,0 +1,17 @@
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Toolkit.UI.Controls;
public class AttachedFlyout : PopupFlyoutBase
{
protected override Control CreatePresenter()
{
throw new NotImplementedException();
}
}