Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Statements / DefaultCompensation.cs / 1305376 / DefaultCompensation.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Statements { using System; using System.Collections.Generic; using System.Runtime; using System.Collections.ObjectModel; sealed class DefaultCompensation : NativeActivity { Activity body; VariabletoCompensateToken; CompletionCallback onChildCompensated; public DefaultCompensation() : base() { this.toCompensateToken = new Variable (); this.body = new InternalCompensate() { Target = new InArgument (toCompensateToken), }; } public InArgument Target { get; set; } Activity Body { get { return this.body; } } protected override void CacheMetadata(NativeActivityMetadata metadata) { RuntimeArgument targetArgument = new RuntimeArgument("Target", typeof(CompensationToken), ArgumentDirection.In); metadata.Bind(this.Target, targetArgument); metadata.SetArgumentsCollection(new Collection { targetArgument }); metadata.SetImplementationVariablesCollection(new Collection { this.toCompensateToken }); Fx.Assert(this.Body != null, "Body must be valid"); metadata.SetImplementationChildrenCollection(new Collection { this.Body }); } protected override void Execute(NativeActivityContext context) { InternalExecute(context, null); } void InternalExecute(NativeActivityContext context, ActivityInstance completedInstance) { CompensationExtension compensationExtension = context.GetExtension (); if (compensationExtension == null) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.CompensateWithoutCompensableActivity(this.DisplayName))); } CompensationToken token = Target.Get(context); CompensationTokenData tokenData = token == null ? null : compensationExtension.Get(token.CompensationId); Fx.Assert(tokenData != null, "CompensationTokenData must be valid"); if (tokenData.ExecutionTracker.Count > 0) { if (this.onChildCompensated == null) { this.onChildCompensated = new CompletionCallback(InternalExecute); } this.toCompensateToken.Set(context, new CompensationToken(tokenData.ExecutionTracker.Get())); Fx.Assert(Body != null, "Body must be valid"); context.ScheduleActivity(Body, this.onChildCompensated); } } protected override void Cancel(NativeActivityContext context) { // Suppress Cancel } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- clipboard.cs
- PaintEvent.cs
- Menu.cs
- EntitySetBase.cs
- ListBoxItemAutomationPeer.cs
- RawStylusInput.cs
- LambdaCompiler.Unary.cs
- SharedConnectionInfo.cs
- Helper.cs
- TimeSpanHelper.cs
- XmlAttributeCollection.cs
- RelationshipFixer.cs
- StylusOverProperty.cs
- CqlParser.cs
- RelationshipDetailsRow.cs
- SecureUICommand.cs
- SystemResourceHost.cs
- AsymmetricKeyExchangeDeformatter.cs
- DiscoveryClientDocuments.cs
- QueryInterceptorAttribute.cs
- OneOfTypeConst.cs
- DoubleCollectionConverter.cs
- Image.cs
- Part.cs
- AuthenticationConfig.cs
- GifBitmapEncoder.cs
- PublisherMembershipCondition.cs
- OracleCommand.cs
- CompositeScriptReference.cs
- HtmlInputPassword.cs
- StorageMappingFragment.cs
- IndexingContentUnit.cs
- DispatchChannelSink.cs
- FontDialog.cs
- xmlglyphRunInfo.cs
- BinaryConverter.cs
- RowsCopiedEventArgs.cs
- PlatformNotSupportedException.cs
- SRGSCompiler.cs
- SqlDependencyListener.cs
- Pair.cs
- GraphicsContext.cs
- ListDictionary.cs
- ElementProxy.cs
- TagNameToTypeMapper.cs
- CodeArgumentReferenceExpression.cs
- PrintPreviewControl.cs
- ValidationHelpers.cs
- ParameterCollection.cs
- XmlSequenceWriter.cs
- ThreadExceptionEvent.cs
- PartitionerStatic.cs
- ComAwareEventInfo.cs
- LinkClickEvent.cs
- ReceiveDesigner.xaml.cs
- AsymmetricKeyExchangeFormatter.cs
- PropertyMappingExceptionEventArgs.cs
- AutomationElement.cs
- Dispatcher.cs
- SpecialTypeDataContract.cs
- UnaryExpressionHelper.cs
- XmlReturnReader.cs
- MultiAsyncResult.cs
- TypedReference.cs
- DataSourceProvider.cs
- DynamicObjectAccessor.cs
- BehaviorEditorPart.cs
- Evidence.cs
- invalidudtexception.cs
- TextEndOfSegment.cs
- SelectQueryOperator.cs
- TypeSemantics.cs
- HyperlinkAutomationPeer.cs
- MemberHolder.cs
- URLMembershipCondition.cs
- Debugger.cs
- SmiSettersStream.cs
- Rect.cs
- ArrangedElement.cs
- NetDataContractSerializer.cs
- TileBrush.cs
- Span.cs
- RenderingEventArgs.cs
- OneOfConst.cs
- CSharpCodeProvider.cs
- ObjectDataSourceStatusEventArgs.cs
- Error.cs
- ClientSettingsStore.cs
- Buffer.cs
- Speller.cs
- FloaterBaseParagraph.cs
- ErrorsHelper.cs
- PluralizationServiceUtil.cs
- HtmlInputFile.cs
- RandomNumberGenerator.cs
- InstanceNormalEvent.cs
- CacheModeConverter.cs
- MemoryStream.cs
- GenericWebPart.cs
- DataGridViewRowHeaderCell.cs