Beispiel #1
0
        /// <summary>
        /// Called whenever the parameters collection has changed.
        /// </summary>
        /// <param name="sender">Object that has raised the event</param>
        /// <param name="e">Information about the change</param>
        protected void OnParametersChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (Parameter param in parameters)
                {
                    _Parameter implParam = param as _Parameter;
                    if (implParam == null)
                    {
                        parameters.Remove(param);
                        throw new ArgumentException("Parameter element created outside the model library " +
                                                    "cannot be inserted to the operation!");
                    }

                    implParam.Operation = this;
                    adaptedElement.OwnedParameter.Add(implParam.Adaptee);
                }
            }
            else if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (Parameter param in parameters)
                {
                    _Parameter implParam = param as _Parameter;

                    implParam.Operation = null;
                    adaptedElement.OwnedParameter.Remove(implParam.Adaptee);
                }
            }
        }
Beispiel #2
0
        public Parameter AddParameter()
        {
            _Parameter param = new _Parameter(Schema);

            parameters.Add(param);
            param.Name = "Param" + parameters.Count;
            return(param);
        }