Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Statements / InternalConfirm.cs / 1305376 / InternalConfirm.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Statements { using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime; sealed class InternalConfirm : NativeActivity { public InternalConfirm() : base() { } public InArgumentTarget { get; set; } protected override bool CanInduceIdle { get { return true; } } 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 }); } protected override void Execute(NativeActivityContext context) { CompensationExtension compensationExtension = context.GetExtension (); Fx.Assert(compensationExtension != null, "CompensationExtension must be valid"); CompensationToken compensationToken = Target.Get(context); Fx.Assert(compensationToken != null, "compensationToken must be valid"); // The compensationToken should be a valid one at this point. Ensure its validated in Confirm activity. CompensationTokenData tokenData = compensationExtension.Get(compensationToken.CompensationId); Fx.Assert(tokenData != null, "The compensationToken should be a valid one at this point. Ensure its validated in Confirm activity."); Fx.Assert(tokenData.BookmarkTable[CompensationBookmarkName.Confirmed] == null, "Bookmark should not be already initialized in the bookmark table."); tokenData.BookmarkTable[CompensationBookmarkName.Confirmed] = context.CreateBookmark(new BookmarkCallback(OnConfirmed)); tokenData.CompensationState = CompensationState.Confirming; compensationExtension.NotifyMessage(context, tokenData.CompensationId, CompensationBookmarkName.OnConfirmation); } // Successfully received Confirmed response. void OnConfirmed(NativeActivityContext context, Bookmark bookmark, object value) { CompensationExtension compensationExtension = context.GetExtension (); Fx.Assert(compensationExtension != null, "CompensationExtension must be valid"); CompensationToken compensationToken = Target.Get(context); Fx.Assert(compensationToken != null, "compensationToken must be valid"); // The compensationToken should be a valid one at this point. Ensure its validated in Confirm activity. CompensationTokenData tokenData = compensationExtension.Get(compensationToken.CompensationId); Fx.Assert(tokenData != null, "The compensationToken should be a valid one at this point. Ensure its validated in Confirm activity."); tokenData.CompensationState = CompensationState.Confirmed; if(TD.CompensationStateIsEnabled()) { TD.CompensationState(tokenData.DisplayName, tokenData.CompensationState.ToString()); } // Remove the token from the parent! if (tokenData.ParentCompensationId != CompensationToken.RootCompensationId) { CompensationTokenData parentToken = compensationExtension.Get(tokenData.ParentCompensationId); Fx.Assert(parentToken != null, "parentToken must be valid"); parentToken.ExecutionTracker.Remove(tokenData); } else { // remove from workflow root... CompensationTokenData parentToken = compensationExtension.Get(CompensationToken.RootCompensationId); Fx.Assert(parentToken != null, "parentToken must be valid"); parentToken.ExecutionTracker.Remove(tokenData); } tokenData.RemoveBookmark(context, CompensationBookmarkName.Confirmed); // Remove the token from the extension... compensationExtension.Remove(compensationToken.CompensationId); } 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
- ProxyWebPartManager.cs
- QuotedPrintableStream.cs
- AuthenticationConfig.cs
- Function.cs
- FlowDocumentPage.cs
- MenuItemStyle.cs
- OdbcConnectionOpen.cs
- SizeF.cs
- WmlPhoneCallAdapter.cs
- SafeFileMapViewHandle.cs
- ClientEventManager.cs
- BindingValueChangedEventArgs.cs
- NetCodeGroup.cs
- ClipboardData.cs
- Size3D.cs
- SQLDateTime.cs
- ClassHandlersStore.cs
- DataKeyCollection.cs
- HashHelper.cs
- OrderPreservingMergeHelper.cs
- HeaderCollection.cs
- RangeValidator.cs
- AnimationStorage.cs
- UnmanagedMemoryStreamWrapper.cs
- TextElementCollection.cs
- NameNode.cs
- PersistenceTypeAttribute.cs
- SerializerDescriptor.cs
- UnicodeEncoding.cs
- unsafenativemethodsother.cs
- WrappedIUnknown.cs
- InlineObject.cs
- BaseCAMarshaler.cs
- XmlTextReaderImplHelpers.cs
- ItemCheckedEvent.cs
- RoutedEventConverter.cs
- TileBrush.cs
- GridViewUpdatedEventArgs.cs
- DataTableCollection.cs
- RequiredFieldValidator.cs
- PropertyInfoSet.cs
- CharStorage.cs
- ProfessionalColorTable.cs
- SqlSelectStatement.cs
- VerificationException.cs
- PrivilegeNotHeldException.cs
- LostFocusEventManager.cs
- SpellerInterop.cs
- FileDialogCustomPlaces.cs
- designeractionbehavior.cs
- OneToOneMappingSerializer.cs
- SignerInfo.cs
- PasswordBoxAutomationPeer.cs
- DiscoveryRequestHandler.cs
- EntityDataSourceView.cs
- UriTemplateLiteralPathSegment.cs
- ComEventsMethod.cs
- LockedActivityGlyph.cs
- WhiteSpaceTrimStringConverter.cs
- ValueTypeIndexerReference.cs
- LineGeometry.cs
- RemoveFromCollection.cs
- SafeEventLogReadHandle.cs
- MediaContext.cs
- CompilerWrapper.cs
- ThrowHelper.cs
- DataGridViewColumnCollectionEditor.cs
- webclient.cs
- SignedPkcs7.cs
- CapabilitiesUse.cs
- CriticalFinalizerObject.cs
- TypeElement.cs
- InstanceKeyCompleteException.cs
- UnsafeNativeMethods.cs
- Canvas.cs
- FileLogRecordStream.cs
- TableTextElementCollectionInternal.cs
- SortDescriptionCollection.cs
- Button.cs
- ADMembershipProvider.cs
- SqlDataSourceCommandEventArgs.cs
- Converter.cs
- SpellerError.cs
- TransformPatternIdentifiers.cs
- DispatcherExceptionEventArgs.cs
- AnimatedTypeHelpers.cs
- HttpGetProtocolReflector.cs
- TreeView.cs
- NumberFormatter.cs
- DataGridViewCellParsingEventArgs.cs
- OutputCacheSettings.cs
- Label.cs
- xmlfixedPageInfo.cs
- SqlDataSource.cs
- MessageBox.cs
- SafeNativeMethodsCLR.cs
- objectresult_tresulttype.cs
- SimpleApplicationHost.cs
- AsnEncodedData.cs
- RepeaterCommandEventArgs.cs