Exemple #1
0
        /// <summary>
        /// Toggles the visibility of the non-active layers
        /// </summary>
        public void ToggleNonActiveLayersVisibility()
        {
            // The event can only happen when there is more than 1 layer registered
            if (_controller.LayerCount == 1)
            {
                return;
            }

            _ignoreLayerStatusEvents = true;

            // Find the index of the first non-active layer
            int index = _controller.ActiveLayerIndex == _controller.LayerCount - 1 ? _controller.LayerCount - 2 : _controller.LayerCount - 1;

            bool newValue = !_layerControls[index].LayerVisible;

            // Switch the layer visibility
            foreach (var control in _layerControls)
            {
                if (control.Layer.Index != _controller.ActiveLayerIndex)
                {
                    control.LayerVisible = newValue;
                }
            }

            _ignoreLayerStatusEvents = false;

            // Call the notification event
            LayerStatusesUpdated?.Invoke(this, new EventArgs());
        }
Exemple #2
0
        //
        // Layer Status Changed event handler
        //
        private void OnLayerStatusChanged(object sender, LayerControlStatusChangedEventArgs args)
        {
            if (_ignoreLayerStatusEvents)
            {
                return;
            }

            LayerStatusesUpdated?.Invoke(this, new EventArgs());
        }
Exemple #3
0
        /// <summary>
        /// Resets the transparencies of all the layers to be fully opaque again
        /// </summary>
        public void ResetTransparencies()
        {
            _ignoreLayerStatusEvents = true;

            // Switch the layer visibility
            foreach (var control in _layerControls)
            {
                control.Transparency = 1;
            }

            _ignoreLayerStatusEvents = false;

            // Call the notification event
            LayerStatusesUpdated?.Invoke(this, new EventArgs());
        }