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
- BaseInfoTable.cs
- COM2AboutBoxPropertyDescriptor.cs
- DataGridViewRowCollection.cs
- CatalogZone.cs
- LogStore.cs
- HelpInfo.cs
- FixedSOMPageElement.cs
- RuleSettings.cs
- AnnotationComponentManager.cs
- SchemaMerger.cs
- XmlValidatingReader.cs
- ClientTarget.cs
- ParallelTimeline.cs
- TrayIconDesigner.cs
- XmlReaderSettings.cs
- SymLanguageType.cs
- SocketPermission.cs
- StringCollectionEditor.cs
- ScriptManagerProxy.cs
- ToolStripContainerDesigner.cs
- SQLByteStorage.cs
- UTF7Encoding.cs
- WinInetCache.cs
- DecoderFallback.cs
- PageCatalogPart.cs
- DataSetMappper.cs
- WebBodyFormatMessageProperty.cs
- DocumentViewerConstants.cs
- ToolStripDropDownMenu.cs
- FlowDocumentView.cs
- SiteMapDataSourceView.cs
- DataGrid.cs
- ClrProviderManifest.cs
- SqlFactory.cs
- CanonicalFontFamilyReference.cs
- WmlValidationSummaryAdapter.cs
- xdrvalidator.cs
- WebCategoryAttribute.cs
- XDeferredAxisSource.cs
- HTTPNotFoundHandler.cs
- PixelFormat.cs
- StoreAnnotationsMap.cs
- StateDesigner.Helpers.cs
- Enum.cs
- StyleXamlParser.cs
- MatrixCamera.cs
- DiscoveryDocument.cs
- _TimerThread.cs
- UnsafeNativeMethods.cs
- DataServiceSaveChangesEventArgs.cs
- Thickness.cs
- ProxyElement.cs
- Int32Storage.cs
- SignatureDescription.cs
- RuntimeConfig.cs
- listitem.cs
- ConnectionPoolRegistry.cs
- Brush.cs
- SafeBitVector32.cs
- CacheChildrenQuery.cs
- DrawItemEvent.cs
- OdbcParameter.cs
- UnionExpr.cs
- WebPartConnectionsCancelVerb.cs
- TraceXPathNavigator.cs
- Font.cs
- XmlCharType.cs
- CodeTypeMember.cs
- ElementUtil.cs
- MarshalByRefObject.cs
- Shape.cs
- ColorConvertedBitmapExtension.cs
- StreamReader.cs
- RouteCollection.cs
- CapabilitiesPattern.cs
- BackoffTimeoutHelper.cs
- GridViewEditEventArgs.cs
- AuthStoreRoleProvider.cs
- Stacktrace.cs
- ObjectConverter.cs
- CompatibleIComparer.cs
- ModelPropertyDescriptor.cs
- BaseDataBoundControlDesigner.cs
- DerivedKeySecurityToken.cs
- EntityDataSourceState.cs
- DataGridViewImageColumn.cs
- EditableRegion.cs
- SchemaCompiler.cs
- WebConfigurationManager.cs
- SctClaimDictionary.cs
- ClrPerspective.cs
- DrawingBrush.cs
- BitmapEffectGroup.cs
- SetStateEventArgs.cs
- PermissionSet.cs
- DocumentPaginator.cs
- EntitySqlQueryCacheKey.cs
- StateMachineHelpers.cs
- BindingExpressionUncommonField.cs
- StatusStrip.cs