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
- SortQuery.cs
- URLMembershipCondition.cs
- UnsafeNativeMethods.cs
- DataViewManagerListItemTypeDescriptor.cs
- TemplatePartAttribute.cs
- ListViewUpdatedEventArgs.cs
- LogicalChannel.cs
- FrameworkContentElementAutomationPeer.cs
- StackOverflowException.cs
- Scripts.cs
- Random.cs
- DecimalAnimationUsingKeyFrames.cs
- TreeChangeInfo.cs
- FieldAccessException.cs
- FileDialogCustomPlaces.cs
- DependencyObjectPropertyDescriptor.cs
- URLAttribute.cs
- ParseElementCollection.cs
- TypeReference.cs
- TypeUsage.cs
- CannotUnloadAppDomainException.cs
- SystemParameters.cs
- XmlSchemaDatatype.cs
- ManifestResourceInfo.cs
- ArithmeticException.cs
- SafeHandle.cs
- XpsS0ValidatingLoader.cs
- DataProtection.cs
- BinaryExpressionHelper.cs
- BitmapEffectGeneralTransform.cs
- TextRangeEdit.cs
- ConstraintConverter.cs
- DBDataPermission.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- TableLayoutColumnStyleCollection.cs
- FrameDimension.cs
- SqlStream.cs
- SqlUtil.cs
- XMLUtil.cs
- VectorAnimation.cs
- XmlCountingReader.cs
- HGlobalSafeHandle.cs
- DataGridRelationshipRow.cs
- XmlILAnnotation.cs
- UnsafeNativeMethodsPenimc.cs
- HttpCapabilitiesSectionHandler.cs
- WhitespaceRuleLookup.cs
- BridgeDataRecord.cs
- Composition.cs
- FileUtil.cs
- StringComparer.cs
- WebBrowserContainer.cs
- RichTextBoxDesigner.cs
- WmlLinkAdapter.cs
- WebBrowserContainer.cs
- MatrixAnimationUsingPath.cs
- Sentence.cs
- Maps.cs
- ReaderContextStackData.cs
- LayoutTable.cs
- ActivityBuilderHelper.cs
- EdmMember.cs
- PropertyMetadata.cs
- ExtensionWindow.cs
- ValueType.cs
- SearchForVirtualItemEventArgs.cs
- CommandPlan.cs
- HttpFileCollection.cs
- MeasureItemEvent.cs
- UDPClient.cs
- ActiveDocumentEvent.cs
- HtmlPhoneCallAdapter.cs
- EdmType.cs
- RIPEMD160.cs
- MessageQueuePermissionEntry.cs
- GenericEnumerator.cs
- SourceSwitch.cs
- PlaceHolder.cs
- DataStorage.cs
- SystemException.cs
- IisTraceListener.cs
- SafeNativeMethods.cs
- UnsafeNativeMethods.cs
- TreeNodeCollection.cs
- IPPacketInformation.cs
- TypePresenter.xaml.cs
- FormatSettings.cs
- DocumentApplicationJournalEntry.cs
- HybridWebProxyFinder.cs
- DoubleAverageAggregationOperator.cs
- XmlSchemaInferenceException.cs
- AsyncOperationManager.cs
- MissingMemberException.cs
- WebDisplayNameAttribute.cs
- autovalidator.cs
- Int16Animation.cs
- TextAnchor.cs
- OLEDB_Util.cs
- WeakHashtable.cs
- ImportDesigner.xaml.cs