public PropertySpecDescriptor(PropertySpec item, PropertyBag bag, string name, Attribute[] attrs)
     : base(name, attrs)
 {
     this.bag = bag;
     this.item = item;
 }
 /// <summary>
 /// Updates the underlying property bag, if this property needs one
 /// </summary>
 public void UpdateBag( )
 {
     if ( ObjectUITypeEditor.HandlesType( m_Property.PropertyType ) && ( Value != null ) )
     {
         m_Bag = new ExPropertyBag( Value );
     }
 }
        private static PropertyGrid CreateDebugInfoPropertyGrid( )
        {
            //	Can't just bung the a DebugInfo object into a property grid - it's all static properties
            //	Create a property bag containing those properties instead
            PropertyBag debugInfo = new PropertyBag( );

            foreach ( PropertyInfo property in typeof( DebugInfo ).GetProperties( BindingFlags.Static | BindingFlags.Public ) )
            {
                debugInfo.Properties.Add( new ExPropertySpec( property ) );
            }
            debugInfo.SetValue += ExPropertySpec.SetValue;
            debugInfo.GetValue += ExPropertySpec.GetValue;

            PropertyGrid debugInfoPropertyGrid = new PropertyGrid( );
            debugInfoPropertyGrid.SelectedObject = debugInfo;

            return debugInfoPropertyGrid;
        }
        private void ui_SelectionChanged( object sender, EventArgs e )
        {
            //	The selection has changed - if the user has selected a loadable asset, then present the load parameters
            //	in a property grid
            ISource[] sources = m_AssetBrowserUi.Sources;
            if ( sources.Length == 0 )
            {
                loadParametersGrid.SelectedObject = null;
                return;
            }

            IAssetLoader loader = AssetManager.Instance.FindLoaderForAsset( sources[ 0 ] );
            if ( loader == null )
            {
                return;
            }
            m_CurrentLoadParameters = loader.CreateDefaultParameters( true );

            //	Create a property bag from the dynamic properties
            PropertyBag bag = new PropertyBag( );

            string category = string.Format( Properties.Resources.LoaderProperties, loader.Name );
            foreach ( IDynamicProperty dynProperty in m_CurrentLoadParameters.Properties )
            {
                bag.Properties.Add( new DynPropertySpec( category, dynProperty ) );
            }
            if ( bag.Properties.Count == 0 )
            {
                return;
            }
            bag.SetValue += DynPropertySpec.SetValue;
            bag.GetValue += DynPropertySpec.GetValue;

            //	Add the property bag to the load parameters property grid
            loadParametersGrid.SelectedObject = bag;
        }
        /// <summary>
        /// Initialises this form
        /// </summary>
        public GameViewForm( GameSetup setup )
        {
            InitializeComponent( );
            m_Setup = setup;

            //	Create a property editor for the DebugInfo class

            //	Can't just bung the a DebugInfo object into a property grid - it's all static properties
            //	Create a property bag containing those properties instead
            PropertyBag debugInfo = new PropertyBag( );

            foreach ( PropertyInfo property in typeof( DebugInfo ).GetProperties( BindingFlags.Static | BindingFlags.Public ) )
            {
                debugInfo.Properties.Add( new ExPropertySpec( property ) );
            }
            debugInfo.SetValue += ExPropertySpec.SetValue;
            debugInfo.GetValue += ExPropertySpec.GetValue;

            PropertyGrid debugInfoProperties = new PropertyGrid( );
            debugInfoProperties.SelectedObject = debugInfo;

            //	Set up a docking manager
            m_DockingManager = new DockingManager( this, VisualStyle.IDE );
            m_DockingManager.InnerControl = gameDisplay;

            //	Add the property grid to the docking manager
            m_DebugInfoContent = m_DockingManager.Contents.Add( debugInfoProperties, "Debug Info" );
            m_DockingManager.AddContentWithState( m_DebugInfoContent, State.DockLeft );
        }