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
- KeyManager.cs
- ToolStripPanelRenderEventArgs.cs
- ClientFormsIdentity.cs
- ContainerFilterService.cs
- PreProcessInputEventArgs.cs
- AnnotationMap.cs
- ArglessEventHandlerProxy.cs
- CollectionChangeEventArgs.cs
- IntegerValidator.cs
- Merger.cs
- MessageSmuggler.cs
- PersonalizationAdministration.cs
- Assembly.cs
- ParameterBuilder.cs
- DataGridViewControlCollection.cs
- CompiledQueryCacheKey.cs
- Ref.cs
- ProxyDataContractResolver.cs
- BitmapMetadataEnumerator.cs
- ModuleBuilder.cs
- SaveWorkflowAsyncResult.cs
- Interlocked.cs
- CompositeScriptReference.cs
- TextTreeTextBlock.cs
- NullableDoubleAverageAggregationOperator.cs
- SQLBinaryStorage.cs
- smtppermission.cs
- XmlDataSourceNodeDescriptor.cs
- LabelAutomationPeer.cs
- ObjectConverter.cs
- PathParser.cs
- OutputScopeManager.cs
- BuildResultCache.cs
- XPathDocumentBuilder.cs
- WindowsRegion.cs
- X509CertificateCollection.cs
- DrawingDrawingContext.cs
- DatasetMethodGenerator.cs
- SignatureDescription.cs
- SettingsProperty.cs
- EmbeddedObject.cs
- StreamResourceInfo.cs
- ExpandCollapseProviderWrapper.cs
- LocatorGroup.cs
- ToolStripHighContrastRenderer.cs
- TextTreeInsertElementUndoUnit.cs
- CompareValidator.cs
- SizeChangedInfo.cs
- SizeFConverter.cs
- ResourceDescriptionAttribute.cs
- ProcessManager.cs
- DataTableExtensions.cs
- ScrollItemPattern.cs
- MsmqBindingElementBase.cs
- DBConnectionString.cs
- PropagatorResult.cs
- KeyGestureConverter.cs
- IdentityReference.cs
- NavigationService.cs
- CodeMethodInvokeExpression.cs
- UnSafeCharBuffer.cs
- Pen.cs
- Int32.cs
- CancellationTokenRegistration.cs
- InfoCardTraceRecord.cs
- PropertyEntry.cs
- PointLight.cs
- ConnectionInterfaceCollection.cs
- DataBindingList.cs
- IFlowDocumentViewer.cs
- CollectionBuilder.cs
- MultiTouchSystemGestureLogic.cs
- DesignerLoader.cs
- SmtpReplyReader.cs
- ScaleTransform3D.cs
- WindowsAuthenticationModule.cs
- DataGridViewComboBoxEditingControl.cs
- BooleanAnimationBase.cs
- DataServiceKeyAttribute.cs
- PropertyChangingEventArgs.cs
- MailWriter.cs
- ManagementOperationWatcher.cs
- DocumentReference.cs
- EraserBehavior.cs
- DirectionalLight.cs
- EventLogQuery.cs
- InvokeMethodActivityDesigner.cs
- LabelEditEvent.cs
- DeadLetterQueue.cs
- AuthenticationModuleElementCollection.cs
- FrameDimension.cs
- xmlsaver.cs
- SqlExpander.cs
- SpeechAudioFormatInfo.cs
- XmlMtomReader.cs
- CodeTryCatchFinallyStatement.cs
- ProcessModelInfo.cs
- SByteConverter.cs
- ValueExpressions.cs
- PreservationFileWriter.cs