Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / HandleInitializationContext.cs / 1305376 / HandleInitializationContext.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities { using System; using System.Activities.Runtime; using System.Diagnostics.CodeAnalysis; using System.Runtime; [Fx.Tag.XamlVisible(false)] public sealed class HandleInitializationContext { ActivityExecutor executor; ActivityInstance scope; bool isDiposed; internal HandleInitializationContext(ActivityExecutor executor, ActivityInstance scope) { this.executor = executor; this.scope = scope; } internal ActivityInstance OwningActivityInstance { get { return this.scope; } } internal ActivityExecutor Executor { get { return this.executor; } } public THandle CreateAndInitializeHandle() where THandle : Handle { ThrowIfDisposed(); THandle value = Activator.CreateInstance (); value.Initialize(this); // If we have a scope, we need to add this new handle to the LocationEnvironment. if (this.scope != null) { this.scope.Environment.AddHandle(value); } // otherwise add it to the Executor. else { this.executor.AddHandle(value); } return value; } public void UninitializeHandle(Handle handle) { ThrowIfDisposed(); handle.Uninitialize(this); } internal object CreateAndInitializeHandle(Type handleType) { Fx.Assert(ActivityUtilities.IsHandle(handleType), "This should only be called with Handle subtypes."); object value = Activator.CreateInstance(handleType); ((Handle)value).Initialize(this); // If we have a scope, we need to add this new handle to the LocationEnvironment. if (this.scope != null) { this.scope.Environment.AddHandle((Handle)value); } // otherwise add it to the Executor. else { this.executor.AddHandle((Handle)value); } return value; } internal BookmarkScope CreateAndRegisterBookmarkScope() { return this.executor.BookmarkScopeManager.CreateAndRegisterScope(Guid.Empty); } internal void UnregisterBookmarkScope(BookmarkScope bookmarkScope) { Fx.Assert(bookmarkScope != null, "The sub instance should not equal null."); this.executor.BookmarkScopeManager.UnregisterScope(bookmarkScope); } void ThrowIfDisposed() { if (this.isDiposed) { throw FxTrace.Exception.AsError(new ObjectDisposedException(SR.HandleInitializationContextDisposed)); } } internal void Dispose() { this.isDiposed = true; } } } // 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
- NativeMethodsOther.cs
- MappingException.cs
- RadioButton.cs
- HMAC.cs
- XmlWriterTraceListener.cs
- HostedElements.cs
- AssemblySettingAttributes.cs
- ValidationRule.cs
- XmlSchemaException.cs
- BaseDataListPage.cs
- CfgSemanticTag.cs
- DataKeyCollection.cs
- DynamicRenderer.cs
- GroupBoxAutomationPeer.cs
- itemelement.cs
- DataColumnMappingCollection.cs
- ScrollBarAutomationPeer.cs
- assemblycache.cs
- PointLight.cs
- HierarchicalDataBoundControlAdapter.cs
- UniqueIdentifierService.cs
- ByteRangeDownloader.cs
- PageRanges.cs
- WindowsRichEditRange.cs
- ObjectConverter.cs
- BridgeDataReader.cs
- TdsParserSafeHandles.cs
- SqlProcedureAttribute.cs
- ItemsPanelTemplate.cs
- IPPacketInformation.cs
- WebControl.cs
- SymmetricKey.cs
- ComponentChangingEvent.cs
- Light.cs
- PageTheme.cs
- ContentAlignmentEditor.cs
- DataServiceRequest.cs
- AspNetSynchronizationContext.cs
- SettingsPropertyNotFoundException.cs
- ContentValidator.cs
- SubstitutionResponseElement.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- WebPartMenu.cs
- Perspective.cs
- PasswordTextContainer.cs
- FontFaceLayoutInfo.cs
- Unit.cs
- ProfileSettingsCollection.cs
- InputQueue.cs
- NameNode.cs
- FloaterParagraph.cs
- DataGridHeaderBorder.cs
- SqlTriggerAttribute.cs
- Rotation3DAnimationBase.cs
- JoinElimination.cs
- Repeater.cs
- AssociatedControlConverter.cs
- XPathNavigatorReader.cs
- RenderContext.cs
- FixedSOMImage.cs
- WindowsGraphicsWrapper.cs
- XmlSerializer.cs
- XmlChoiceIdentifierAttribute.cs
- ThemeDirectoryCompiler.cs
- LocatorPart.cs
- SnapshotChangeTrackingStrategy.cs
- GradientSpreadMethodValidation.cs
- DrawingImage.cs
- MailMessageEventArgs.cs
- DictionarySectionHandler.cs
- SparseMemoryStream.cs
- WebScriptEnablingElement.cs
- PageHandlerFactory.cs
- CacheAxisQuery.cs
- InvalidComObjectException.cs
- SimpleTextLine.cs
- SQLByteStorage.cs
- InstanceHandleReference.cs
- MouseWheelEventArgs.cs
- OutputCacheProfile.cs
- XmlBinaryWriter.cs
- AssertSection.cs
- CheckPair.cs
- ChangeDirector.cs
- RemoveStoryboard.cs
- WindowAutomationPeer.cs
- HttpRuntimeSection.cs
- InvalidFilterCriteriaException.cs
- EventArgs.cs
- LineGeometry.cs
- LinearGradientBrush.cs
- BamlMapTable.cs
- TraceInternal.cs
- SqlUDTStorage.cs
- CustomTrackingRecord.cs
- FontEditor.cs
- HttpHandlersSection.cs
- BooleanFunctions.cs
- UntypedNullExpression.cs
- RSAPKCS1SignatureFormatter.cs