Ejemplo n.º 1
0
        protected UIElementEditor(UIElementEditor parent, Element element, AssetManager assetManager)
        {
            this.parent = parent;
            Element = element;
            this.assetManager = assetManager;

            Childs = new ObservableCollection<UIElementEditor>(element.Childs.ToList().Select(e => UIElementEditor.Create(this, e, assetManager)));
            Childs.CollectionChanged += (o, e) => TreeChanged(this, EventArgs.Empty);

            TreeChanged += (o, e) =>
            {
                if (this.parent != null)
                    this.parent.TreeChanged(this, EventArgs.Empty);
            };

            Operations = new List<Operation>()
            {
                new Operation() { Name = "Delete", Command = new DelegateCommand(Delete, CanDelete) },
                new Operation() { Name = "Add Image", Command = new DelegateCommand(AddImage) },
                new Operation() { Name = "Add TextBlock", Command = new DelegateCommand(AddTextBlock) },
                new Operation() { Name = "Add Button", Command = new DelegateCommand(AddButton) }
            };
        }
Ejemplo n.º 2
0
 public static UIElementEditor Create(UIElementEditor parent, Element element, AssetManager assetManager)
 {
     if (element.Type == ElementType.Custom || element.Type == ElementType.Layout)
         return new UIElementEditor(parent, element, assetManager);
     else if (element.Type == ElementType.Image)
         return new ImageElementEditor(parent, element, assetManager);
     else if (element.Type == ElementType.TextBlock)
         return new TextBlockElementEditor(parent, element, assetManager);
     else if (element.Type == ElementType.Button)
         return new ButtonElementEditor(parent, element, assetManager);
     else
         throw new ArgumentException("unknown element type: " + element.ToString());
 }
Ejemplo n.º 3
0
 public ImageElementEditor(UIElementEditor parent, Element element, AssetManager assetManager)
     : base(parent, element, assetManager)
 {
 }
Ejemplo n.º 4
0
 public TextBlockElementEditor(UIElementEditor parent, Element element, AssetManager assetManager)
     : base(parent, element, assetManager)
 {
 }
Ejemplo n.º 5
0
 public ButtonElementEditor(UIElementEditor parent, Element element, AssetManager assetManager)
     : base(parent, element, assetManager)
 {
     this.button = element as Button;
 }