public bool AddLayer(StreamDeckLayer streamDeckLayer)
        {
            if (streamDeckLayer == null || string.IsNullOrEmpty(streamDeckLayer.Name))
            {
                return(false);
            }

            if (!LayerList.Contains(streamDeckLayer))
            {
                LayerList.Add(streamDeckLayer);
            }

            SetActiveLayer(streamDeckLayer.Name);
            return(true);
        }
Example #2
0
        public void ImportButtons(EnumButtonImportMode importMode, List <ButtonExport> buttonExports)
        {
            var importLayerNames = buttonExports.Select(o => o.LayerName).Distinct().ToList();

            foreach (var importLayerName in importLayerNames)
            {
                if (!LayerExists(importLayerName))
                {
                    var newLayer = new StreamDeckLayer {
                        Name = importLayerName
                    };
                    AddLayer(newLayer);
                }

                var layer = GetLayer(importLayerName);
                layer.ImportButtons(importMode, buttonExports);
            }
        }
        private void CheckHomeLayerStatus()
        {
            var found = false;

            foreach (var streamDeckLayer in _layerList)
            {
                if (streamDeckLayer.Name == CommonStreamDeck.HOME_LAYER_NAME)
                {
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                var streamDeckLayer = new StreamDeckLayer();
                streamDeckLayer.Name = CommonStreamDeck.HOME_LAYER_NAME;
                _layerList.Insert(0, streamDeckLayer);
            }

            CheckActiveLayer();
        }
        private void CheckHomeLayerExists()
        {
            var found = false;

            foreach (var streamDeckLayer in _layerList)
            {
                if (streamDeckLayer.Name == StreamDeckConstants.HOME_LAYER_NAME)
                {
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                var streamDeckLayer = new StreamDeckLayer(_streamDeckPanel);
                streamDeckLayer.Name = StreamDeckConstants.HOME_LAYER_NAME;
                _layerList.Insert(0, streamDeckLayer);
            }

            CheckSelectedLayer();
        }