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
- MasterPageCodeDomTreeGenerator.cs
- HtmlSelect.cs
- HtmlInputCheckBox.cs
- WeakEventManager.cs
- Guid.cs
- Win32Native.cs
- SerializationHelper.cs
- DataSourceCache.cs
- Convert.cs
- GradientSpreadMethodValidation.cs
- ButtonChrome.cs
- PropertyValueChangedEvent.cs
- NamedPermissionSet.cs
- BamlTreeNode.cs
- Comparer.cs
- HuffModule.cs
- DataGridParentRows.cs
- AutomationPatternInfo.cs
- GridView.cs
- StringInfo.cs
- RawKeyboardInputReport.cs
- XamlVector3DCollectionSerializer.cs
- OperatingSystem.cs
- EpmSourceTree.cs
- APCustomTypeDescriptor.cs
- RequestQueue.cs
- X509SecurityToken.cs
- LocalClientSecuritySettings.cs
- VectorCollectionConverter.cs
- PropertyDescriptorComparer.cs
- VSWCFServiceContractGenerator.cs
- safelink.cs
- Dynamic.cs
- HttpStreams.cs
- MenuAdapter.cs
- RayHitTestParameters.cs
- HttpDebugHandler.cs
- HebrewCalendar.cs
- UntypedNullExpression.cs
- Encoder.cs
- SystemResourceHost.cs
- PropertyEmitter.cs
- AppDomainFactory.cs
- DebuggerAttributes.cs
- StrongNameKeyPair.cs
- ScrollEventArgs.cs
- AudienceUriMode.cs
- StorageFunctionMapping.cs
- XmlIlTypeHelper.cs
- DoubleKeyFrameCollection.cs
- Logging.cs
- RawStylusInputCustomDataList.cs
- remotingproxy.cs
- SR.cs
- LogWriteRestartAreaAsyncResult.cs
- TrustSection.cs
- LockCookie.cs
- PeerObject.cs
- ToolBarTray.cs
- ISO2022Encoding.cs
- DbMetaDataCollectionNames.cs
- UriWriter.cs
- AttributeCollection.cs
- CardSpaceException.cs
- DataQuery.cs
- FixedSOMPageConstructor.cs
- PackageFilter.cs
- RSAOAEPKeyExchangeDeformatter.cs
- TextServicesManager.cs
- Command.cs
- DataKey.cs
- PopupRoot.cs
- InkPresenterAutomationPeer.cs
- WinFormsUtils.cs
- MessageBox.cs
- ThreadPool.cs
- BindableTemplateBuilder.cs
- Content.cs
- MultilineStringConverter.cs
- RuleInfoComparer.cs
- ComplusTypeValidator.cs
- IntranetCredentialPolicy.cs
- DBConnection.cs
- XmlAttributeHolder.cs
- TogglePattern.cs
- WebPartsSection.cs
- CodeComment.cs
- FontInfo.cs
- ThreadSafeMessageFilterTable.cs
- CultureInfo.cs
- DataGridViewComboBoxEditingControl.cs
- IndexOutOfRangeException.cs
- DbParameterHelper.cs
- AbstractExpressions.cs
- SingleAnimationUsingKeyFrames.cs
- Pair.cs
- AnnotationObservableCollection.cs
- sqlcontext.cs
- WarningException.cs
- TextServicesDisplayAttributePropertyRanges.cs