Exemplo n.º 1
0
        private void CreateAllPropertyViewers()
        {
            _propertyViewers = new Dictionary <Type, PropertyViewerBase>();

            foreach (var propViewerType in FindAllPropertyViewerTypes())
            {
                var propViewer = TryCreatePropertyViewer(propViewerType);
                if (propViewer == null)
                {
                    continue;
                }

                propViewerContainer.Controls.Add(propViewer);
                propViewer.Dock    = DockStyle.Fill;
                propViewer.Enabled = false;
                propViewer.Visible = false;

                if (propViewer.SupportedTypes != null)
                {
                    foreach (var supportedType in propViewer.SupportedTypes)
                    {
                        Debug.Assert(!_propertyViewers.ContainsKey(supportedType));
                        _propertyViewers[supportedType] = propViewer;
                    }
                }
                else
                {
                    _defaultPropertyViewer = propViewer;
                }
            }
        }
Exemplo n.º 2
0
        private void ShowViewer(PropertyViewerBase targetViewerBase)
        {
            var s = Size;

            foreach (var propertyViewer in GetAllPropertyViewers())
            {
                var isVisible = targetViewerBase == propertyViewer;
                propertyViewer.Enabled = isVisible;
                propertyViewer.Visible = isVisible;
            }

            // Prevent propertyViewer from changing size of the window when it's shown
            Size = s;
        }