Code:
/ 4.0 / 4.0 / 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. 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
- HtmlTernaryTree.cs
- GridViewEditEventArgs.cs
- PostBackTrigger.cs
- SqlGenericUtil.cs
- sqlstateclientmanager.cs
- xml.cs
- OverflowException.cs
- FlowDocumentFormatter.cs
- UntypedNullExpression.cs
- InputChannel.cs
- TripleDESCryptoServiceProvider.cs
- FocusChangedEventArgs.cs
- ToolBarOverflowPanel.cs
- CSharpCodeProvider.cs
- BookmarkTable.cs
- ParameterToken.cs
- FormViewModeEventArgs.cs
- ObjectDataSourceSelectingEventArgs.cs
- SaveLedgerEntryRequest.cs
- MultiBindingExpression.cs
- SimpleHandlerBuildProvider.cs
- COM2ExtendedTypeConverter.cs
- Soap12FormatExtensions.cs
- QilSortKey.cs
- RequestSecurityTokenResponse.cs
- ListViewItem.cs
- LicFileLicenseProvider.cs
- XmlMemberMapping.cs
- EditingMode.cs
- BidPrivateBase.cs
- IntMinMaxAggregationOperator.cs
- ShimAsPublicXamlType.cs
- ConstraintStruct.cs
- UseLicense.cs
- IgnoreFlushAndCloseStream.cs
- ObjectToIdCache.cs
- x509store.cs
- ClientBuildManager.cs
- ExtensionFile.cs
- IntranetCredentialPolicy.cs
- DesignBindingEditor.cs
- ScriptingScriptResourceHandlerSection.cs
- httpserverutility.cs
- HtmlEmptyTagControlBuilder.cs
- ScriptControlDescriptor.cs
- ConfigPathUtility.cs
- Win32MouseDevice.cs
- MarkupCompilePass1.cs
- TableLayoutCellPaintEventArgs.cs
- ContainerUIElement3D.cs
- TeredoHelper.cs
- Vector3D.cs
- HtmlInputText.cs
- OrderPreservingSpoolingTask.cs
- TransformerInfoCollection.cs
- DescendantOverDescendantQuery.cs
- SingleObjectCollection.cs
- ReadOnlyDataSourceView.cs
- AutomationElement.cs
- HeaderedContentControl.cs
- SpeechRecognitionEngine.cs
- StandardToolWindows.cs
- DrawingAttributeSerializer.cs
- Atom10ItemFormatter.cs
- WebPartCloseVerb.cs
- FlagsAttribute.cs
- XmlSchemaComplexContent.cs
- MsmqIntegrationOutputChannel.cs
- ChannelSinkStacks.cs
- GridItemProviderWrapper.cs
- SamlNameIdentifierClaimResource.cs
- SmtpCommands.cs
- PolicyException.cs
- HttpVersion.cs
- FileDocument.cs
- LabelDesigner.cs
- Ipv6Element.cs
- SpeechEvent.cs
- DesignerActionPropertyItem.cs
- NameTable.cs
- EndPoint.cs
- ParameterToken.cs
- XsdCachingReader.cs
- FontDifferentiator.cs
- WaitForChangedResult.cs
- IndexedWhereQueryOperator.cs
- CodeSnippetStatement.cs
- IndicShape.cs
- TableRowGroupCollection.cs
- infer.cs
- ConnectionManagementSection.cs
- InvalidCastException.cs
- DrawingGroup.cs
- QueryStringParameter.cs
- Matrix3DConverter.cs
- MouseButton.cs
- PanelStyle.cs
- TrustSection.cs
- PageThemeParser.cs
- RotateTransform3D.cs