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
- ToolStripProfessionalLowResolutionRenderer.cs
- ReadOnlyNameValueCollection.cs
- XmlQuerySequence.cs
- ModelVisual3D.cs
- DataColumnSelectionConverter.cs
- MetaModel.cs
- ObjectFullSpanRewriter.cs
- DoubleKeyFrameCollection.cs
- TextTreeNode.cs
- SqlNode.cs
- Translator.cs
- QilGenerator.cs
- EndpointAddress.cs
- JournalNavigationScope.cs
- ItemContainerProviderWrapper.cs
- TextServicesCompartmentContext.cs
- HtmlHead.cs
- OutputCacheProfile.cs
- DataGridViewCheckBoxCell.cs
- XPathNodeIterator.cs
- DragEventArgs.cs
- GridViewCancelEditEventArgs.cs
- Propagator.ExtentPlaceholderCreator.cs
- SetIterators.cs
- Bitmap.cs
- BasicHttpBindingCollectionElement.cs
- HttpListenerResponse.cs
- KnownBoxes.cs
- ClientSideProviderDescription.cs
- SchemaLookupTable.cs
- userdatakeys.cs
- HttpCookie.cs
- NumericUpDownAccelerationCollection.cs
- XmlHierarchicalDataSourceView.cs
- ArraySet.cs
- StylusButton.cs
- BitmapEffectCollection.cs
- CanExecuteRoutedEventArgs.cs
- SmtpFailedRecipientException.cs
- SystemKeyConverter.cs
- ExpressionCopier.cs
- MailSettingsSection.cs
- InvalidCardException.cs
- SystemUnicastIPAddressInformation.cs
- InfoCardClaimCollection.cs
- EntityConnectionStringBuilder.cs
- OracleTimeSpan.cs
- IPAddress.cs
- _LocalDataStore.cs
- XsdDuration.cs
- ChangePasswordDesigner.cs
- SqlDataSource.cs
- FastEncoder.cs
- Base64Encoder.cs
- Range.cs
- UnsafeNativeMethodsPenimc.cs
- SystemIPAddressInformation.cs
- HGlobalSafeHandle.cs
- ScopeCollection.cs
- Encoder.cs
- OleStrCAMarshaler.cs
- RecordConverter.cs
- CollectionChangeEventArgs.cs
- userdatakeys.cs
- TrackingParameters.cs
- PrintDocument.cs
- SchemaObjectWriter.cs
- SimpleWebHandlerParser.cs
- StorageEndPropertyMapping.cs
- DisposableCollectionWrapper.cs
- HighlightComponent.cs
- Annotation.cs
- ValidationErrorCollection.cs
- ToolStripSeparatorRenderEventArgs.cs
- XmlValueConverter.cs
- CachedPathData.cs
- HttpResponse.cs
- EncoderFallback.cs
- ReadOnlyTernaryTree.cs
- _UriSyntax.cs
- Cursors.cs
- CommonDialog.cs
- DATA_BLOB.cs
- ToolStripPanelCell.cs
- DataFormats.cs
- EntryPointNotFoundException.cs
- Compiler.cs
- ImageFormatConverter.cs
- PreviewPageInfo.cs
- TabletCollection.cs
- SrgsNameValueTag.cs
- UnsafeNativeMethods.cs
- ConditionalAttribute.cs
- TemplateBindingExpressionConverter.cs
- XmlTextWriter.cs
- XmlHierarchicalEnumerable.cs
- BigInt.cs
- OracleEncoding.cs
- MemberPathMap.cs
- MethodBuilder.cs