예제 #1
0
        public async Task <ActionResult <AddPanelResponse> > PostAddPanel([FromBody] AddPanelRequest addPanelRequest)
        {
            var newPanel = new Data.Panel
            {
                SymbolicName = addPanelRequest.Panel.SymbolicName,
                PluginName   = addPanelRequest.Panel.PluginName,
                GroupId      = addPanelRequest.Panel.GroupId
            };

            newPanel.ConfigParameters = addPanelRequest.Panel.ConfigValues.Select(x => new Data.ConfigParameterValue
            {
                SymbolicName = x.SymbolicName,
                Value        = x.Value?.ToString(),
                Panel        = newPanel,
            }).ToList();

            _Context.Panels.Add(newPanel);

            await _Context.SaveChangesAsync();

            _logger.LogDebug("Added new Panel {SymbolicName}({PluginName})", newPanel.SymbolicName, newPanel.PluginName);

            await _ClientHub.Clients.All.SendAsync(ClientMethods.AddOrUpdatePanel, newPanel);

            await _PluginContext.Subscribe(newPanel.ID, addPanelRequest.Panel.PluginName, addPanelRequest.Panel.SymbolicName, newPanel.ConfigParameters.ToDictionary(x => x.SymbolicName, x => x.Value));

            return(Ok(new AddPanelResponse()));
        }
예제 #2
0
    protected override void OnInitialized()
    {
        base.OnInitialized();

        renderChildPolicy = Policy.Child();

        Area.Width  = Width;
        Area.Height = Height;

        Data.Init(false);

        Data.Render(true);

        Panel  = Data.Panels[0];
        xscale = Panel.X;
        yscale = Panel.Y;

        Panel.Register(this);
    }