Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Statements / HandleScope.cs / 1305376 / HandleScope.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Statements { using System.Activities; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime; using System.Windows.Markup; [ContentProperty("Body")] public sealed class HandleScope: NativeActivity where THandle : Handle { Variable declaredHandle; public HandleScope() { } public InArgument Handle { get; set; } public Activity Body { get; set; } protected override void CacheMetadata(NativeActivityMetadata metadata) { RuntimeArgument handleArgument = new RuntimeArgument("Handle", typeof(THandle), ArgumentDirection.In); metadata.Bind(this.Handle, handleArgument); metadata.SetArgumentsCollection(new Collection { handleArgument }); if (this.Body != null) { metadata.SetChildrenCollection(new Collection { this.Body }); } Collection implementationVariables = null; if ((this.Handle == null) || this.Handle.IsEmpty) { if (this.declaredHandle == null) { this.declaredHandle = new Variable (); } } else { this.declaredHandle = null; } if (this.declaredHandle != null) { ActivityUtilities.Add(ref implementationVariables, this.declaredHandle); } metadata.SetImplementationVariablesCollection(implementationVariables); } protected override void Execute(NativeActivityContext context) { // We should go through the motions even if there is no Body for debugging // purposes. When testing handles people will probably use empty scopes // expecting everything except the Body execution to occur. Handle scopedHandle = null; if ((this.Handle == null) || this.Handle.IsEmpty) { Fx.Assert(this.declaredHandle != null, "We should have declared the variable if we didn't have the argument set."); scopedHandle = this.declaredHandle.Get(context); } else { scopedHandle = this.Handle.Get(context); } if (scopedHandle == null) { throw FxTrace.Exception.ArgumentNull("Handle"); } context.Properties.Add(scopedHandle.ExecutionPropertyName, scopedHandle); if (this.Body != null) { context.ScheduleActivity(this.Body); } } } } // 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
- SubMenuStyleCollection.cs
- DebugView.cs
- _SpnDictionary.cs
- MsmqAppDomainProtocolHandler.cs
- WebPartsPersonalizationAuthorization.cs
- SchemaImporterExtension.cs
- ByteStreamMessageEncodingElement.cs
- CompilerErrorCollection.cs
- VisualProxy.cs
- ComponentCache.cs
- FileLoadException.cs
- SspiHelper.cs
- OdbcErrorCollection.cs
- SrgsGrammarCompiler.cs
- WindowInteropHelper.cs
- EntityObject.cs
- ByteAnimationBase.cs
- DiscoveryClientReferences.cs
- Pair.cs
- WindowsMenu.cs
- ForeignKeyConstraint.cs
- ServiceDesigner.cs
- OdbcCommandBuilder.cs
- DecimalAverageAggregationOperator.cs
- WindowsToolbarItemAsMenuItem.cs
- WebBrowserHelper.cs
- MemberExpression.cs
- StateItem.cs
- SqlRemoveConstantOrderBy.cs
- DataContractSet.cs
- BaseTreeIterator.cs
- SafeNativeMethods.cs
- OdbcConnectionOpen.cs
- ScriptingSectionGroup.cs
- OSFeature.cs
- TableLayoutPanelCellPosition.cs
- ActivityInterfaces.cs
- TriggerAction.cs
- DSASignatureDeformatter.cs
- DataGridTextBoxColumn.cs
- XPathChildIterator.cs
- MediaElement.cs
- DataRelationCollection.cs
- XPathDocumentNavigator.cs
- TemplateNameScope.cs
- BrowserCapabilitiesFactoryBase.cs
- MethodCallConverter.cs
- BinaryUtilClasses.cs
- IRCollection.cs
- Calendar.cs
- WorkflowMessageEventHandler.cs
- ConstraintCollection.cs
- QuaternionRotation3D.cs
- Camera.cs
- DbConnectionStringCommon.cs
- InvalidEnumArgumentException.cs
- PerspectiveCamera.cs
- TempEnvironment.cs
- CultureInfo.cs
- ZipIOLocalFileHeader.cs
- SharedUtils.cs
- Size.cs
- WebReferencesBuildProvider.cs
- InputProcessorProfilesLoader.cs
- PageRequestManager.cs
- TypeListConverter.cs
- ImageCollectionEditor.cs
- RestClientProxyHandler.cs
- SafeBitVector32.cs
- HttpFileCollectionWrapper.cs
- SmiXetterAccessMap.cs
- ObjectItemCollection.cs
- BoundsDrawingContextWalker.cs
- LinkTarget.cs
- ImmutableCollection.cs
- ReadOnlyDictionary.cs
- Deserializer.cs
- NavigationService.cs
- SqlUserDefinedTypeAttribute.cs
- AsymmetricAlgorithm.cs
- NativeMethods.cs
- VisualSerializer.cs
- IndentedTextWriter.cs
- DateTimeStorage.cs
- filewebrequest.cs
- Pair.cs
- SafeLibraryHandle.cs
- ComplusEndpointConfigContainer.cs
- DriveNotFoundException.cs
- SharedStatics.cs
- OperationCanceledException.cs
- PeerObject.cs
- BitmapSource.cs
- PropertySegmentSerializationProvider.cs
- MetafileHeaderWmf.cs
- RelationshipWrapper.cs
- StreamWriter.cs
- IsolationInterop.cs
- ByteKeyFrameCollection.cs
- DragEvent.cs