/// <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; } } }
/// <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); }
/// <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; } } }
/// <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; } } }
public bool RevertOperation() { if (OperationsStack.Count == 0) { return(false); } IOperationInterface Operation = OperationsStack.Pop(); CurrentNumber = Operation.Revert(); return(true); }
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(); }
/// <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); }
private void ExecuteOperation(IOperationInterface operation) { CurrentNumber = operation.Execute(); OperationsStack.Push(operation); }