Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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. //------------------------------------------------------------------------------ //// 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DebugController.cs
- DataGridViewMethods.cs
- configsystem.cs
- SpecialFolderEnumConverter.cs
- SiteOfOriginContainer.cs
- ListView.cs
- ManagementPath.cs
- RouteParameter.cs
- XmlElementAttributes.cs
- wmiprovider.cs
- VisemeEventArgs.cs
- ArgumentNullException.cs
- LinkArea.cs
- TokenBasedSetEnumerator.cs
- ClonableStack.cs
- HtmlProps.cs
- SoapMessage.cs
- WpfXamlType.cs
- HttpRequest.cs
- _NetworkingPerfCounters.cs
- FontCacheUtil.cs
- CodeGen.cs
- OleDbErrorCollection.cs
- HtmlProps.cs
- IdentifierCollection.cs
- OutputCacheSettingsSection.cs
- StandardBindingReliableSessionElement.cs
- UserControlParser.cs
- InternalSafeNativeMethods.cs
- SetIterators.cs
- NameValueFileSectionHandler.cs
- PropertyMetadata.cs
- UnknownWrapper.cs
- InvokeHandlers.cs
- versioninfo.cs
- Solver.cs
- TraceHwndHost.cs
- Html32TextWriter.cs
- transactioncontext.cs
- FilteredDataSetHelper.cs
- CounterCreationDataConverter.cs
- IfAction.cs
- StylusEditingBehavior.cs
- XmlNamedNodeMap.cs
- FlowLayoutPanel.cs
- TableCell.cs
- BackStopAuthenticationModule.cs
- RegionIterator.cs
- MonitoringDescriptionAttribute.cs
- PassportAuthenticationEventArgs.cs
- FieldValue.cs
- ProviderIncompatibleException.cs
- XmlObjectSerializerReadContextComplexJson.cs
- UntypedNullExpression.cs
- PartialCachingControl.cs
- SmiXetterAccessMap.cs
- DataSourceDesigner.cs
- RC2.cs
- NativeMethodsOther.cs
- WS2007FederationHttpBindingCollectionElement.cs
- ConfigurationSectionGroupCollection.cs
- CustomErrorsSectionWrapper.cs
- HealthMonitoringSectionHelper.cs
- Hashtable.cs
- OrderedDictionaryStateHelper.cs
- SingleConverter.cs
- BitmapEffectInput.cs
- WorkflowMarkupSerializerMapping.cs
- PeerNode.cs
- XmlDictionaryString.cs
- XmlSchemaSimpleContent.cs
- CodeTryCatchFinallyStatement.cs
- TheQuery.cs
- ClosureBinding.cs
- ObjectListDataBindEventArgs.cs
- EnumUnknown.cs
- StickyNoteHelper.cs
- XhtmlBasicPageAdapter.cs
- MruCache.cs
- DesignTimeHTMLTextWriter.cs
- XmlDataSourceView.cs
- EventItfInfo.cs
- ReceiveErrorHandling.cs
- WSSecurityOneDotZeroReceiveSecurityHeader.cs
- Condition.cs
- AddressingProperty.cs
- ReferenceService.cs
- ConfigurationLocationCollection.cs
- Exceptions.cs
- ConsumerConnectionPointCollection.cs
- TextContainerChangeEventArgs.cs
- XmlDocument.cs
- LocalizableResourceBuilder.cs
- FilterEventArgs.cs
- PeekCompletedEventArgs.cs
- LogLogRecordEnumerator.cs
- RotateTransform3D.cs
- HashCodeCombiner.cs
- XsltException.cs
- ScrollBar.cs