public RemoteControlBrushModel GetRemoteControlBrush(Guid brushId) { RemoteControlBrush brush = _remoteControlService.Brushes.FirstOrDefault(b => b.Layer.EntityId == brushId); if (brush == null) { throw HttpException.NotFound("Remote control brush not found."); } return(new RemoteControlBrushModel(brush, true)); }
public RemoteControlBrushModel(RemoteControlBrush brush, bool includeLeds) { ProfileId = brush.Layer.Profile.EntityId; ProfileName = brush.Layer.Profile.Name; LayerName = brush.Layer.Name; LayerId = brush.Layer.EntityId; if (includeLeds) { LedColors = new List <RemoteControlColorModel>(brush.LedColors.Values); } }
public async Task RemoteControlBrushUpdateColors(Guid brushId) { RemoteControlBrush brush = _remoteControlService.Brushes.FirstOrDefault(b => b.Layer.EntityId == brushId); if (brush == null) { throw HttpException.NotFound("Remote control brush not found."); } List <RemoteControlColorModel> colorModels = await HttpContext.GetRequestDataAsync <List <RemoteControlColorModel> >(); brush.ApplyLedColors(colorModels); }
public CustomViewModel(RemoteControlBrush layerBrush, IWebServerService webServerService) : base(layerBrush) { RemoteControlBrush = layerBrush; BrushUrl = $"{webServerService.Server!.Listener.Prefixes.First().Replace("*", "localhost")}remote-control-brushes/{RemoteControlBrush.Layer.EntityId}"; }