コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: knabb215/Home-Dash
        private Panel CreateChildEntityPanel(Entity entity)
        {
            if (entity.Attributes.ContainsKey("hidden") && entity.Attributes["hidden"])
            {
                return(null);
            }

            PanelBuilderBase customEntity = CustomEntities.First(x => entity.EntityId.StartsWith(x.EntityIdStartsWith));

            return(customEntity.CreatePanel(entity));
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: knabb215/Home-Dash
        private Panel CreateGroupEntityPanel(Entity entity, IEnumerable <Entity> allStates)
        {
            if (entity.Attributes.ContainsKey("hidden") && entity.Attributes["hidden"])
            {
                return(null);
            }

            Newtonsoft.Json.Linq.JArray childrenEntityIds = entity.Attributes["entity_id"];

            PanelBuilderBase customEntity = CustomEntities.FirstOrDefault(x => childrenEntityIds.Any(y => y.ToString().StartsWith(x.EntityIdStartsWith)));

            IEnumerable <Entity> childrenEntities = allStates.Where(s => childrenEntityIds.Any(e => e.ToString() == s.EntityId));

            return(customEntity.CreateGroupPanel(entity, childrenEntities));
        }