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
- CodePropertyReferenceExpression.cs
- AutomationAttributeInfo.cs
- CodeEntryPointMethod.cs
- ObjectStorage.cs
- GPRECT.cs
- ControlParameter.cs
- httpapplicationstate.cs
- RuntimeConfig.cs
- DataTableReader.cs
- Geometry3D.cs
- TrustSection.cs
- CompositeFontInfo.cs
- HtmlButton.cs
- EntitySqlQueryCacheEntry.cs
- DecimalConverter.cs
- CaseInsensitiveHashCodeProvider.cs
- HttpDebugHandler.cs
- DateRangeEvent.cs
- safelink.cs
- ComboBoxDesigner.cs
- HtmlAnchor.cs
- HtmlTable.cs
- LoadedOrUnloadedOperation.cs
- ObjectDataSourceEventArgs.cs
- FileDataSourceCache.cs
- ServerIdentity.cs
- XmlBinaryWriterSession.cs
- CompilerLocalReference.cs
- ClientBuildManagerCallback.cs
- SimpleExpression.cs
- StyleCollection.cs
- ProxyWebPartManager.cs
- XmlAttributeOverrides.cs
- NetCodeGroup.cs
- SoapSchemaExporter.cs
- Compiler.cs
- ObjectCloneHelper.cs
- _NativeSSPI.cs
- Brushes.cs
- CopyNodeSetAction.cs
- CodeDirectiveCollection.cs
- RsaKeyIdentifierClause.cs
- SchemaMapping.cs
- PermissionSetEnumerator.cs
- ComponentChangedEvent.cs
- CharacterShapingProperties.cs
- TagNameToTypeMapper.cs
- ResourceDisplayNameAttribute.cs
- MimeWriter.cs
- ArgumentsParser.cs
- DiffuseMaterial.cs
- PolicyStatement.cs
- OracleBinary.cs
- XmlTextAttribute.cs
- CompiledAction.cs
- MsmqAuthenticationMode.cs
- SafeNativeMethods.cs
- DataGridTable.cs
- _OSSOCK.cs
- FrameworkRichTextComposition.cs
- SubstitutionResponseElement.cs
- PersistNameAttribute.cs
- XhtmlBasicObjectListAdapter.cs
- AddInControllerImpl.cs
- PtsHelper.cs
- HtmlCommandAdapter.cs
- SingleAnimation.cs
- LinkLabelLinkClickedEvent.cs
- AlternateView.cs
- DataGridPagerStyle.cs
- FormViewInsertEventArgs.cs
- XmlDocument.cs
- DiffuseMaterial.cs
- QEncodedStream.cs
- Int64AnimationBase.cs
- SqlFacetAttribute.cs
- ContentPlaceHolder.cs
- EntityDataSourceDataSelection.cs
- GB18030Encoding.cs
- WindowsScrollBar.cs
- ResourceDescriptionAttribute.cs
- DataBoundControl.cs
- XmlSerializerNamespaces.cs
- TagMapInfo.cs
- ListBase.cs
- EditorBrowsableAttribute.cs
- ColorBlend.cs
- SwitchLevelAttribute.cs
- HandoffBehavior.cs
- datacache.cs
- SqlCacheDependency.cs
- QilName.cs
- basevalidator.cs
- FirstMatchCodeGroup.cs
- PersonalizationAdministration.cs
- DoubleAnimation.cs
- UrlPath.cs
- VirtualPath.cs
- HttpRuntimeSection.cs
- DefaultCommandConverter.cs