Ejemplo n.º 1
0
        private void AddMeta()
        {
            var item = new MenuItem
            {
                Header = "Set Metadata"
            };

            item.Click += delegate
            {
                var prefabTile = PlacementTarget as PrefabTile;
                if (prefabTile == null)
                {
                    return;
                }
                var tileData = prefabTile.DataContext as PrefabTileData;
                if (tileData == null)
                {
                    return;
                }

                tileData.Metadata = SetMetadata.GetString(tileData.Metadata);
            };
            AddChild(item);

            item = new MenuItem
            {
                Header = "Pull Value"
            };
            item.Click += delegate
            {
                var prefabTile = PlacementTarget as PrefabTile;
                if (prefabTile == null)
                {
                    return;
                }
                var room = PlacementTarget.GetParent <PrefabRoom>();

                ((PrefabTileData)room.PaintTile.DataContext).Reassign(prefabTile.DataContext as PrefabTileData);

                if (room.HasFile())
                {
                    room.Save();
                }
            };
            AddChild(item);
        }
Ejemplo n.º 2
0
        public static string GetString(string init = "")
        {
            var window = new SetMetadata(init);

            return(window.ShowDialog() != true ? init : window.Input.Text);
        }