Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.WorkflowServices / System / Workflow / Activities / SendActivityDesigner.cs / 1305376 / SendActivityDesigner.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Workflow.Activities { using System.Collections; using System.ComponentModel; using System.Workflow.ComponentModel.Design; using System.Drawing; using System.Reflection; using System.Workflow.ComponentModel; using System.ComponentModel.Design; using System.Workflow.Activities.Design; using System.ServiceModel; using System.Workflow.ComponentModel.Compiler; using System.Windows.Forms; [ActivityDesignerTheme(typeof(SendActivityDesignerTheme))] class SendActivityDesigner : ActivityDesigner { static ActivityComparermatchByContractCallback; static ActivityComparer matchByOperationCallback; public override Size MinimumSize { get { return new Size(150, 80); } } public override string Text { get { if (this.SendActivity.ServiceOperationInfo != null) { string operationName = this.SendActivity.ServiceOperationInfo.Name; if (!String.IsNullOrEmpty(operationName)) { return operationName; } } return base.Text; } } protected override ActivityDesignerVerbCollection Verbs { get { ActivityDesignerVerbCollection verbs = new ActivityDesignerVerbCollection(); foreach (ActivityDesignerVerb verb in base.Verbs) { verbs.Add(verb); } ActivityDesignerVerb findSimilarOperationsVerb = new FindSimilarActivitiesVerb ( this, MatchByOperationCallback, SR2.GetString(SR2.ShowActivitiesWithSameOperation)); verbs.Add(findSimilarOperationsVerb); ActivityDesignerVerb findSimilarContractVerb = new FindSimilarActivitiesVerb ( this, MatchByContractCallback, SR2.GetString(SR2.ShowActivitiesWithSameContract)); verbs.Add(findSimilarContractVerb); return verbs; } } static ActivityComparer MatchByContractCallback { get { if (matchByContractCallback == null) { matchByContractCallback = new ActivityComparer (MatchByContract); } return matchByContractCallback; } } static ActivityComparer MatchByOperationCallback { get { if (matchByOperationCallback == null) { matchByOperationCallback = new ActivityComparer (MatchByOperation); } return matchByOperationCallback; } } SendActivity SendActivity { get { return this.Activity as SendActivity; } } protected override void OnActivityChanged(ActivityChangedEventArgs e) { base.OnActivityChanged(e); if (e.Member != null && e.Member.Name == SendActivity.ServiceOperationInfoProperty.Name) { if (SendActivity != null) { SendActivity.ParameterBindings.Clear(); } TypeDescriptor.Refresh(e.Activity); PerformLayout(); } } protected override void OnMouseDoubleClick(System.Windows.Forms.MouseEventArgs e) { // Do not allow editing if activity is locked if (this.IsLocked) { return; } OperationInfoBase pickedServiceOperation = null; if (ServiceOperationUIEditor.TryPickOperation(this.Activity.Site, this.Activity, this.SendActivity.ServiceOperationInfo, out pickedServiceOperation)) { PropertyDescriptorUtils.SetPropertyValue(this.Activity.Site, ServiceOperationHelpers.GetServiceOperationInfoPropertyDescriptor(this.Activity), this.Activity, pickedServiceOperation); } } protected override void OnPaint(ActivityDesignerPaintEventArgs e) { base.OnPaint(e); Rectangle outgoingArrowRect = new Rectangle(this.Location.X + this.Size.Width - 24, this.Location.Y + 10, 24, 24); Rectangle incomingArrowRect = new Rectangle(this.Location.X + this.Size.Width, this.Location.Y + this.Size.Height - 35, -24, 24); e.Graphics.DrawImage(ImageResources.Arrow, outgoingArrowRect); bool isOneWay = false; if (SendActivity.ServiceOperationInfo != null) { OperationInfoBase operation = this.SendActivity.ServiceOperationInfo; // Refresh the contract type in the case the type is a Design Time type) //ServiceOperationHelpers.RefreshReferencedDesignTimeTypes(this.Activity.Site as IServiceProvider, operation); isOneWay = operation.GetIsOneWay(this.Activity.Site as IServiceProvider); } if (!isOneWay) { e.Graphics.DrawImage(ImageResources.Arrow, incomingArrowRect); } } protected override void PreFilterProperties(IDictionary properties) { base.PreFilterProperties(properties); if (SendActivity != null) { SendActivity.GetParameterPropertyDescriptors(properties); } } static bool MatchByContract(SendActivity source, SendActivity target) { return ReceiveActivityDesigner.MatchByContract(source.ServiceOperationInfo, target.ServiceOperationInfo); } static bool MatchByOperation(SendActivity source, SendActivity target) { return ReceiveActivityDesigner.MatchByOperation(source.ServiceOperationInfo, target.ServiceOperationInfo); } } } // 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
- ObjectRef.cs
- WsdlEndpointConversionContext.cs
- SiteMapDataSourceView.cs
- CatalogZone.cs
- LayoutSettings.cs
- AssociationProvider.cs
- RangeValueProviderWrapper.cs
- PlatformNotSupportedException.cs
- GeneralTransformCollection.cs
- safemediahandle.cs
- Guid.cs
- RulePatternOps.cs
- InternalTypeHelper.cs
- DataViewManagerListItemTypeDescriptor.cs
- AttachedPropertyBrowsableAttribute.cs
- EntitySetBaseCollection.cs
- ConfigurationProperty.cs
- DefaultEvaluationContext.cs
- ColorTypeConverter.cs
- MeasurementDCInfo.cs
- MailDefinitionBodyFileNameEditor.cs
- Compiler.cs
- SafeCryptoHandles.cs
- SQLChars.cs
- X509CertificateTrustedIssuerElementCollection.cs
- TypeDependencyAttribute.cs
- InternalControlCollection.cs
- ExpressionPrefixAttribute.cs
- ProfileGroupSettings.cs
- AsnEncodedData.cs
- ImmutableObjectAttribute.cs
- MultipleViewProviderWrapper.cs
- XmlSerializationGeneratedCode.cs
- Set.cs
- ActivityIdHeader.cs
- Boolean.cs
- UniqueIdentifierService.cs
- EditorPart.cs
- Base64Stream.cs
- AnimatedTypeHelpers.cs
- XmlSerializerVersionAttribute.cs
- FixedElement.cs
- SqlGatherProducedAliases.cs
- CodeComment.cs
- SQLSingleStorage.cs
- MiniModule.cs
- SpecialTypeDataContract.cs
- RemoteArgument.cs
- RowType.cs
- BulletDecorator.cs
- Stacktrace.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- CompositeScriptReferenceEventArgs.cs
- Timer.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- LineGeometry.cs
- ProvidersHelper.cs
- EditorResources.cs
- StringSorter.cs
- counter.cs
- HostProtectionPermission.cs
- CatalogZone.cs
- DelegatingTypeDescriptionProvider.cs
- webbrowsersite.cs
- assemblycache.cs
- StringDictionary.cs
- UserControlBuildProvider.cs
- PropertyItemInternal.cs
- PostBackTrigger.cs
- RegularExpressionValidator.cs
- TokenBasedSetEnumerator.cs
- IQueryable.cs
- Propagator.JoinPropagator.cs
- DataSourceCache.cs
- ApplicationBuildProvider.cs
- Comparer.cs
- XmlAutoDetectWriter.cs
- CopyEncoder.cs
- ViewBox.cs
- IgnoreSection.cs
- EdgeProfileValidation.cs
- ReturnEventArgs.cs
- ComponentFactoryHelpers.cs
- StaticSiteMapProvider.cs
- BitmapInitialize.cs
- ConnectionInterfaceCollection.cs
- StringValueSerializer.cs
- DataRelation.cs
- SQLMoney.cs
- FlowDocumentReaderAutomationPeer.cs
- OwnerDrawPropertyBag.cs
- pingexception.cs
- Bitmap.cs
- RotationValidation.cs
- CompilerInfo.cs
- _RegBlobWebProxyDataBuilder.cs
- ExternalException.cs
- ImageClickEventArgs.cs
- SiteOfOriginContainer.cs
- TransformationRules.cs