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
- CodeThrowExceptionStatement.cs
- DescriptionAttribute.cs
- ImageFormatConverter.cs
- ParseChildrenAsPropertiesAttribute.cs
- LayoutEngine.cs
- ListItemCollection.cs
- Hashtable.cs
- ActivityStateQuery.cs
- RegexTree.cs
- SchemaSetCompiler.cs
- mediaclock.cs
- ConfigXmlComment.cs
- SiteMapNodeItem.cs
- PublisherIdentityPermission.cs
- WebProxyScriptElement.cs
- _FtpDataStream.cs
- PropertyGridView.cs
- ActiveXContainer.cs
- HttpAsyncResult.cs
- NativeRightsManagementAPIsStructures.cs
- AssemblyAttributes.cs
- ImagingCache.cs
- TraceProvider.cs
- Queue.cs
- SpeechEvent.cs
- TraceXPathNavigator.cs
- DataGridItemEventArgs.cs
- TransformPattern.cs
- HttpListener.cs
- StringInfo.cs
- InternalControlCollection.cs
- DataGridViewButtonCell.cs
- TextSelectionHighlightLayer.cs
- ExpressionPrefixAttribute.cs
- BaseWebProxyFinder.cs
- JsonObjectDataContract.cs
- HighlightComponent.cs
- ExpanderAutomationPeer.cs
- WebPartTransformerAttribute.cs
- FormViewRow.cs
- DefaultPropertyAttribute.cs
- SqlDependencyListener.cs
- VBIdentifierTrimConverter.cs
- QuerySettings.cs
- DiagnosticsConfiguration.cs
- SafeRightsManagementSessionHandle.cs
- UnionCqlBlock.cs
- HashSetEqualityComparer.cs
- ScriptBehaviorDescriptor.cs
- BaseCodeDomTreeGenerator.cs
- SafeLocalMemHandle.cs
- DES.cs
- StringKeyFrameCollection.cs
- HijriCalendar.cs
- CommentGlyph.cs
- SqlDataAdapter.cs
- Formatter.cs
- CommandTreeTypeHelper.cs
- MasterPageParser.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- ToolStripGripRenderEventArgs.cs
- AttributeTable.cs
- __Filters.cs
- SourceInterpreter.cs
- Normalization.cs
- List.cs
- StreamReader.cs
- ToolStripDropTargetManager.cs
- SafeFileMappingHandle.cs
- IriParsingElement.cs
- BookmarkEventArgs.cs
- RtType.cs
- _ChunkParse.cs
- EmptyElement.cs
- Run.cs
- GroupQuery.cs
- ProtocolsSection.cs
- HttpMethodAttribute.cs
- PackageFilter.cs
- UInt32.cs
- FontCacheLogic.cs
- BindingValueChangedEventArgs.cs
- ToolStripRendererSwitcher.cs
- DataSourceControl.cs
- ObjectListItem.cs
- ConfigurationStrings.cs
- ErasingStroke.cs
- EntityConnectionStringBuilderItem.cs
- RequestStatusBarUpdateEventArgs.cs
- Translator.cs
- GridEntry.cs
- Point3D.cs
- DashStyle.cs
- Rect3DConverter.cs
- StylusCollection.cs
- InkCanvasAutomationPeer.cs
- CurrentChangingEventArgs.cs
- BehaviorEditorPart.cs
- PrivilegeNotHeldException.cs
- InputElement.cs