Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.WorkflowServices / System / Workflow / Activities / Design / ServiceContractListItem.cs / 1305376 / ServiceContractListItem.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Workflow.Activities.Design { using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime; using System.ServiceModel; using System.Windows.Forms; using System.Workflow.ComponentModel; [ListItemView(typeof(ServiceContractViewControl))] [ListItemDetailView(typeof(ServiceContractDetailViewControl))] class ServiceContractListItem : object { ListBox container; Type contractType; bool isCustomContract; ServiceOperationListItem lastItemAdded; string name; ServiceOperationListItemList operations; public ServiceContractListItem(ListBox container) { if (container == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("container"); } this.operations = new ServiceOperationListItemList(); this.container = container; } public CancelEventHandler Validating; public Type ContractType { get { return contractType; } set { contractType = value; } } public bool IsCustomContract { get { return isCustomContract; } set { isCustomContract = value; } } public string Name { get { return name; } set { name = value; } } public IEnumerableOperations { get { return operations; } } public void AddOperation(ServiceOperationListItem operation) { if (operation == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation"); } // Dont add operation if operation.Name is broken if (String.IsNullOrEmpty(operation.Name)) { return; } ServiceOperationListItem cachedItem = this.operations.Find(operation.Name); if (cachedItem != null) { foreach (Activity activity in operation.ImplementingActivities) { if (!cachedItem.ImplementingActivities.Contains(activity)) { cachedItem.ImplementingActivities.Add(activity); } } } else { this.operations.Add(operation); int positionToAddAt = this.container.Items.IndexOf(this) + 1; if (this.operations.Count > 1) { positionToAddAt = this.container.Items.IndexOf(lastItemAdded) + 1; } lastItemAdded = operation; this.container.Items.Insert(positionToAddAt, operation); } } public WorkflowServiceOperationListItem CreateOperation() { WorkflowServiceOperationListItem result = (WorkflowServiceOperationListItem) this.operations.CreateWithUniqueName(); result.Operation.ContractName = this.Name; return result; } public ServiceOperationListItem Find(string operationName) { Fx.Assert(operationName != null, "operationName != null"); return this.operations.Find(operationName); } public void SelectionOperation(ServiceOperationListItem operation) { if (operation == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation"); } // Dont select if operation.Name is broken if (String.IsNullOrEmpty(operation.Name)) { return; } ServiceOperationListItem operationListItem = this.operations.Find(operation.Name); if (operationListItem != null) { this.container.SetSelected(container.Items.IndexOf(operationListItem), true); } } public override string ToString() { return Name; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LateBoundBitmapDecoder.cs
- UIElementCollection.cs
- MemberJoinTreeNode.cs
- Size3D.cs
- XslCompiledTransform.cs
- UInt64Converter.cs
- FileDataSourceCache.cs
- EventLogQuery.cs
- SafeNativeMethods.cs
- ObjectQueryState.cs
- XmlChildNodes.cs
- ConstraintStruct.cs
- OleDbMetaDataFactory.cs
- RegexWorker.cs
- Win32KeyboardDevice.cs
- WebPartMenu.cs
- EntitySqlQueryBuilder.cs
- IgnoreFileBuildProvider.cs
- ClusterSafeNativeMethods.cs
- ViewStateException.cs
- FontCacheUtil.cs
- Section.cs
- SmiConnection.cs
- FileFormatException.cs
- FieldInfo.cs
- IdentifierService.cs
- XamlBrushSerializer.cs
- OrderByQueryOptionExpression.cs
- VisualBrush.cs
- ReflectTypeDescriptionProvider.cs
- SpeechAudioFormatInfo.cs
- WebControl.cs
- DesignerRegionMouseEventArgs.cs
- EventLogPermission.cs
- DataGridViewBand.cs
- SR.cs
- SoapSchemaExporter.cs
- DeflateInput.cs
- IRCollection.cs
- Size.cs
- HostnameComparisonMode.cs
- PathFigureCollectionConverter.cs
- GetWinFXPath.cs
- StorageModelBuildProvider.cs
- Exceptions.cs
- FormsAuthenticationTicket.cs
- RegistrySecurity.cs
- VerificationException.cs
- CopyNamespacesAction.cs
- PreloadedPackages.cs
- WinEventWrap.cs
- WorkflowApplicationCompletedEventArgs.cs
- BamlLocalizableResourceKey.cs
- ResourceCategoryAttribute.cs
- MenuScrollingVisibilityConverter.cs
- ObjectConverter.cs
- RegularExpressionValidator.cs
- XmlSigningNodeWriter.cs
- XmlReaderSettings.cs
- BStrWrapper.cs
- ValidationException.cs
- PointAnimation.cs
- SqlDataSourceCustomCommandPanel.cs
- FixedSOMImage.cs
- Span.cs
- DrawingGroupDrawingContext.cs
- CompModSwitches.cs
- CompoundFileIOPermission.cs
- DocumentOrderQuery.cs
- Pair.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- OverflowException.cs
- MarkupWriter.cs
- ProfileModule.cs
- ColumnWidthChangingEvent.cs
- EventLogEntryCollection.cs
- WsdlImporterElement.cs
- ColorMap.cs
- Rfc2898DeriveBytes.cs
- ToolStripSystemRenderer.cs
- ResourceExpressionBuilder.cs
- DataGridViewCellStyleConverter.cs
- XmlQueryType.cs
- GuidConverter.cs
- DynamicMethod.cs
- BaseDataListPage.cs
- AvTraceDetails.cs
- OutKeywords.cs
- SignedXmlDebugLog.cs
- infer.cs
- ActivityXamlServices.cs
- EntityRecordInfo.cs
- XmlSchemaGroupRef.cs
- BaseResourcesBuildProvider.cs
- CompatibleComparer.cs
- StatusBarAutomationPeer.cs
- TemplatedWizardStep.cs
- ToolBarButtonDesigner.cs
- BuildResult.cs
- ActivityExecutorDelegateInfo.cs