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
- Registry.cs
- TableStyle.cs
- RuntimeConfigLKG.cs
- ListControlConvertEventArgs.cs
- StylusTouchDevice.cs
- PopOutPanel.cs
- NetCodeGroup.cs
- BindingMAnagerBase.cs
- DataBindingHandlerAttribute.cs
- ComplexPropertyEntry.cs
- ItemList.cs
- FlowDecision.cs
- CreatingCookieEventArgs.cs
- metadatamappinghashervisitor.cs
- XamlValidatingReader.cs
- XmlJsonWriter.cs
- CriticalFinalizerObject.cs
- BamlLocalizationDictionary.cs
- MissingFieldException.cs
- LayoutSettings.cs
- TableSectionStyle.cs
- NominalTypeEliminator.cs
- CompiledQuery.cs
- FieldToken.cs
- IndexerNameAttribute.cs
- ColorAnimation.cs
- BaseDataBoundControl.cs
- ColumnResult.cs
- ArglessEventHandlerProxy.cs
- TextFindEngine.cs
- ExecutedRoutedEventArgs.cs
- DataGridViewColumnEventArgs.cs
- WmfPlaceableFileHeader.cs
- ResXResourceWriter.cs
- UserUseLicenseDictionaryLoader.cs
- Rfc2898DeriveBytes.cs
- UriSection.cs
- NextPreviousPagerField.cs
- Barrier.cs
- CharEntityEncoderFallback.cs
- TypeElementCollection.cs
- DataKeyArray.cs
- SQLInt32Storage.cs
- ConstraintCollection.cs
- ListControl.cs
- AnimationLayer.cs
- DataGridRowDetailsEventArgs.cs
- AuthenticationService.cs
- Calendar.cs
- ModelVisual3D.cs
- StateMachine.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- RSAProtectedConfigurationProvider.cs
- HyperLink.cs
- NativeMethods.cs
- AutomationAttributeInfo.cs
- TraceUtils.cs
- GroupPartitionExpr.cs
- Selector.cs
- SharedStatics.cs
- AppDomainAttributes.cs
- AnnotationAdorner.cs
- DataViewManager.cs
- AbstractDataSvcMapFileLoader.cs
- Vector.cs
- ImageCodecInfoPrivate.cs
- UnionExpr.cs
- ToolTipAutomationPeer.cs
- InvokeProviderWrapper.cs
- IHttpResponseInternal.cs
- TreeNodeStyle.cs
- SmtpException.cs
- MarkupExtensionParser.cs
- TimersDescriptionAttribute.cs
- ValidationError.cs
- DrawTreeNodeEventArgs.cs
- MsmqInputMessagePool.cs
- ListItemCollection.cs
- TextPatternIdentifiers.cs
- StateMachineWorkflowInstance.cs
- MeasurementDCInfo.cs
- IntPtr.cs
- Int32AnimationUsingKeyFrames.cs
- DependentTransaction.cs
- ClientOptions.cs
- ServiceContractListItemList.cs
- Rotation3DKeyFrameCollection.cs
- Rfc2898DeriveBytes.cs
- VBIdentifierTrimConverter.cs
- DataServiceQuery.cs
- PageCodeDomTreeGenerator.cs
- QilName.cs
- LinkLabel.cs
- XmlQualifiedName.cs
- AvTraceFormat.cs
- ComplexPropertyEntry.cs
- AuthenticationModulesSection.cs
- CanonicalXml.cs
- HtmlInputReset.cs
- TextServicesCompartmentContext.cs