コード例 #1
0
        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));
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public CustomViewModel(RemoteControlBrush layerBrush, IWebServerService webServerService) : base(layerBrush)
        {
            RemoteControlBrush = layerBrush;

            BrushUrl = $"{webServerService.Server!.Listener.Prefixes.First().Replace("*", "localhost")}remote-control-brushes/{RemoteControlBrush.Layer.EntityId}";
        }