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 UpdateImplementingActivities() { ServiceOperationListItem operationListItem = this.Item as ServiceOperationListItem; WorkflowServiceOperationListItem workflowOperationListItem = this.Item as WorkflowServiceOperationListItem; TypedServiceOperationListItem reflectedOperationListItem = this.Item as TypedServiceOperationListItem; OperationInfoBase operation = null; if (workflowOperationListItem != null) { operation = workflowOperationListItem.Operation; } else if (reflectedOperationListItem != null) { operation = reflectedOperationListItem.Operation; } Fx.Assert(operation != null, "operation should not be null at this point"); // workflow operations list item will complain if some operationInfo objects have different signature than others // for the same operation name. This will happen when we are updating the activities, since they already have a operation // object for that operation name, but with a different signature. so make them all point to null first ,then update. if (workflowOperationListItem != null) { foreach (Activity activity in operationListItem.ImplementingActivities) { PropertyDescriptorUtils.SetPropertyValue(this.ServiceProvider, ServiceOperationHelpers.GetServiceOperationInfoPropertyDescriptor(activity), activity, null); } } foreach (Activity activity in operationListItem.ImplementingActivities) { PropertyDescriptorUtils.SetPropertyValue(this.ServiceProvider, ServiceOperationHelpers.GetServiceOperationInfoPropertyDescriptor(activity), activity, operation.Clone()); } }
public void AddServiceOperation(OperationInfoBase operationInfo, Activity implementingActivity) { if (operationInfo == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operationInfo"); } TypedOperationInfo typedOperationInfo = operationInfo as TypedOperationInfo; OperationInfo workflowOperationInfo = operationInfo as OperationInfo; string contractName = operationInfo.GetContractFullName(null); // Do not add operation if the contractName is not valid. Not throwing here gives the user to fix // a broken contract/operation by selecting a different operation from the UI. if (String.IsNullOrEmpty(contractName)) { return; } ServiceContractListItem serviceContract = this.serviceContracts.Find(contractName); if (typedOperationInfo != null) { if (serviceContract == null) { serviceContract = new ServiceContractListItem(this.operationsListBox); serviceContract.Validating += new CancelEventHandler(ServiceContractValidating); serviceContract.Name = contractName; serviceContract.ContractType = typedOperationInfo.ContractType; serviceContract.IsCustomContract = false; AddServiceContract(serviceContract); } TypedServiceOperationListItem operationItem = new TypedServiceOperationListItem(); operationItem.Validating += new CancelEventHandler(ServiceOperationValidating); operationItem.Name = typedOperationInfo.Name; operationItem.Operation = typedOperationInfo; operationItem.ImplementingActivities.Add(implementingActivity); serviceContract.AddOperation(operationItem); } else if (workflowOperationInfo != null) { if (serviceContract == null) { serviceContract = new ServiceContractListItem(this.operationsListBox); serviceContract.Validating += new CancelEventHandler(ServiceContractValidating); serviceContract.Name = workflowOperationInfo.ContractName; serviceContract.IsCustomContract = true; AddServiceContract(serviceContract); } WorkflowServiceOperationListItem workflowOperationItem = new WorkflowServiceOperationListItem(); workflowOperationItem.Validating += new CancelEventHandler(ServiceOperationValidating); workflowOperationItem.Operation = workflowOperationInfo; workflowOperationItem.ImplementingActivities.Add(implementingActivity); serviceContract.AddOperation(workflowOperationItem); } }
private void ImportContract(Type serviceContractType) { foreach (MethodInfo methodInfo in GetMethodsFromInterface(serviceContractType)) { if (!ServiceOperationHelpers.IsValidServiceOperation(methodInfo)) { continue; } TypedServiceOperationListItem operationItem = new TypedServiceOperationListItem(); operationItem.Validating += new CancelEventHandler(ServiceOperationValidating); operationItem.Name = ServiceOperationHelpers.GetOperationName(this.serviceProvider, methodInfo); operationItem.Operation.ContractType = serviceContractType; operationItem.Operation.Name = ServiceOperationHelpers.GetOperationName(this.serviceProvider, methodInfo); this.AddServiceOperation(operationItem); } }
void permissionRoleTextChanged(object sender, EventArgs e) { WorkflowServiceOperationListItem workflowOperationListItem = this.Item as WorkflowServiceOperationListItem; if (workflowOperationListItem != null) { workflowOperationListItem.Operation.PrincipalPermissionRole = this.permissionRoleTextBox.Text; } else { TypedServiceOperationListItem reflectedOperationListItem = this.Item as TypedServiceOperationListItem; if (reflectedOperationListItem != null) { reflectedOperationListItem.Operation.PrincipalPermissionRole = this.permissionRoleTextBox.Text; } } OnOperationPropertiesChanged(); }
public void AddServiceOperation(OperationInfoBase operationInfo, Activity implementingActivity) { if (operationInfo == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operationInfo"); } TypedOperationInfo typedOperationInfo = operationInfo as TypedOperationInfo; OperationInfo workflowOperationInfo = operationInfo as OperationInfo; string contractName = operationInfo.GetContractFullName(null); // Do not add operation if the contractName is not valid. Not throwing here gives the user to fix // a broken contract/operation by selecting a different operation from the UI. if (String.IsNullOrEmpty(contractName)) { return; } ServiceContractListItem serviceContract = this.serviceContracts.Find(contractName); if (typedOperationInfo != null) { if (serviceContract == null) { serviceContract = new ServiceContractListItem(this.operationsListBox); serviceContract.Validating += new CancelEventHandler(ServiceContractValidating); serviceContract.Name = contractName; serviceContract.ContractType = typedOperationInfo.ContractType; serviceContract.IsCustomContract = false; AddServiceContract(serviceContract); } TypedServiceOperationListItem operationItem = new TypedServiceOperationListItem(); operationItem.Validating += new CancelEventHandler(ServiceOperationValidating); operationItem.Name = typedOperationInfo.Name; operationItem.Operation = typedOperationInfo; operationItem.ImplementingActivities.Add(implementingActivity); serviceContract.AddOperation(operationItem); } else if (workflowOperationInfo != null) { if (serviceContract == null) { serviceContract = new ServiceContractListItem(this.operationsListBox); serviceContract.Validating += new CancelEventHandler(ServiceContractValidating); serviceContract.Name = workflowOperationInfo.ContractName; serviceContract.IsCustomContract = true; AddServiceContract(serviceContract); } WorkflowServiceOperationListItem workflowOperationItem = new WorkflowServiceOperationListItem(); workflowOperationItem.Validating += new CancelEventHandler(ServiceOperationValidating); workflowOperationItem.Operation = workflowOperationInfo; workflowOperationItem.ImplementingActivities.Add(implementingActivity); serviceContract.AddOperation(workflowOperationItem); } }
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 ImportContract(Type serviceContractType) { foreach (MethodInfo methodInfo in GetMethodsFromInterface(serviceContractType)) { if (!ServiceOperationHelpers.IsValidServiceOperation(methodInfo)) { continue; } TypedServiceOperationListItem operationItem = new TypedServiceOperationListItem(); operationItem.Validating += new CancelEventHandler(ServiceOperationValidating); operationItem.Name = ServiceOperationHelpers.GetOperationName(this.serviceProvider, methodInfo); operationItem.Operation.ContractType = serviceContractType; operationItem.Operation.Name = ServiceOperationHelpers.GetOperationName(this.serviceProvider, methodInfo); this.AddServiceOperation(operationItem); } }
public override void UpdateView() { // set the dialog fonts from vs. IUIService uisvc = (IUIService)this.ServiceProvider.GetService(typeof(IUIService)); if (uisvc != null) { this.Font = (Font)uisvc.Styles["DialogFont"]; } TypedServiceOperationListItem operationListItem = this.Item as TypedServiceOperationListItem; WorkflowServiceOperationListItem workflowOperationListItem = this.Item as WorkflowServiceOperationListItem; if (operationListItem != null) { operationInfoBase = operationListItem.Operation; SetEditability(false); } if (workflowOperationListItem != null) { operationInfoBase = workflowOperationListItem.Operation; if (workflowOperationListItem.Operation.HasProtectionLevel) { this.protectionLevelComboBox.SelectedItem = workflowOperationListItem.Operation.ProtectionLevel; } else { this.protectionLevelComboBox.SelectedItem = SR2.GetString(SR2.UseRuntimeDefaults); } SetEditability(true); } Fx.Assert(operationInfoBase != null, "list Item should be either ReflectedServiceOperationListItem or WorkflowServiceOperationListItem"); this.oneWayCheckBox.Checked = operationInfoBase.GetIsOneWay(ServiceProvider); Fx.Assert(operationInfoBase != null, "Operation Info should be non-null at this point"); SetupColumns(); PopulateParametersGrid(operationInfoBase); if (!this.parametersGrid.ReadOnly) { this.parametersGrid.Rows.Add(this.ParameterTemplateRowName, null, null); } this.operationNameTextBox.Text = operationInfoBase.Name; this.permissionRoleTextBox.Text = operationInfoBase.PrincipalPermissionRole; this.permissionNameTextBox.Text = operationInfoBase.PrincipalPermissionName; this.permissionRoleTextBox.TextChanged += new EventHandler(permissionRoleTextChanged); if (workflowOperationListItem != null) { this.operationNameTextBox.Validating += new CancelEventHandler(operationNameTextBox_Validating); this.operationNameTextBox.Validated += new EventHandler(operationNameTextBox_Validated); } this.oneWayCheckBox.CheckedChanged += new EventHandler(oneWayCheckBoxCheckedChanged); this.permissionNameTextBox.TextChanged += new EventHandler(permissionNameTextChanged); this.parametersGrid.SelectionChanged += new EventHandler(parametersGrid_SelectionChanged); if (!this.parametersGrid.ReadOnly) { this.parametersGrid.CellValidating += new DataGridViewCellValidatingEventHandler(parametersGrid_CellValidating); this.parametersGrid.CellEndEdit += new DataGridViewCellEventHandler(parametersGridCellEndEdit); this.parametersGrid.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(parametersGrid_EditingControlShowing); this.parametersGrid.KeyDown += new KeyEventHandler(parametersGrid_KeyDown); } this.protectionLevelComboBox.SelectedValueChanged += new System.EventHandler(this.protectionLevelComboBoxSelectedValueChanged); RefreshParameterOperationButtons(); }