Exemple #1
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)
            {
                ILine lineItem = item.As <ILine>();

                if (((lineItem != null) &&
                     this._parent.Lines.Remove(lineItem)))
                {
                    return(true);
                }
                if ((this._parent.Region == item))
                {
                    this._parent.Region = null;
                    return(true);
                }
                ISubstation substationItem = item.As <ISubstation>();

                if (((substationItem != null) &&
                     this._parent.Substations.Remove(substationItem)))
                {
                    return(true);
                }
                return(false);
            }
Exemple #2
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ILine linesCasted = item.As <ILine>();

                if ((linesCasted != null))
                {
                    this._parent.Lines.Add(linesCasted);
                }
                if ((this._parent.Region == null))
                {
                    IGeographicalRegion regionCasted = item.As <IGeographicalRegion>();
                    if ((regionCasted != null))
                    {
                        this._parent.Region = regionCasted;
                        return;
                    }
                }
                ISubstation substationsCasted = item.As <ISubstation>();

                if ((substationsCasted != null))
                {
                    this._parent.Substations.Add(substationsCasted);
                }
            }