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
- MarkupProperty.cs
- ConnectionStringSettings.cs
- XmlSchemaSubstitutionGroup.cs
- BitmapEffectGeneralTransform.cs
- TaiwanLunisolarCalendar.cs
- DataServiceRequest.cs
- XmlSchemaAttributeGroupRef.cs
- MaskInputRejectedEventArgs.cs
- SafeNativeMethodsCLR.cs
- DesignTable.cs
- XpsLiterals.cs
- X509Logo.cs
- BridgeDataReader.cs
- TextureBrush.cs
- DataSourceConverter.cs
- PointLightBase.cs
- MessageBox.cs
- Screen.cs
- ControlValuePropertyAttribute.cs
- Journaling.cs
- XmlTextWriter.cs
- X509ServiceCertificateAuthentication.cs
- RenderData.cs
- CodeAttributeDeclaration.cs
- PageThemeBuildProvider.cs
- InvalidDataException.cs
- ReflectionUtil.cs
- TableAutomationPeer.cs
- HtmlHistory.cs
- StorageAssociationSetMapping.cs
- ControlIdConverter.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- Int32KeyFrameCollection.cs
- CLRBindingWorker.cs
- Overlapped.cs
- AlgoModule.cs
- Int32Animation.cs
- HostingEnvironment.cs
- ContentHostHelper.cs
- compensatingcollection.cs
- ErrorWrapper.cs
- Graphics.cs
- GlobalizationSection.cs
- X509ClientCertificateCredentialsElement.cs
- RichTextBox.cs
- DataSourceHelper.cs
- CompletionBookmark.cs
- OperatorExpressions.cs
- WSUtilitySpecificationVersion.cs
- TextCompositionManager.cs
- MatrixKeyFrameCollection.cs
- ZipIOFileItemStream.cs
- OleCmdHelper.cs
- SiteMapSection.cs
- MenuStrip.cs
- HtmlInputText.cs
- ControlBindingsCollection.cs
- PropertyPathWorker.cs
- SyndicationSerializer.cs
- MethodCallExpression.cs
- ContentHostHelper.cs
- GcSettings.cs
- CompositeDispatchFormatter.cs
- LoginUtil.cs
- PerformanceCounterNameAttribute.cs
- DiscoveryEndpointValidator.cs
- SqlFlattener.cs
- ModelFunction.cs
- Rss20ItemFormatter.cs
- BindingList.cs
- TextSpanModifier.cs
- CompensationDesigner.cs
- ErrorWrapper.cs
- WebZone.cs
- HttpDictionary.cs
- ObjectQueryExecutionPlan.cs
- TreeNodeCollectionEditorDialog.cs
- HiddenField.cs
- WaitForChangedResult.cs
- ChangePassword.cs
- WorkflowServiceNamespace.cs
- SamlAttribute.cs
- PeerNearMe.cs
- DecimalAverageAggregationOperator.cs
- NativeCompoundFileAPIs.cs
- EntitySqlQueryBuilder.cs
- ScrollChangedEventArgs.cs
- CodeTypeDelegate.cs
- IntPtr.cs
- UIElementAutomationPeer.cs
- TimeSpan.cs
- GenericEnumConverter.cs
- WindowsStatic.cs
- DynamicRendererThreadManager.cs
- PageParserFilter.cs
- HtmlButton.cs
- EncoderParameters.cs
- PassportPrincipal.cs
- XmlAttributeCache.cs
- SignedXml.cs