void page_GetConnectionAttributes(object sender, ConnectionsEventArgs args) { Debug.Assert(this.Connections != null, "Connections is not valid!"); this.ClearErrors(); try { args.ConnectionManagers.Clear(); foreach (ConnectionManager cm in this.Connections) { if (cm.InnerObject is SsdsConnectionManager) { ConnectionManagerElement element = new ConnectionManagerElement(); element.ID = cm.ID; element.Name = cm.Name; element.Selected = element.ID.Equals(this.ComponentMetadata.RuntimeConnectionCollection[0].ConnectionManagerID, StringComparison.OrdinalIgnoreCase); args.ConnectionManagers.Add(element); } } } catch (Exception ex) { this.ReportErrors(ex); } }
private void LoadConnections() { if (this.GetConnectionAttributes != null) { ConnectionsEventArgs args = new ConnectionsEventArgs(); this.GetConnectionAttributes(this, args); this.cmbCM.Items.Clear(); bool selected = false; foreach (ConnectionManagerElement element in args.ConnectionManagers) { this.cmbCM.Items.Add(element); if (element.Selected) { selected = true; this.cmbCM.SelectedIndex = args.ConnectionManagers.IndexOf(element); } } if (args.ConnectionManagers.Count > 0 && !selected) { this.cmbCM.SelectedIndex = 0; } this.LoadContainers((ConnectionManagerElement)this.cmbCM.SelectedItem); } }