Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- Rectangle.cs
- PanelContainerDesigner.cs
- ToolStripDropDownClosedEventArgs.cs
- SecurityElement.cs
- Membership.cs
- OverrideMode.cs
- SubclassTypeValidatorAttribute.cs
- HwndSourceParameters.cs
- BindingBase.cs
- CmsUtils.cs
- ViewBase.cs
- EventLogPermissionAttribute.cs
- CacheOutputQuery.cs
- SingleAnimationUsingKeyFrames.cs
- ZipIOCentralDirectoryFileHeader.cs
- DataGridViewButtonColumn.cs
- DeobfuscatingStream.cs
- ButtonFlatAdapter.cs
- DoubleAverageAggregationOperator.cs
- WebPartActionVerb.cs
- CellNormalizer.cs
- _IPv6Address.cs
- StringSource.cs
- _LocalDataStore.cs
- PathParser.cs
- XpsException.cs
- OpenTypeLayout.cs
- ConfigurationElement.cs
- httpserverutility.cs
- AtlasWeb.Designer.cs
- XmlEventCache.cs
- EntityContainerEmitter.cs
- BinaryMethodMessage.cs
- SqlBooleanizer.cs
- DataGridComponentEditor.cs
- RestClientProxyHandler.cs
- TrustSection.cs
- ContentIterators.cs
- TypeDefinition.cs
- GridViewRowEventArgs.cs
- ExpressionDumper.cs
- XPathNodeInfoAtom.cs
- DefaultValueAttribute.cs
- SqlStatistics.cs
- ProjectionPlanCompiler.cs
- MemoryFailPoint.cs
- TypeSystemProvider.cs
- Predicate.cs
- WorkflowInstanceContextProvider.cs
- MessageRpc.cs
- UnsafeNativeMethodsPenimc.cs
- RootBuilder.cs
- PageStatePersister.cs
- XpsFilter.cs
- ClientSideProviderDescription.cs
- ContentElement.cs
- QilInvokeEarlyBound.cs
- FloaterParagraph.cs
- ToolStripManager.cs
- BulletedListEventArgs.cs
- Types.cs
- SpeakProgressEventArgs.cs
- WebHttpDispatchOperationSelector.cs
- HtmlToClrEventProxy.cs
- ObjectDataSourceView.cs
- ObjectDataSourceDisposingEventArgs.cs
- EntityDataSourceWrapper.cs
- HScrollBar.cs
- RuntimeEnvironment.cs
- SoapWriter.cs
- BuildProvider.cs
- ManagedIStream.cs
- ConnectionProviderAttribute.cs
- OdbcParameter.cs
- AddDataControlFieldDialog.cs
- SqlProcedureAttribute.cs
- Material.cs
- TextFormattingConverter.cs
- CurrentTimeZone.cs
- XmlWhitespace.cs
- VariableQuery.cs
- WebServiceEnumData.cs
- LoginCancelEventArgs.cs
- CalendarTable.cs
- InputScopeConverter.cs
- CharacterString.cs
- SerializableTypeCodeDomSerializer.cs
- BufferModeSettings.cs
- BindableTemplateBuilder.cs
- cryptoapiTransform.cs
- GifBitmapEncoder.cs
- ParameterCollection.cs
- FlowDocumentReader.cs
- ToolStripStatusLabel.cs
- Set.cs
- HierarchicalDataBoundControlAdapter.cs
- MultiByteCodec.cs
- XmlSchemaSimpleType.cs
- WebHeaderCollection.cs
- OpCopier.cs