예제 #1
0
파일: Sensor.cs 프로젝트: lukeIam/NMF
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ITrackElement elementsCasted = item.As <ITrackElement>();

                if ((elementsCasted != null))
                {
                    this._parent.Elements.Add(elementsCasted);
                }
            }
예제 #2
0
파일: Sensor.cs 프로젝트: lukeIam/NMF
            /// <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)
            {
                ITrackElement trackElementItem = item.As <ITrackElement>();

                if (((trackElementItem != null) &&
                     this._parent.Elements.Remove(trackElementItem)))
                {
                    return(true);
                }
                return(false);
            }
예제 #3
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)
            {
                if ((this._parent.Sensor == item))
                {
                    this._parent.Sensor = null;
                    return(true);
                }
                ITrackElement trackElementItem = item.As <ITrackElement>();

                if (((trackElementItem != null) &&
                     this._parent.ConnectsTo.Remove(trackElementItem)))
                {
                    return(true);
                }
                return(false);
            }
예제 #4
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                if ((this._parent.Sensor == null))
                {
                    ISensor sensorCasted = item.As <ISensor>();
                    if ((sensorCasted != null))
                    {
                        this._parent.Sensor = sensorCasted;
                        return;
                    }
                }
                ITrackElement connectsToCasted = item.As <ITrackElement>();

                if ((connectsToCasted != null))
                {
                    this._parent.ConnectsTo.Add(connectsToCasted);
                }
            }