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
- RijndaelManaged.cs
- HttpModuleCollection.cs
- LayoutEditorPart.cs
- StatusBarPanel.cs
- CustomPopupPlacement.cs
- UnauthorizedAccessException.cs
- SchemaObjectWriter.cs
- CompleteWizardStep.cs
- DefaultBinder.cs
- WindowsScrollBar.cs
- GeometryCombineModeValidation.cs
- SqlLiftWhereClauses.cs
- Int16Converter.cs
- CreateInstanceBinder.cs
- ListenerSessionConnection.cs
- AssemblyAttributesGoHere.cs
- Win32PrintDialog.cs
- XmlTextReaderImplHelpers.cs
- DataGrid.cs
- ComponentResourceKey.cs
- DependencyPropertyKind.cs
- UriSection.cs
- VirtualPathProvider.cs
- SerializationFieldInfo.cs
- WSSecurityOneDotOneReceiveSecurityHeader.cs
- TreeViewBindingsEditorForm.cs
- ConfigurationManager.cs
- PositiveTimeSpanValidatorAttribute.cs
- PeerCollaboration.cs
- FileDialogPermission.cs
- WarningException.cs
- CompilationUnit.cs
- Accessible.cs
- SimpleBitVector32.cs
- DBConnectionString.cs
- AssemblyFilter.cs
- AtlasWeb.Designer.cs
- ErrorHandler.cs
- AutomationFocusChangedEventArgs.cs
- AnimationClockResource.cs
- WebRequestModuleElementCollection.cs
- TableAutomationPeer.cs
- DataContractSerializerMessageContractImporter.cs
- DelegateBodyWriter.cs
- EventArgs.cs
- ChangeNode.cs
- SafeMILHandle.cs
- PageContentCollection.cs
- BackgroundWorker.cs
- LiteralDesigner.cs
- InheritanceContextChangedEventManager.cs
- Parameter.cs
- Pkcs7Recipient.cs
- PageClientProxyGenerator.cs
- SingleObjectCollection.cs
- XmlChildNodes.cs
- ObjectSet.cs
- AccessViolationException.cs
- EntityCodeGenerator.cs
- RunInstallerAttribute.cs
- HtmlInputCheckBox.cs
- ComponentResourceKeyConverter.cs
- messageonlyhwndwrapper.cs
- TraceContextEventArgs.cs
- SchemaImporterExtensionsSection.cs
- PartialCachingControl.cs
- DbConnectionPoolIdentity.cs
- Rijndael.cs
- BrushProxy.cs
- FixedTextPointer.cs
- CornerRadius.cs
- TextDecorations.cs
- TemplateColumn.cs
- manifestimages.cs
- DiagnosticTrace.cs
- SmtpAuthenticationManager.cs
- RSAPKCS1SignatureDeformatter.cs
- Walker.cs
- InstanceCreationEditor.cs
- TargetException.cs
- NumericUpDown.cs
- UdpDiscoveryEndpoint.cs
- XAMLParseException.cs
- SourceElementsCollection.cs
- FrameworkRichTextComposition.cs
- SQLMoneyStorage.cs
- ConstraintManager.cs
- SqlDataSourceSummaryPanel.cs
- mansign.cs
- DBConcurrencyException.cs
- ActiveXHelper.cs
- RecordsAffectedEventArgs.cs
- DBPropSet.cs
- XmlSchema.cs
- QuaternionRotation3D.cs
- GradientStop.cs
- DataGridViewColumnCollectionEditor.cs
- SspiNegotiationTokenProvider.cs
- PolyQuadraticBezierSegment.cs
- Int32Storage.cs