Example #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)
            {
                if ((this._parent.Interface__OperationSignature == null))
                {
                    IOperationInterface interface__OperationSignatureCasted = item.As <IOperationInterface>();
                    if ((interface__OperationSignatureCasted != null))
                    {
                        this._parent.Interface__OperationSignature = interface__OperationSignatureCasted;
                        return;
                    }
                }
                IParameter parameters__OperationSignatureCasted = item.As <IParameter>();

                if ((parameters__OperationSignatureCasted != null))
                {
                    this._parent.Parameters__OperationSignature.Add(parameters__OperationSignatureCasted);
                }
                if ((this._parent.ReturnType__OperationSignature == null))
                {
                    IDataType returnType__OperationSignatureCasted = item.As <IDataType>();
                    if ((returnType__OperationSignatureCasted != null))
                    {
                        this._parent.ReturnType__OperationSignature = returnType__OperationSignatureCasted;
                        return;
                    }
                }
            }
Example #2
0
        /// <summary>
        /// Gets called when the parent model element of the current model element is about to change
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanging(IModelElement newParent, IModelElement oldParent)
        {
            IOperationInterface   oldInterface__OperationSignature = ModelHelper.CastAs <IOperationInterface>(oldParent);
            IOperationInterface   newInterface__OperationSignature = ModelHelper.CastAs <IOperationInterface>(newParent);
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldInterface__OperationSignature, newInterface__OperationSignature);

            this.OnInterface__OperationSignatureChanging(e);
            this.OnPropertyChanging("Interface__OperationSignature", e, _interface__OperationSignatureReference);
        }
Example #3
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.RequiredInterface__OperationRequiredRole == null))
     {
         IOperationInterface requiredInterface__OperationRequiredRoleCasted = item.As <IOperationInterface>();
         if ((requiredInterface__OperationRequiredRoleCasted != null))
         {
             this._parent.RequiredInterface__OperationRequiredRole = requiredInterface__OperationRequiredRoleCasted;
             return;
         }
     }
 }
Example #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.ProvidedInterface__OperationProvidedRole == null))
     {
         IOperationInterface providedInterface__OperationProvidedRoleCasted = item.As <IOperationInterface>();
         if ((providedInterface__OperationProvidedRoleCasted != null))
         {
             this._parent.ProvidedInterface__OperationProvidedRole = providedInterface__OperationProvidedRoleCasted;
             return;
         }
     }
 }
Example #5
0
        public bool RevertOperation()
        {
            if (OperationsStack.Count == 0)
            {
                return(false);
            }

            IOperationInterface Operation = OperationsStack.Pop();

            CurrentNumber = Operation.Revert();

            return(true);
        }
Example #6
0
        static void Main(string[] args)
        {
            //创建连接
            IOperationInterface service = InvokeContext.CreateWCFServiceByURL <IOperationInterface>("net.tcp://127.0.0.1:8888/Call");

            Console.Write(service.State);
            var result = service.Call(1, 3);

            Console.WriteLine(result);
            //service.Close();

            var result2 = service.Call(2, 3);

            Console.WriteLine(result2);
            Console.WriteLine("调用结束!");
            Console.Read();
        }
Example #7
0
        /// <summary>
        /// Gets called when the parent model element of the current model element changes
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanged(IModelElement newParent, IModelElement oldParent)
        {
            IOperationInterface oldInterface__OperationSignature = ModelHelper.CastAs <IOperationInterface>(oldParent);
            IOperationInterface newInterface__OperationSignature = ModelHelper.CastAs <IOperationInterface>(newParent);

            if ((oldInterface__OperationSignature != null))
            {
                oldInterface__OperationSignature.Signatures__OperationInterface.Remove(this);
            }
            if ((newInterface__OperationSignature != null))
            {
                newInterface__OperationSignature.Signatures__OperationInterface.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldInterface__OperationSignature, newInterface__OperationSignature);

            this.OnInterface__OperationSignatureChanged(e);
            this.OnPropertyChanged("Interface__OperationSignature", e, _interface__OperationSignatureReference);
            base.OnParentChanged(newParent, oldParent);
        }
Example #8
0
 private void ExecuteOperation(IOperationInterface operation)
 {
     CurrentNumber = operation.Execute();
     OperationsStack.Push(operation);
 }