Exemple #1
0
        protected bool Add(AObject aObject)
        {
            bool result = false;

            if (aObject != null)
            {
                lock (_children)
                {
                    if (!DuplicateChildExists(aObject))
                    {
                        Activate(ActivationPurpose.Write);
                        _children.Add(aObject);
                        result = true;
                    }
                }

                if (result)
                {
                    aObject.Parent = this;

                    aObject.OnEnabledChanged += FireEnabledChanged;
                    aObject.OnChanged        += FireChanged;

                    var aObjects = aObject as AObjects;
                    if (aObjects != null)
                    {
                        aObjects.OnAdded   += FireAdded;
                        aObjects.OnRemoved += FireRemoved;
                    }
                    FireAdded(this, new EventArgs <AObject, AObject>(this, aObject));
                }
            }
            return(result);
        }
 public Notification(Notification.Types aType, AObject aObject1, AObject aObject2 = null)
 {
     _type    = aType;
     _object1 = aObject1;
     _object2 = aObject2;
     _time    = DateTime.Now;
 }
Exemple #3
0
        public AObject WithGuid(Guid aGuid)
        {
            if (aGuid == Guid.Empty)
            {
                return(null);
            }
            if (Guid == aGuid)
            {
                return(this);
            }

            AObject tObjectReturn = null;

            foreach (AObject tObject in Children)
            {
                if (tObject.Guid == aGuid)
                {
                    tObjectReturn = tObject;
                    break;
                }
                var tObjects = tObject as AObjects;
                if (tObjects != null)
                {
                    tObjectReturn = tObjects.WithGuid(aGuid);
                    if (tObjectReturn != null)
                    {
                        break;
                    }
                }
            }
            return(tObjectReturn);
        }
Exemple #4
0
        protected bool Remove(AObject aObject)
        {
            bool result = false;

            if (aObject != null)
            {
                lock (_children)
                {
                    Activate(ActivationPurpose.Write);
                    result = _children.Remove(aObject);
                }

                if (result)
                {
                    aObject.OnEnabledChanged -= FireEnabledChanged;
                    aObject.OnChanged        -= FireChanged;

                    var aObjects = aObject as AObjects;
                    if (aObjects != null)
                    {
                        aObjects.OnAdded   -= FireAdded;
                        aObjects.OnRemoved -= FireRemoved;
                    }
                    FireRemoved(this, new EventArgs <AObject, AObject>(this, aObject));
                }
            }
            return(result);
        }
Exemple #5
0
 protected override bool DuplicateChildExists(AObject aObject)
 {
     return(WithParameters(aObject.Name, (aObject as Search).Size) != null);
 }
Exemple #6
0
        public new Search WithGuid(Guid aGuid)
        {
            AObject tObject = base.WithGuid(aGuid);

            return(tObject != null ? (Search)tObject : null);
        }
Exemple #7
0
 protected override bool DuplicateChildExists(AObject aObject)
 {
     return(Bot((aObject as Bot).Name) != null);
 }
Exemple #8
0
 protected override bool DuplicateChildExists(AObject aObject)
 {
     return(Packet((aObject as Packet).Id) != null);
 }
Exemple #9
0
 protected override bool DuplicateChildExists(AObject aObject)
 {
     return(Server(aObject.Name) != null);
 }
Exemple #10
0
        public new ApiKey WithGuid(Guid aGuid)
        {
            AObject tObject = base.WithGuid(aGuid);

            return(tObject != null ? (ApiKey)tObject : null);
        }
Exemple #11
0
        public new ApiKey Named(string aName)
        {
            AObject tObject = base.Named(aName);

            return(tObject != null ? (ApiKey)tObject : null);
        }
 protected override bool DuplicateChildExists(AObject aObject)
 {
     return(File((aObject as File).TmpName) != null);
 }
Exemple #13
0
 protected override bool DuplicateChildExists(AObject aObject)
 {
     return(false);
 }
Exemple #14
0
 protected abstract bool DuplicateChildExists(AObject aObject);
Exemple #15
0
 protected override bool DuplicateChildExists(AObject aObject)
 {
     return(Channel((aObject as Channel).Name) != null);
 }