protected virtual void OnWebPartsDisconnected(WebPartConnectionsEventArgs e) { WebPartConnectionsEventHandler handler = (WebPartConnectionsEventHandler) base.Events[WebPartsDisconnectedEvent]; if (handler != null) { handler(this, e); } }
public virtual void DisconnectWebParts(WebPartConnection connection) { this.Personalization.EnsureEnabled(true); if (connection == null) { throw new ArgumentNullException("connection"); } WebPart provider = connection.Provider; ProviderConnectionPoint providerConnectionPoint = connection.ProviderConnectionPoint; WebPart consumer = connection.Consumer; ConsumerConnectionPoint consumerConnectionPoint = connection.ConsumerConnectionPoint; WebPartConnectionsCancelEventArgs e = new WebPartConnectionsCancelEventArgs(provider, providerConnectionPoint, consumer, consumerConnectionPoint, connection); this.OnWebPartsDisconnecting(e); if (!this._allowEventCancellation || !e.Cancel) { WebPartConnectionsEventArgs args2 = new WebPartConnectionsEventArgs(provider, providerConnectionPoint, consumer, consumerConnectionPoint); if (this.StaticConnections.Contains(connection)) { if (this.StaticConnections.IsReadOnly) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_DisconnectTooLate")); } if (this.Internals.ConnectionDeleted(connection)) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_AlreadyDisconnected")); } this.Internals.DeleteConnection(connection); this._hasDataChanged = true; this.OnWebPartsDisconnected(args2); } else { if (!this.DynamicConnections.Contains(connection)) { throw new ArgumentException(System.Web.SR.GetString("WebPartManager_UnknownConnection"), "connection"); } if (this.DynamicConnections.IsReadOnly) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_DisconnectTooLate")); } if (this.ShouldRemoveConnection(connection)) { this.DynamicConnections.Remove(connection); } else { if (this.Internals.ConnectionDeleted(connection)) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_AlreadyDisconnected")); } this.Internals.DeleteConnection(connection); } this._hasDataChanged = true; this.OnWebPartsDisconnected(args2); } } }
public virtual void DisconnectWebParts(WebPartConnection connection) { Personalization.EnsureEnabled(/* ensureModifiable */ true); if (connection == null) { throw new ArgumentNullException("connection"); } Debug.Assert(!(StaticConnections.Contains(connection) && DynamicConnections.Contains(connection))); WebPart provider = connection.Provider; ProviderConnectionPoint providerConnectionPoint = connection.ProviderConnectionPoint; WebPart consumer = connection.Consumer; ConsumerConnectionPoint consumerConnectionPoint = connection.ConsumerConnectionPoint; WebPartConnectionsCancelEventArgs ce = new WebPartConnectionsCancelEventArgs( provider, providerConnectionPoint, consumer, consumerConnectionPoint, connection); OnWebPartsDisconnecting(ce); if (_allowEventCancellation && ce.Cancel) { return; } WebPartConnectionsEventArgs eventArgs = new WebPartConnectionsEventArgs( provider, providerConnectionPoint, consumer, consumerConnectionPoint); if (StaticConnections.Contains(connection)) { if (StaticConnections.IsReadOnly) { throw new InvalidOperationException(SR.GetString(SR.WebPartManager_DisconnectTooLate)); } if (Internals.ConnectionDeleted(connection)) { throw new InvalidOperationException(SR.GetString(SR.WebPartManager_AlreadyDisconnected)); } Internals.DeleteConnection(connection); _hasDataChanged = true; OnWebPartsDisconnected(eventArgs); } else if (DynamicConnections.Contains(connection)) { if (DynamicConnections.IsReadOnly) { throw new InvalidOperationException(SR.GetString(SR.WebPartManager_DisconnectTooLate)); } if (ShouldRemoveConnection(connection)) { // Unshared dynamic connection should never be disabled Debug.Assert(!Internals.ConnectionDeleted(connection)); DynamicConnections.Remove(connection); } else { if (Internals.ConnectionDeleted(connection)) { throw new InvalidOperationException(SR.GetString(SR.WebPartManager_AlreadyDisconnected)); } Internals.DeleteConnection(connection); } _hasDataChanged = true; OnWebPartsDisconnected(eventArgs); } else { throw new ArgumentException(SR.GetString(SR.WebPartManager_UnknownConnection), "connection"); } }
protected virtual new void OnWebPartsDisconnected(WebPartConnectionsEventArgs e) { }