public WebPartConnectionsEventArgs(WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint, WebPartConnection connection) : this(provider, providerConnectionPoint, consumer, consumerConnectionPoint) { _connection = connection; }
internal bool ConflictsWith(WebPartConnection otherConnection) { if (!this.ConflictsWithConsumer(otherConnection)) { return(this.ConflictsWithProvider(otherConnection)); } return(true); }
internal bool ConflictsWithConsumer(WebPartConnection otherConnection) { return(!ConsumerConnectionPoint.AllowsMultipleConnections && Consumer == otherConnection.Consumer && ConsumerConnectionPoint == otherConnection.ConsumerConnectionPoint); }
private void LoadDynamicConnections(PersonalizationEntry entry) { if (entry != null) { object[] objArray = (object[]) entry.Value; if (objArray != null) { for (int i = 0; i < objArray.Length; i += 7) { string str = (string) objArray[i]; string str2 = (string) objArray[i + 1]; string str3 = (string) objArray[i + 2]; string str4 = (string) objArray[i + 3]; string str5 = (string) objArray[i + 4]; WebPartConnection connection = new WebPartConnection { ID = str, ConsumerID = str2, ConsumerConnectionPointID = str3, ProviderID = str4, ProviderConnectionPointID = str5 }; this.Internals.SetIsShared(connection, entry.Scope == PersonalizationScope.Shared); this.Internals.SetIsStatic(connection, false); Type type = objArray[i + 5] as Type; if (type != null) { if (!type.IsSubclassOf(typeof(WebPartTransformer))) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartTransformerAttribute_NotTransformer", new object[] { type.Name })); } object savedState = objArray[i + 6]; WebPartTransformer transformer = (WebPartTransformer) this.Internals.CreateObjectFromType(type); this.Internals.LoadConfigurationState(transformer, savedState); this.Internals.SetTransformer(connection, transformer); } this.DynamicConnections.Add(connection); } } } }
public int IndexOf(WebPartConnection value) { return(List.IndexOf(value)); }
public void SetIsStatic(WebPartConnection connection, bool isStatic) { }
public void Remove(WebPartConnection value) { }
internal bool ConflictsWithProvider(WebPartConnection otherConnection) { return ((!this.ProviderConnectionPoint.AllowsMultipleConnections && (this.Provider == otherConnection.Provider)) && (this.ProviderConnectionPoint == otherConnection.ProviderConnectionPoint)); }
public WebPartConnectionsEventArgs(WebPart provider, System.Web.UI.WebControls.WebParts.ProviderConnectionPoint providerConnectionPoint, WebPart consumer, System.Web.UI.WebControls.WebParts.ConsumerConnectionPoint consumerConnectionPoint, WebPartConnection connection) : this(provider, providerConnectionPoint, consumer, consumerConnectionPoint) { this._connection = connection; }
internal bool ConflictsWithProvider(WebPartConnection otherConnection) { return((!this.ProviderConnectionPoint.AllowsMultipleConnections && (this.Provider == otherConnection.Provider)) && (this.ProviderConnectionPoint == otherConnection.ProviderConnectionPoint)); }
public WebPartConnectionsEventArgs(WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint, WebPartConnection connection) { }
public void DeleteConnection(WebPartConnection connection) { connection.Deleted = true; }
public bool ConnectionDeleted(WebPartConnection connection) { return(connection.Deleted); }
internal bool ConflictsWithProvider(WebPartConnection otherConnection) { return(!ProviderConnectionPoint.AllowsMultipleConnections && Provider == otherConnection.Provider && ProviderConnectionPoint == otherConnection.ProviderConnectionPoint); }
public void SetTransformer(WebPartConnection connection, WebPartTransformer transformer) { }
public void DeleteConnection(WebPartConnection connection) { }
public bool Contains (WebPartConnection value) { return default(bool); }
public bool Contains(WebPartConnection value) { return(default(bool)); }
public void CopyTo (WebPartConnection[] array, int index) { Contract.Ensures (array.Length >= 0); }
private void RenderExistingProviderConnection(HtmlTextWriter writer, WebPartConnection connection) { WebPart webPartToConnect = WebPartToConnect; Debug.Assert(connection.Consumer == webPartToConnect); ConsumerConnectionPoint consumerConnectionPoint = WebPartManager.GetConsumerConnectionPoint(webPartToConnect, connection.ConsumerConnectionPointID); WebPart provider = connection.Provider; ProviderConnectionPoint providerConnectionPoint = connection.ProviderConnectionPoint; string providerString = GetDisplayTitle(provider, providerConnectionPoint, false); // Transformer string transformerEventArgs = null; WebPartTransformer transformer = connection.Transformer; if (transformer != null && HasConfigurationControl(transformer)) { transformerEventArgs = configureEventArgument + ID_SEPARATOR.ToString(CultureInfo.InvariantCulture) + connection.ID; } bool isActive = providerConnectionPoint != null && consumerConnectionPoint != null && connection.Provider != null && connection.Consumer != null && connection.IsActive; // IsActive already checks for these: Debug.Assert(!connection.Provider.IsClosed && !connection.Consumer.IsClosed); RenderExistingConnection(writer, (consumerConnectionPoint != null ? consumerConnectionPoint.DisplayName : SR.GetString(SR.Part_Unknown)), providerString, String.Join(ID_SEPARATOR.ToString(CultureInfo.InvariantCulture), new string[] { disconnectEventArgument, connection.ID }), transformerEventArgs, false, isActive); }
public int IndexOf (WebPartConnection value) { Contract.Ensures (Contract.Result<int>() >= -1); return default(int); }
public bool ConnectionDeleted(WebPartConnection connection) { return(default(bool)); }
public void Remove (WebPartConnection value) { }
public int Add(WebPartConnection value) { return(List.Add(value)); }
public int IndexOf(WebPartConnection value) { Contract.Ensures(Contract.Result <int>() >= -1); return(default(int)); }
public virtual WebPartConnection ConnectWebParts(WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint, WebPartTransformer transformer) { this.CanConnectWebPartsCore(provider, providerConnectionPoint, consumer, consumerConnectionPoint, transformer, true); if (this.DynamicConnections.IsReadOnly) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_ConnectTooLate")); } WebPartConnectionsCancelEventArgs e = new WebPartConnectionsCancelEventArgs(provider, providerConnectionPoint, consumer, consumerConnectionPoint); this.OnWebPartsConnecting(e); if (this._allowEventCancellation && e.Cancel) { return null; } Control control = provider.ToControl(); Control control2 = consumer.ToControl(); WebPartConnection connection = new WebPartConnection { ID = this.CreateDynamicConnectionID(), ProviderID = control.ID, ConsumerID = control2.ID, ProviderConnectionPointID = providerConnectionPoint.ID, ConsumerConnectionPointID = consumerConnectionPoint.ID }; if (transformer != null) { this.Internals.SetTransformer(connection, transformer); } this.Internals.SetIsShared(connection, this.Personalization.Scope == PersonalizationScope.Shared); this.Internals.SetIsStatic(connection, false); this.DynamicConnections.Add(connection); this._hasDataChanged = true; this.OnWebPartsConnected(new WebPartConnectionsEventArgs(provider, providerConnectionPoint, consumer, consumerConnectionPoint, connection)); return connection; }
public virtual new void DisconnectWebParts(WebPartConnection connection) { }
private WebPartConnection[] ConnectionsToActivate() { ArrayList connectionsToActivate = new ArrayList(); HybridDictionary connectionIDs = new HybridDictionary(true); WebPartConnection[] array = new WebPartConnection[this.StaticConnections.Count + this.DynamicConnections.Count]; this.StaticConnections.CopyTo(array, 0); this.DynamicConnections.CopyTo(array, this.StaticConnections.Count); foreach (WebPartConnection connection in array) { this.ConnectionsToActivateHelper(connection, connectionIDs, connectionsToActivate); } WebPartConnection[] connectionArray2 = (WebPartConnection[]) connectionsToActivate.ToArray(typeof(WebPartConnection)); foreach (WebPartConnection connection2 in connectionArray2) { if (!connection2.IsShared) { ArrayList list2 = new ArrayList(); foreach (WebPartConnection connection3 in connectionsToActivate) { if (((connection2 != connection3) && connection3.IsShared) && connection2.ConflictsWith(connection3)) { list2.Add(connection3); } } foreach (WebPartConnection connection4 in list2) { this.DisconnectWebParts(connection4); connectionsToActivate.Remove(connection4); } } } connectionArray2 = (WebPartConnection[]) connectionsToActivate.ToArray(typeof(WebPartConnection)); foreach (WebPartConnection connection5 in connectionArray2) { if (connection5.IsShared && !connection5.IsStatic) { ArrayList list3 = new ArrayList(); foreach (WebPartConnection connection6 in connectionsToActivate) { if (((connection5 != connection6) && connection6.IsStatic) && connection5.ConflictsWith(connection6)) { list3.Add(connection6); } } foreach (WebPartConnection connection7 in list3) { this.DisconnectWebParts(connection7); connectionsToActivate.Remove(connection7); } } } ArrayList list4 = new ArrayList(); foreach (WebPartConnection connection8 in connectionsToActivate) { bool flag = false; foreach (WebPartConnection connection9 in connectionsToActivate) { if (connection8 != connection9) { if (connection8.ConflictsWithConsumer(connection9)) { connection8.Consumer.SetConnectErrorMessage(System.Web.SR.GetString("WebPartConnection_Duplicate", new object[] { connection8.ConsumerConnectionPoint.DisplayName, connection8.Consumer.DisplayTitle })); flag = true; } if (connection8.ConflictsWithProvider(connection9)) { connection8.Consumer.SetConnectErrorMessage(System.Web.SR.GetString("WebPartConnection_Duplicate", new object[] { connection8.ProviderConnectionPoint.DisplayName, connection8.Provider.DisplayTitle })); flag = true; } } } if (!flag) { list4.Add(connection8); } } this.StaticConnections.SetReadOnly("WebPartManager_StaticConnectionsReadOnly"); this.DynamicConnections.SetReadOnly("WebPartManager_DynamicConnectionsReadOnly"); return (WebPartConnection[]) list4.ToArray(typeof(WebPartConnection)); }
/// <devdoc> /// Inserts a WebPartConnection into the collection. /// </devdoc> public void Insert(int index, WebPartConnection value) { List.Insert(index, value); }
/// <devdoc> /// Removes a WebPartConnection from the collection. /// </devdoc> public void Remove(WebPartConnection value) { List.Remove(value); }
public bool ConnectionDeleted(WebPartConnection connection) { return default(bool); }
/// <devdoc> /// Adds a Connection to the collection. /// </devdoc> public int Add(WebPartConnection value) { return List.Add(value); }
internal bool ConflictsWith(WebPartConnection otherConnection) { if (!this.ConflictsWithConsumer(otherConnection)) { return this.ConflictsWithProvider(otherConnection); } return true; }
/// <devdoc> /// True if the WebPartConnection is contained in the collection. /// </devdoc> public bool Contains(WebPartConnection value) { return List.Contains(value); }
public int Add(WebPartConnection value) { return(default(int)); }
public void CopyTo(WebPartConnection[] array, int index) { List.CopyTo(array, index); }
public int IndexOf(WebPartConnection value) { return(default(int)); }
public int IndexOf(WebPartConnection value) { return List.IndexOf(value); }
public WebPartConnectionsEventArgs (WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint, WebPartConnection connection) { }
public void SetIsShared(WebPartConnection connection, bool isShared) { Contract.Requires(connection != null); }
public void SetIsShared(WebPartConnection connection, bool isShared) { }
public void SetIsStatic(WebPartConnection connection, bool isStatic) { Contract.Requires(connection != null); }
public void SetTransformer(WebPartConnection connection, WebPartTransformer transformer) { Contract.Requires(connection != null); Contract.Ensures(((System.Array)connection.Transformers).Length >= 0); }
public bool ConnectionDeleted(WebPartConnection connection) { Contract.Requires(connection != null); return(default(bool)); }
public void Remove(WebPartConnection value) { List.Remove(value); }
public void DeleteConnection(WebPartConnection connection) { Contract.Requires(connection != null); }
public bool Contains(WebPartConnection value) { return(List.Contains(value)); }
public bool ConnectionDeleted(WebPartConnection connection) { return connection.Deleted; }
public void Insert(int index, WebPartConnection value) { List.Insert(index, value); }
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); } } }
private void RenderExistingProviderConnection(HtmlTextWriter writer, WebPartConnection connection) { WebPart webPartToConnect = this.WebPartToConnect; ConsumerConnectionPoint consumerConnectionPoint = base.WebPartManager.GetConsumerConnectionPoint(webPartToConnect, connection.ConsumerConnectionPointID); WebPart provider = connection.Provider; ProviderConnectionPoint providerConnectionPoint = connection.ProviderConnectionPoint; string partTitle = this.GetDisplayTitle(provider, providerConnectionPoint, false); string editEventArg = null; WebPartTransformer transformer = connection.Transformer; if ((transformer != null) && this.HasConfigurationControl(transformer)) { editEventArg = "edit" + '$'.ToString(CultureInfo.InvariantCulture) + connection.ID; } bool isActive = (((providerConnectionPoint != null) && (consumerConnectionPoint != null)) && ((connection.Provider != null) && (connection.Consumer != null))) && connection.IsActive; char ch2 = '$'; this.RenderExistingConnection(writer, (consumerConnectionPoint != null) ? consumerConnectionPoint.DisplayName : System.Web.SR.GetString("Part_Unknown"), partTitle, string.Join(ch2.ToString(CultureInfo.InvariantCulture), new string[] { "disconnect", connection.ID }), editEventArg, false, isActive); }
private bool ShouldRemoveConnection(WebPartConnection connection) { if (connection.IsShared && (this.Personalization.Scope == PersonalizationScope.User)) { return false; } return true; }
private void ConnectionsToActivateHelper(WebPartConnection connection, IDictionary connectionIDs, ArrayList connectionsToActivate) { string iD = connection.ID; if (string.IsNullOrEmpty(iD)) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartConnection_NoID")); } if (connectionIDs.Contains(iD)) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_DuplicateConnectionID", new object[] { iD })); } connectionIDs.Add(iD, null); if (!connection.Deleted) { WebPart provider = connection.Provider; if (provider == null) { if (connection.IsStatic) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartConnection_NoProvider", new object[] { connection.ProviderID })); } this.DisconnectWebParts(connection); } else { WebPart consumer = connection.Consumer; if (consumer == null) { if (connection.IsStatic) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartConnection_NoConsumer", new object[] { connection.ConsumerID })); } this.DisconnectWebParts(connection); } else if (!(provider is ProxyWebPart) && !(consumer is ProxyWebPart)) { Control control = provider.ToControl(); Control control2 = consumer.ToControl(); if (control == control2) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_CantConnectToSelf")); } if (connection.ProviderConnectionPoint == null) { consumer.SetConnectErrorMessage(System.Web.SR.GetString("WebPartConnection_NoProviderConnectionPoint", new object[] { connection.ProviderConnectionPointID, provider.DisplayTitle })); } else if (connection.ConsumerConnectionPoint == null) { consumer.SetConnectErrorMessage(System.Web.SR.GetString("WebPartConnection_NoConsumerConnectionPoint", new object[] { connection.ConsumerConnectionPointID, consumer.DisplayTitle })); } else { connectionsToActivate.Add(connection); } } } } }
internal bool ConflictsWith(WebPartConnection otherConnection) { return(ConflictsWithConsumer(otherConnection) || ConflictsWithProvider(otherConnection)); }