Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebParts / WebPartTracker.cs / 1 / WebPartTracker.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls.WebParts { using System; using System.Collections; using System.ComponentModel; using System.Diagnostics; using System.Drawing.Design; using System.Security.Permissions; using System.Web; using System.Web.UI; [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class WebPartTracker : IDisposable { private bool _disposed; private WebPart _webPart; private ProviderConnectionPoint _providerConnectionPoint; public WebPartTracker(WebPart webPart, ProviderConnectionPoint providerConnectionPoint) { if (webPart == null) { throw new ArgumentNullException("webPart"); } if (providerConnectionPoint == null) { throw new ArgumentNullException("providerConnectionPoint"); } if (providerConnectionPoint.ControlType != webPart.GetType()) { throw new ArgumentException(SR.GetString(SR.WebPartManager_InvalidConnectionPoint), "providerConnectionPoint"); } _webPart = webPart; _providerConnectionPoint = providerConnectionPoint; if (++Count > 1) { webPart.SetConnectErrorMessage(SR.GetString( SR.WebPartTracker_CircularConnection, _providerConnectionPoint.DisplayName)); } } public bool IsCircularConnection { get { return (Count > 1); } } private int Count { get { int count; _webPart.TrackerCounter.TryGetValue(_providerConnectionPoint, out count); return count; } set { _webPart.TrackerCounter[_providerConnectionPoint] = value; } } void IDisposable.Dispose() { if (!_disposed) { Debug.Assert(Count >= 1); Count--; _disposed = true; } } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ImageDrawing.cs
- WorkflowRuntimeBehavior.cs
- DataPointer.cs
- Propagator.JoinPropagator.cs
- CompoundFileStorageReference.cs
- Int16AnimationUsingKeyFrames.cs
- ObjectStorage.cs
- PasswordRecovery.cs
- GetPageNumberCompletedEventArgs.cs
- ReadWriteObjectLock.cs
- ComAdminWrapper.cs
- WebPartCloseVerb.cs
- OutputCacheSettings.cs
- X509SecurityTokenProvider.cs
- StaticResourceExtension.cs
- TemplateManager.cs
- DbProviderFactoriesConfigurationHandler.cs
- BitmapSizeOptions.cs
- ConsumerConnectionPoint.cs
- SharedPersonalizationStateInfo.cs
- AssemblyGen.cs
- XmlSchemaComplexContent.cs
- WaitHandle.cs
- TcpServerChannel.cs
- RegexRunner.cs
- WebCategoryAttribute.cs
- DoubleStorage.cs
- ProxyAttribute.cs
- FontStyle.cs
- Cursors.cs
- InputMethodStateChangeEventArgs.cs
- PageContentCollection.cs
- ArrayList.cs
- Highlights.cs
- ErrorRuntimeConfig.cs
- codemethodreferenceexpression.cs
- NamespaceEmitter.cs
- OptimalBreakSession.cs
- XmlDataSource.cs
- IndentTextWriter.cs
- Decimal.cs
- SatelliteContractVersionAttribute.cs
- TextRenderingModeValidation.cs
- FrameworkRichTextComposition.cs
- SudsCommon.cs
- safelinkcollection.cs
- System.Data_BID.cs
- ApplicationBuildProvider.cs
- XmlSchemaValidator.cs
- EncryptionUtility.cs
- TransformGroup.cs
- GridViewRowPresenter.cs
- DropTarget.cs
- ReferenceTypeElement.cs
- TreeNodeEventArgs.cs
- CompositeControl.cs
- XPathNodeList.cs
- WebScriptServiceHost.cs
- EventLogConfiguration.cs
- ResourceContainer.cs
- TypeLoadException.cs
- XamlStyleSerializer.cs
- DataGridRelationshipRow.cs
- WebPartRestoreVerb.cs
- SafeSystemMetrics.cs
- FileReader.cs
- DocumentOrderQuery.cs
- Queue.cs
- TypedServiceChannelBuilder.cs
- Int16AnimationUsingKeyFrames.cs
- StatusStrip.cs
- EncoderFallback.cs
- XMLSyntaxException.cs
- Ipv6Element.cs
- WizardPanel.cs
- DataGridSortCommandEventArgs.cs
- MatrixAnimationBase.cs
- EventItfInfo.cs
- XmlSiteMapProvider.cs
- RouteTable.cs
- ReceiveActivityDesignerTheme.cs
- EntityCommandDefinition.cs
- PageAsyncTaskManager.cs
- DependencyObjectType.cs
- ControlValuePropertyAttribute.cs
- ConditionBrowserDialog.cs
- DataGridTablesFactory.cs
- Decoder.cs
- MailWebEventProvider.cs
- InlineObject.cs
- PowerModeChangedEventArgs.cs
- SessionEndingCancelEventArgs.cs
- WindowsGraphics.cs
- StringArrayConverter.cs
- PathGeometry.cs
- ToolStripControlHost.cs
- PtsContext.cs
- ClientBuildManagerCallback.cs
- ColumnCollection.cs
- SqlMethodAttribute.cs