コード例 #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)
            {
                if ((this._parent.OutageReport == item))
                {
                    this._parent.OutageReport = null;
                    return(true);
                }
                IOutageStep outageStepItem = item.As <IOutageStep>();

                if (((outageStepItem != null) &&
                     this._parent.OutageSteps.Remove(outageStepItem)))
                {
                    return(true);
                }
                IOutageCode outageCodeItem = item.As <IOutageCode>();

                if (((outageCodeItem != null) &&
                     this._parent.OutageCodes.Remove(outageCodeItem)))
                {
                    return(true);
                }
                return(false);
            }
コード例 #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)
            {
                if ((this._parent.OutageReport == null))
                {
                    IOutageReport outageReportCasted = item.As <IOutageReport>();
                    if ((outageReportCasted != null))
                    {
                        this._parent.OutageReport = outageReportCasted;
                        return;
                    }
                }
                IOutageStep outageStepsCasted = item.As <IOutageStep>();

                if ((outageStepsCasted != null))
                {
                    this._parent.OutageSteps.Add(outageStepsCasted);
                }
                IOutageCode outageCodesCasted = item.As <IOutageCode>();

                if ((outageCodesCasted != null))
                {
                    this._parent.OutageCodes.Add(outageCodesCasted);
                }
            }