Ejemplo n.º 1
0
        public static void RemoveAttachment(this object parent, string name)
        {
            var attchments = WeakAttachmentsManager.GetAttachments(parent);

            if (attchments != null)
            {
                attchments.SetAttachment(name, null);
            }
        }
Ejemplo n.º 2
0
        public static object GetAttachment(this object parent, string name)
        {
            var attchments = WeakAttachmentsManager.GetAttachments(parent);

            if (attchments != null)
            {
                return(attchments.GetAttachment(name));
            }
            return(null);
        }
Ejemplo n.º 3
0
 public static void SetAttachment(this object parent, string name, object attach)
 {
     if (name == null)
     {
         ClearAttachments(parent);
     }
     else if (attach == null)
     {
         RemoveAttachment(parent, name);
     }
     else
     {
         WeakAttachmentsManager.GetOrCreateAttachments(parent).SetAttachment(name, attach);
     }
 }
Ejemplo n.º 4
0
 public static void ClearAttachments(this object parent)
 {
     WeakAttachmentsManager.ClearAttachments(parent);
 }