Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Behaviors / Compensation.cs / 1305376 / Compensation.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(CompensationHandlerActivityDesigner), typeof(IDesigner))] [ToolboxBitmap(typeof(CompensationHandlerActivity), "Resources.Compensation.png")] [ActivityValidator(typeof(CompensationValidator))] [AlternateFlowActivityAttribute] [SRCategory(SR.Standard)] public sealed class CompensationHandlerActivity : CompositeActivity, IActivityEventListener{ public CompensationHandlerActivity() { } public CompensationHandlerActivity(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 CompensationValidator : CompositeActivityValidator { public override ValidationErrorCollection Validate(ValidationManager manager, object obj) { ValidationErrorCollection validationErrors = base.Validate(manager, obj); CompensationHandlerActivity compensation = obj as CompensationHandlerActivity; if (compensation == null) throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(CompensationHandlerActivity).FullName), "obj"); // check parent must be compensatable if (!(compensation.Parent is ICompensatableActivity)) validationErrors.Add(new ValidationError(SR.GetString(SR.Error_ParentDoesNotSupportCompensation), ErrorNumbers.Error_FaultHandlerActivityParentNotFaultHandlersActivity)); if (compensation.EnabledActivities.Count == 0) validationErrors.Add(new ValidationError(SR.GetString(SR.Warning_EmptyBehaviourActivity, typeof(CompensationHandlerActivity).FullName, compensation.QualifiedName), ErrorNumbers.Warning_EmptyBehaviourActivity, true)); // compensation handlers can not contain fault handlers, compensation handler and cancellation handler else if (((ISupportAlternateFlow)compensation).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
- PlacementWorkspace.cs
- WindowsListViewGroupHelper.cs
- TypeConverterMarkupExtension.cs
- XmlDocumentType.cs
- DispatcherHookEventArgs.cs
- MiniModule.cs
- DataColumnChangeEvent.cs
- TrustManagerMoreInformation.cs
- TimeManager.cs
- StoreItemCollection.cs
- PageThemeBuildProvider.cs
- StsCommunicationException.cs
- AdRotator.cs
- DataColumnChangeEvent.cs
- DataGridViewAutoSizeModeEventArgs.cs
- CodeNamespaceCollection.cs
- FlagsAttribute.cs
- XPathDocumentIterator.cs
- ScriptRef.cs
- JobInputBins.cs
- GeneralTransform3D.cs
- TypeRestriction.cs
- VersionedStream.cs
- OptimizedTemplateContent.cs
- TextWriter.cs
- EntityDataSourceQueryBuilder.cs
- RegexMatch.cs
- NativeActivityFaultContext.cs
- OleDbParameterCollection.cs
- DeclaredTypeElementCollection.cs
- XmlSerializerVersionAttribute.cs
- ExtenderProvidedPropertyAttribute.cs
- METAHEADER.cs
- datacache.cs
- DataPointer.cs
- SoapEnumAttribute.cs
- SqlFileStream.cs
- AxParameterData.cs
- FormViewInsertedEventArgs.cs
- PixelFormat.cs
- oledbmetadatacollectionnames.cs
- FileRecordSequenceHelper.cs
- DrawingCollection.cs
- CurrentTimeZone.cs
- SystemIPAddressInformation.cs
- DataGridViewAutoSizeModeEventArgs.cs
- InvalidComObjectException.cs
- TextDecorationCollectionConverter.cs
- BamlStream.cs
- EventProviderBase.cs
- _ConnectOverlappedAsyncResult.cs
- Timeline.cs
- HostedTcpTransportManager.cs
- Certificate.cs
- ThreadStaticAttribute.cs
- HtmlTernaryTree.cs
- HMACSHA384.cs
- TopClause.cs
- _NetRes.cs
- IgnoreDataMemberAttribute.cs
- CanExecuteRoutedEventArgs.cs
- DictationGrammar.cs
- GeometryModel3D.cs
- TextUtf8RawTextWriter.cs
- DoubleKeyFrameCollection.cs
- EditingCommands.cs
- ImageListStreamer.cs
- ObjectDataSourceStatusEventArgs.cs
- NumberFormatter.cs
- UserPreferenceChangedEventArgs.cs
- WebEventCodes.cs
- EdmToObjectNamespaceMap.cs
- OperationResponse.cs
- BooleanConverter.cs
- NoResizeSelectionBorderGlyph.cs
- ExpressionParser.cs
- TableLayoutSettingsTypeConverter.cs
- StateWorkerRequest.cs
- DataGridHeaderBorder.cs
- SerializationUtility.cs
- SmiEventSink_Default.cs
- Int32.cs
- webbrowsersite.cs
- ColorDialog.cs
- StorageFunctionMapping.cs
- SafeLocalMemHandle.cs
- SliderAutomationPeer.cs
- ExceptionHandlers.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- MarkupCompiler.cs
- MobileComponentEditorPage.cs
- IgnoreSection.cs
- WebPartConnectionsEventArgs.cs
- CustomErrorCollection.cs
- DeploymentSection.cs
- WorkflowTerminatedException.cs
- HtmlTableRow.cs
- FontStretchConverter.cs
- IndependentAnimationStorage.cs
- ScrollViewer.cs