Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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; } } } } // 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
- SQLDouble.cs
- SymmetricKeyWrap.cs
- OdbcTransaction.cs
- DataGridViewCellEventArgs.cs
- HandlerFactoryCache.cs
- HebrewCalendar.cs
- XmlBinaryWriterSession.cs
- BaseResourcesBuildProvider.cs
- BinaryNode.cs
- SystemIPAddressInformation.cs
- FixedSOMGroup.cs
- TreeViewImageIndexConverter.cs
- ImageClickEventArgs.cs
- DecodeHelper.cs
- SqlDeflator.cs
- X509CertificateChain.cs
- PackagePartCollection.cs
- XmlDataCollection.cs
- Brush.cs
- DetailsViewRow.cs
- QilName.cs
- DataKeyCollection.cs
- ObjectDataSource.cs
- PropertyToken.cs
- ColumnPropertiesGroup.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- ArgIterator.cs
- SortedDictionary.cs
- DependencyObject.cs
- DebugInfoGenerator.cs
- SerializationStore.cs
- ZoomPercentageConverter.cs
- ContentPlaceHolder.cs
- LongValidator.cs
- QilUnary.cs
- ComplexTypeEmitter.cs
- GenerateHelper.cs
- EdgeProfileValidation.cs
- ListSortDescriptionCollection.cs
- PhoneCallDesigner.cs
- FrameworkTemplate.cs
- UIElementParagraph.cs
- SerialPort.cs
- hwndwrapper.cs
- XmlSchemaCompilationSettings.cs
- PowerModeChangedEventArgs.cs
- ClientUrlResolverWrapper.cs
- Point3DConverter.cs
- GestureRecognizer.cs
- SemanticBasicElement.cs
- WindowVisualStateTracker.cs
- SecurityIdentifierElementCollection.cs
- TaiwanLunisolarCalendar.cs
- SecurityUtils.cs
- HotSpotCollection.cs
- BooleanSwitch.cs
- TrackingWorkflowEventArgs.cs
- SatelliteContractVersionAttribute.cs
- UTF32Encoding.cs
- WebInvokeAttribute.cs
- ClosureBinding.cs
- StatusBarDrawItemEvent.cs
- FacetDescription.cs
- ResourceDisplayNameAttribute.cs
- _HTTPDateParse.cs
- PointCollectionValueSerializer.cs
- AssociationTypeEmitter.cs
- securitycriticaldataformultiplegetandset.cs
- CapabilitiesState.cs
- _Win32.cs
- FileDialog_Vista.cs
- RowBinding.cs
- ValueSerializer.cs
- ClipboardData.cs
- RestHandler.cs
- InternalResources.cs
- BitmapFrame.cs
- RequiredFieldValidator.cs
- BamlVersionHeader.cs
- TextSpanModifier.cs
- TabRenderer.cs
- UpdatePanelTrigger.cs
- EventLogger.cs
- Run.cs
- RewritingValidator.cs
- BinaryUtilClasses.cs
- TrustLevel.cs
- ActivitiesCollection.cs
- ComboBoxRenderer.cs
- ScrollBarRenderer.cs
- Visitors.cs
- ChangeDirector.cs
- XmlCodeExporter.cs
- ArrayConverter.cs
- SafeIUnknown.cs
- SuppressIldasmAttribute.cs
- PolyQuadraticBezierSegment.cs
- VectorCollectionValueSerializer.cs
- BitmapInitialize.cs
- ClientSettingsProvider.cs