cleanup
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Hyperbar;
|
||||
|
||||
public interface IProvider<TParameter, TService>
|
||||
{
|
||||
TService? Get(TParameter value);
|
||||
}
|
||||
|
||||
public interface IProvider<TService>
|
||||
{
|
||||
TService? Get();
|
||||
}
|
||||
Reference in New Issue
Block a user