This commit is contained in:
TheXamlGuy
2024-01-18 22:40:55 +00:00
parent 2fed876182
commit 19e83d5043
5 changed files with 26 additions and 34 deletions
@@ -59,13 +59,5 @@ public class PrimaryWidgetConfigurationHandler(IMediator mediator,
}
}
}
//foreach (KeyValuePair<Guid, IWidgetComponentViewModel> item in cache
// .Where(x => !items.Any(k => x.Key == k.Id)))
//{
// await mediator.PublishAsync(new Removed<IWidgetComponentViewModel>(item.Value),
// nameof(PrimaryWidgetViewModel),
// cancellationToken);
//}
}
}
@@ -2,20 +2,6 @@
namespace Hyperbar.Windows.Primary;
public class WidgetComponentViewModelProvider(ICache<Guid, IWidgetComponentViewModel> cache) :
IProvider<PrimaryCommandConfiguration, IWidgetComponentViewModel?>
{
public IWidgetComponentViewModel? Get(PrimaryCommandConfiguration value)
{
if (cache.TryGetValue(value.Id, out IWidgetComponentViewModel? viewModel))
{
return viewModel;
}
return default;
}
}
public class WidgetComponentViewModelFactory(IServiceFactory service,
IMediator mediator,
ICache<Guid, IWidgetComponentViewModel> cache) :
@@ -0,0 +1,15 @@
namespace Hyperbar.Windows.Primary;
public class WidgetComponentViewModelProvider(ICache<Guid, IWidgetComponentViewModel> cache) :
IProvider<PrimaryCommandConfiguration, IWidgetComponentViewModel?>
{
public IWidgetComponentViewModel? Get(PrimaryCommandConfiguration value)
{
if (cache.TryGetValue(value.Id, out IWidgetComponentViewModel? viewModel))
{
return viewModel;
}
return default;
}
}
-12
View File
@@ -10,15 +10,3 @@ public interface IFactory<TService>
{
TService? Create();
}
public interface IProvider<TParameter, TService>
{
TService? Get(TParameter value);
}
public interface IProvider<TService>
{
TService? Get();
}
+11
View File
@@ -0,0 +1,11 @@
namespace Hyperbar;
public interface IProvider<TParameter, TService>
{
TService? Get(TParameter value);
}
public interface IProvider<TService>
{
TService? Get();
}