Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Behaviors / CancellationHandler.cs / 1305376 / CancellationHandler.cs
namespace System.Workflow.ComponentModel { using System; using System.Drawing; using System.ComponentModel; using System.Collections; using System.ComponentModel.Design; using System.Workflow.ComponentModel.Design; using System.Workflow.ComponentModel.Compiler; [ToolboxItem(false)] [Designer(typeof(CancellationHandlerActivityDesigner), typeof(IDesigner))] [ToolboxBitmap(typeof(CancellationHandlerActivity), "Resources.CancellationHandler.bmp")] [ActivityValidator(typeof(CancellationHandlerValidator))] [AlternateFlowActivity] public sealed class CancellationHandlerActivity : CompositeActivity, IActivityEventListener{ public CancellationHandlerActivity() { } public CancellationHandlerActivity(string name) :base(name) { } protected internal override void Initialize(IServiceProvider provider) { if (this.Parent == null) throw new InvalidOperationException(SR.GetString(SR.Error_MustHaveParent)); base.Initialize(provider); } protected internal override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { return SequenceHelper.Execute(this, executionContext); } protected internal override ActivityExecutionStatus Cancel(ActivityExecutionContext executionContext) { return SequenceHelper.Cancel(this, executionContext); } void IActivityEventListener .OnEvent(Object sender, ActivityExecutionStatusChangedEventArgs e) { SequenceHelper.OnEvent(this, sender, e); } protected internal override void OnActivityChangeRemove(ActivityExecutionContext executionContext, Activity removedActivity) { SequenceHelper.OnActivityChangeRemove(this, executionContext, removedActivity); } protected internal override void OnWorkflowChangesCompleted(ActivityExecutionContext executionContext) { SequenceHelper.OnWorkflowChangesCompleted(this, executionContext); } } internal sealed class CancellationHandlerValidator : CompositeActivityValidator { public override ValidationErrorCollection Validate(ValidationManager manager, object obj) { ValidationErrorCollection validationErrors = base.Validate(manager, obj); CancellationHandlerActivity cancellationHandlerActivity = obj as CancellationHandlerActivity; if (cancellationHandlerActivity == null) throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(CancellationHandlerActivity).FullName), "obj"); if (cancellationHandlerActivity.EnabledActivities.Count == 0) validationErrors.Add(new ValidationError(SR.GetString(SR.Warning_EmptyBehaviourActivity, typeof(CancellationHandlerActivity).FullName, cancellationHandlerActivity.QualifiedName), ErrorNumbers.Warning_EmptyBehaviourActivity, true)); // cancellation handlers can not contain fault handlers, compensation handler and cancellation handler if (((ISupportAlternateFlow)cancellationHandlerActivity).AlternateFlowActivities.Count > 0) validationErrors.Add(new ValidationError(SR.GetString(SR.Error_ModelingConstructsCanNotContainModelingConstructs), ErrorNumbers.Error_ModelingConstructsCanNotContainModelingConstructs)); return validationErrors; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Workflow.ComponentModel { using System; using System.Drawing; using System.ComponentModel; using System.Collections; using System.ComponentModel.Design; using System.Workflow.ComponentModel.Design; using System.Workflow.ComponentModel.Compiler; [ToolboxItem(false)] [Designer(typeof(CancellationHandlerActivityDesigner), typeof(IDesigner))] [ToolboxBitmap(typeof(CancellationHandlerActivity), "Resources.CancellationHandler.bmp")] [ActivityValidator(typeof(CancellationHandlerValidator))] [AlternateFlowActivity] public sealed class CancellationHandlerActivity : CompositeActivity, IActivityEventListener { public CancellationHandlerActivity() { } public CancellationHandlerActivity(string name) :base(name) { } protected internal override void Initialize(IServiceProvider provider) { if (this.Parent == null) throw new InvalidOperationException(SR.GetString(SR.Error_MustHaveParent)); base.Initialize(provider); } protected internal override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { return SequenceHelper.Execute(this, executionContext); } protected internal override ActivityExecutionStatus Cancel(ActivityExecutionContext executionContext) { return SequenceHelper.Cancel(this, executionContext); } void IActivityEventListener .OnEvent(Object sender, ActivityExecutionStatusChangedEventArgs e) { SequenceHelper.OnEvent(this, sender, e); } protected internal override void OnActivityChangeRemove(ActivityExecutionContext executionContext, Activity removedActivity) { SequenceHelper.OnActivityChangeRemove(this, executionContext, removedActivity); } protected internal override void OnWorkflowChangesCompleted(ActivityExecutionContext executionContext) { SequenceHelper.OnWorkflowChangesCompleted(this, executionContext); } } internal sealed class CancellationHandlerValidator : CompositeActivityValidator { public override ValidationErrorCollection Validate(ValidationManager manager, object obj) { ValidationErrorCollection validationErrors = base.Validate(manager, obj); CancellationHandlerActivity cancellationHandlerActivity = obj as CancellationHandlerActivity; if (cancellationHandlerActivity == null) throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(CancellationHandlerActivity).FullName), "obj"); if (cancellationHandlerActivity.EnabledActivities.Count == 0) validationErrors.Add(new ValidationError(SR.GetString(SR.Warning_EmptyBehaviourActivity, typeof(CancellationHandlerActivity).FullName, cancellationHandlerActivity.QualifiedName), ErrorNumbers.Warning_EmptyBehaviourActivity, true)); // cancellation handlers can not contain fault handlers, compensation handler and cancellation handler if (((ISupportAlternateFlow)cancellationHandlerActivity).AlternateFlowActivities.Count > 0) validationErrors.Add(new ValidationError(SR.GetString(SR.Error_ModelingConstructsCanNotContainModelingConstructs), ErrorNumbers.Error_ModelingConstructsCanNotContainModelingConstructs)); return validationErrors; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlChoiceIdentifierAttribute.cs
- UdpTransportSettings.cs
- Point3DAnimationUsingKeyFrames.cs
- ImageIndexConverter.cs
- MenuAutoFormat.cs
- GridItem.cs
- CustomTokenProvider.cs
- TimeSpanConverter.cs
- SelectionHighlightInfo.cs
- XDRSchema.cs
- EventHandlersStore.cs
- ClockController.cs
- TableItemPatternIdentifiers.cs
- TransformCryptoHandle.cs
- ReferentialConstraintRoleElement.cs
- FormClosingEvent.cs
- AnnotationComponentManager.cs
- PrintControllerWithStatusDialog.cs
- EventDrivenDesigner.cs
- ArraySubsetEnumerator.cs
- GenericPrincipal.cs
- AsymmetricAlgorithm.cs
- InputScopeConverter.cs
- SmiEventSink.cs
- DataControlImageButton.cs
- ContentOperations.cs
- MimeTextImporter.cs
- ResourceAttributes.cs
- DeviceContext2.cs
- RIPEMD160Managed.cs
- BamlWriter.cs
- GridViewRow.cs
- LinqDataView.cs
- FilteredSchemaElementLookUpTable.cs
- DirectionalLight.cs
- WindowsImpersonationContext.cs
- Panel.cs
- MappingModelBuildProvider.cs
- AsyncResult.cs
- Context.cs
- MergePropertyDescriptor.cs
- Mapping.cs
- LineGeometry.cs
- ToolboxItemCollection.cs
- HtmlTernaryTree.cs
- SchemaNames.cs
- COM2TypeInfoProcessor.cs
- CustomAttributeFormatException.cs
- ConfigurationSection.cs
- Vector3DCollectionConverter.cs
- TagMapInfo.cs
- XmlSerializerFactory.cs
- EpmContentDeSerializerBase.cs
- TextBox.cs
- KeyMatchBuilder.cs
- SrgsElementFactoryCompiler.cs
- WindowsToolbar.cs
- PackagingUtilities.cs
- RouteItem.cs
- HiddenFieldPageStatePersister.cs
- SoapEnumAttribute.cs
- Parameter.cs
- SizeAnimation.cs
- TextProviderWrapper.cs
- TrackingMemoryStream.cs
- ListenerElementsCollection.cs
- FamilyMap.cs
- ImageAutomationPeer.cs
- XmlSerializableReader.cs
- EncoderBestFitFallback.cs
- SqlServices.cs
- FlowLayout.cs
- ColumnMapTranslator.cs
- ImageUrlEditor.cs
- HwndPanningFeedback.cs
- PackageDigitalSignatureManager.cs
- DbDataAdapter.cs
- ValueTypeFixupInfo.cs
- BindingMemberInfo.cs
- FileDialog.cs
- BrowserCapabilitiesFactory.cs
- BitmapMetadataEnumerator.cs
- TreeIterator.cs
- StringUtil.cs
- ToolboxItemLoader.cs
- BuiltInPermissionSets.cs
- RawStylusInput.cs
- HttpRawResponse.cs
- SmiEventSink_Default.cs
- StyleBamlTreeBuilder.cs
- XmlDictionaryReaderQuotas.cs
- TargetControlTypeAttribute.cs
- DesigntimeLicenseContextSerializer.cs
- WorkflowValidationFailedException.cs
- WebBrowserHelper.cs
- TemplateControlBuildProvider.cs
- EqualityArray.cs
- Base64Encoding.cs
- Wildcard.cs
- RawKeyboardInputReport.cs