Ejemplo n.º 1
0
        public List <string> GetAllNames(IGFXObject rootObject, int lvl)
        {
            List <string> lst = new List <string>();

            foreach (var item in rootObject.GetChildren())
            {
                lst.Add(" " + (new String('-', lvl)) + " " + item.Name);
                lst.AddRange(GetAllNames(item, lvl + 1));
            }
            return(lst);
        }
Ejemplo n.º 2
0
 public IGFXObject RemoveObject(IGFXObject obj)
 {
     if (obj != null)
     {
         String name = "";
         try
         {
             name = obj.Name;
             GFXObjects.Remove(obj.Name);
             this.UpdateFrame -= obj.Frame_Update;
             //if (obj is IHasSeperateAnimationEvent)
             // always assume SeperateAnimation events
             this.UpdateAnimation        -= obj.Animation_Update;
             obj.ParentContainer          = null; // invoke UnregisterAllVisuals. important to set before event is removed
             obj.RegisterDrawingVisual   -= this.RegisterVisual_Callback;
             obj.UnregisterDrawingVisual -= this.UnregisterVisual_Callback;
         }
         catch (Exception ex)
         {
             Debug.WriteLine("=> [GFXContainer]: failed to remove " + name);
         }
     }
     return(obj);
 }
Ejemplo n.º 3
0
 public void AddObject(IGFXObject obj, string name = null)
 {
     if (name == null)
     {
         name = obj.GetType().Name + "::" + obj.GetHashCode().ToString();
     }
     if ((obj.Name ?? "").Equals(""))
     {
         obj.Name = name;
     }
     if (GFXObjects.IndexOfKey(obj.Name) >= 0)
     {
         obj.Name += "#" + obj.GetHashCode().ToString();
     }
     GFXObjects.Add(obj.Name, obj);
     obj.RegisterDrawingVisual   += this.RegisterVisual_Callback;
     obj.UnregisterDrawingVisual += this.UnregisterVisual_Callback;
     obj.ParentContainer          = this;
     this.UpdateFrame            += obj.Frame_Update;
     //if (obj is IHasSeperateAnimationEvent)
     //this.UpdateAnimation += (obj as IHasSeperateAnimationEvent).Animation_Update;
     // always assume SeperateAnimation events
     this.UpdateAnimation += obj.Animation_Update;
 }
Ejemplo n.º 4
0
 public void RemoveObject(IGFXObject obj)
 {
     Children.Remove(obj);
 }
Ejemplo n.º 5
0
 public void AddObject(IGFXObject obj)
 {
     Children.Add(obj);
 }
Ejemplo n.º 6
0
 public void AddObject(IGFXObject obj, string name = null)
 {
     if (name == null) name = obj.GetType().Name + "::" + obj.GetHashCode().ToString();
     if ((obj.Name ?? "").Equals(""))
         obj.Name = name;
     if (GFXObjects.IndexOfKey(obj.Name) >= 0)
         obj.Name += "#" + obj.GetHashCode().ToString();
     GFXObjects.Add(obj.Name, obj);
     obj.RegisterDrawingVisual   += this.RegisterVisual_Callback;
     obj.UnregisterDrawingVisual += this.UnregisterVisual_Callback;
     obj.ParentContainer = this;
     this.UpdateFrame += obj.Frame_Update;
     //if (obj is IHasSeperateAnimationEvent)
     //this.UpdateAnimation += (obj as IHasSeperateAnimationEvent).Animation_Update;
     // always assume SeperateAnimation events
     this.UpdateAnimation += obj.Animation_Update;
 }
Ejemplo n.º 7
0
 public IGFXObject RemoveObject(IGFXObject obj)
 {
     if (obj != null)
     {
         String name = "";
         try
         {
             name = obj.Name;
             GFXObjects.Remove(obj.Name);
             this.UpdateFrame -= obj.Frame_Update;
             //if (obj is IHasSeperateAnimationEvent)
             // always assume SeperateAnimation events
             this.UpdateAnimation -= obj.Animation_Update;
             obj.ParentContainer = null; // invoke UnregisterAllVisuals. important to set before event is removed
             obj.RegisterDrawingVisual -= this.RegisterVisual_Callback;
             obj.UnregisterDrawingVisual -= this.UnregisterVisual_Callback;
         }
         catch (Exception ex)
         {
             Debug.WriteLine("=> [GFXContainer]: failed to remove " + name);
         }
     }
     return obj;
 }
Ejemplo n.º 8
0
 public List<string> GetAllNames(IGFXObject rootObject, int lvl)
 {
     List<string> lst = new List<string>();
     foreach (var item in rootObject.GetChildren())
     {
         lst.Add(" " + (new String('-', lvl)) + " " + item.Name);
         lst.AddRange(GetAllNames(item, lvl + 1));
     }
     return lst;
 }
Ejemplo n.º 9
0
 public void RemoveObject(IGFXObject obj)
 {
     Children.Remove(obj);
 }
Ejemplo n.º 10
0
 public void AddObject(IGFXObject obj)
 {
     Children.Add(obj);
 }
Ejemplo n.º 11
0
 public void RemoveObject(IGFXObject obj)
 {
     throw new NotImplementedException("A Leaf of a Composion cannot hold children.\nUse GFXComposition instead.");
 }