コード例 #1
0
        public TileMapInfoWindow()
        {
            InitializeComponent();

            mDisplayer = new PropertyGridDisplayer();

            mDisplayer.ExcludeMember("TileWidth");
            mDisplayer.ExcludeMember("TileHeight");

            mDisplayer.IncludeMember("Cell Width",
                                     typeof(string),
                                     SetNumberOfTilesWide,
                                     GetTileWidth,
                                     new SpriteSheetCellWidthConverter());

            mDisplayer.IncludeMember("Cell Height",
                                     typeof(string),
                                     SetNumberOfTilesTall,
                                     GetTileHeight,
                                     new SpriteSheetCellWidthConverter());
        }
コード例 #2
0
        public static void ShowAllElementVariablesInPropertyGrid()
        {
            var element = GlueState.Self.CurrentElement;

            PropertyGridDisplayer displayer = new PropertyGridDisplayer();

            displayer.Instance = element;
            displayer.ExcludeAllMembers();
            displayer.RefreshOnTimer = false;

            displayer.PropertyGrid = MainGlueWindow.Self.PropertyGrid;


            foreach (CustomVariable variable in element.CustomVariables)
            {
                Type type = variable.GetRuntimeType();
                if (type == null)
                {
                    type = typeof(string);
                }

                string        name      = variable.Name;
                object        value     = variable.DefaultValue;
                TypeConverter converter = variable.GetTypeConverter(element);


                displayer.IncludeMember(name, type,
                                        delegate(object sender, MemberChangeArgs args)
                {
                    element.GetCustomVariableRecursively(name).DefaultValue = args.Value;
                }
                                        ,
                                        delegate()
                {
                    return(element.GetCustomVariableRecursively(name).DefaultValue);
                },
                                        converter);
            }
            MainGlueWindow.Self.PropertyGrid.SelectedObject = displayer;
        }