private void SelectServiceOperation(OperationInfoBase operationInfo) { Fx.Assert(operationInfo != null, "operationInfo cannot be null"); ServiceContractListItem serviceContract = this.serviceContracts.Find(operationInfo.GetContractFullName(null)); // Dont select operation if the contract cannot be found in the serviceContracts list if (serviceContract == null) { return; } ServiceOperationListItem operationItem = null; if (operationInfo is OperationInfo) { operationItem = new WorkflowServiceOperationListItem(); operationItem.Validating += new CancelEventHandler(ServiceOperationValidating); operationItem.Name = operationInfo.Name; ((WorkflowServiceOperationListItem)operationItem).Operation = operationInfo as OperationInfo; } else if (operationInfo is TypedOperationInfo) { operationItem = new TypedServiceOperationListItem(); operationItem.Validating += new CancelEventHandler(ServiceOperationValidating); operationItem.Name = operationInfo.Name; ((TypedServiceOperationListItem)operationItem).Operation = operationInfo as TypedOperationInfo; } serviceContract.SelectionOperation(operationItem); }
private void AddServiceOperation(ServiceOperationListItem serviceOperation) { if (serviceOperation == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("serviceOperation"); } String key = serviceOperation.ContractName; ServiceContractListItem serviceContract = this.serviceContracts.Find(key); serviceContract.AddOperation(serviceOperation); serviceContract.SelectionOperation(serviceOperation); }
private void addOperationButton_Click(object sender, EventArgs e) { ServiceContractListItem serviceContractListItem = this.operationsListBox.SelectedItem as ServiceContractListItem; Fx.Assert(serviceContractListItem != null, "service contract list item cannot be null"); Fx.Assert(serviceContractListItem.IsCustomContract, " this should work only on a custom contract item"); WorkflowServiceOperationListItem newWorkflowServiceOperationListItem = serviceContractListItem.CreateOperation(); newWorkflowServiceOperationListItem.Validating += new CancelEventHandler(ServiceOperationValidating); this.AddServiceOperation(newWorkflowServiceOperationListItem); serviceContractListItem.SelectionOperation(newWorkflowServiceOperationListItem); }
void NewContractButtonClicked(object sender, EventArgs e) { ServiceContractListItem contractItem = this.serviceContracts.CreateWithUniqueName(); contractItem.Validating += new CancelEventHandler(ServiceContractValidating); contractItem.IsCustomContract = true; this.AddServiceContract(contractItem); WorkflowServiceOperationListItem newWorkflowServiceOperationListItem = contractItem.CreateOperation(); newWorkflowServiceOperationListItem.Validating += new CancelEventHandler(ServiceOperationValidating); this.AddServiceOperation(newWorkflowServiceOperationListItem); contractItem.SelectionOperation(newWorkflowServiceOperationListItem); }