21 lines
756 B
C#
21 lines
756 B
C#
|
|
|
|
namespace Hyperbar.Windows.Primary;
|
|
|
|
public class WidgetComponentMappingHandler(PrimaryWidgetConfiguration configuration,
|
|
IServiceFactory service,
|
|
IMediator mediator) :
|
|
IMappingHandler<PrimaryWidgetConfiguration, IEnumerable<IWidgetComponentViewModel>>
|
|
{
|
|
public IEnumerable<IWidgetComponentViewModel> Map()
|
|
{
|
|
foreach (IPrimaryCommandConfiguration item in configuration)
|
|
{
|
|
if (item is KeyAcceleratorCommandConfiguration keyAcceleratorCommand)
|
|
{
|
|
yield return service.Create<WidgetButtonViewModel>(keyAcceleratorCommand.Icon, new Action(async () =>
|
|
await mediator.SendAsync(new KeyAcceleratorCommand(VirtualKey.LeftWindows))));
|
|
}
|
|
}
|
|
}
|
|
} |