コード例 #1
0
    public void BuildView(IEnumerable <Layer> layers)
    {
        Layers = new List <Layer>(layers);
        Layers.Reverse();
        List <TreeItem> itemList = new List <TreeItem> ();


        Root.Clear();
        foreach (var layer in Layers)
        {
            var objectNames = layer.ObjectPath.Split('/');
            var depth       = objectNames.Length - 1;
            var item        = new TreeItem(layer);
            if (depth <= 0)
            {
                Root.AddChild(item);
            }
            else
            {
                var parent = itemList.FirstOrDefault(x => PSDEditorWindow.IsParent(x.Layer, layer));
                if (parent != null)
                {
                    parent.AddChild(item);
                }
            }
            itemList.Add(item);
        }
    }