Ejemplo n.º 1
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ISwitch switchesCasted = item.As <ISwitch>();

                if ((switchesCasted != null))
                {
                    this._parent.Switches.Add(switchesCasted);
                }
                ILoadMgmtRecord loadMgmtRecordsCasted = item.As <ILoadMgmtRecord>();

                if ((loadMgmtRecordsCasted != null))
                {
                    this._parent.LoadMgmtRecords.Add(loadMgmtRecordsCasted);
                }
            }
Ejemplo n.º 2
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                ISwitch switchItem = item.As <ISwitch>();

                if (((switchItem != null) &&
                     this._parent.Switches.Remove(switchItem)))
                {
                    return(true);
                }
                ILoadMgmtRecord loadMgmtRecordItem = item.As <ILoadMgmtRecord>();

                if (((loadMgmtRecordItem != null) &&
                     this._parent.LoadMgmtRecords.Remove(loadMgmtRecordItem)))
                {
                    return(true);
                }
                return(false);
            }