/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Form.Load"/> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data.</param> protected override void OnLoad(EventArgs e) { FdoConnectionManager connMgr = ServiceManager.Instance.GetService <FdoConnectionManager>(); lstConnections.DataSource = new List <string>(connMgr.GetConnectionNames()); base.OnLoad(e); }
public static void Initialize() { FdoConnectionManager manager = ServiceManager.Instance.GetService <FdoConnectionManager>(); NamingService namer = ServiceManager.Instance.GetService <NamingService>(); manager.ConnectionAdded += delegate(object sender, EventArgs <string> e) { LoggingService.InfoFormatted("Connection added: {0}", e.Data); }; manager.ConnectionRemoved += delegate(object sender, EventArgs <string> e) { LoggingService.InfoFormatted("Connection removed: {0}", e.Data); if (manager.GetConnectionNames().Count == 0) { namer.ResetCounter(); } }; manager.ConnectionRenamed += delegate(object sender, ConnectionRenameEventArgs e) { LoggingService.InfoFormatted("Connection {0} renamed to {1}", e.OldName, e.NewName); }; manager.ConnectionRefreshed += delegate(object sender, EventArgs <string> e) { LoggingService.InfoFormatted("Connection {0} refreshed", e.Data); }; }
private void PopulateConnections() { foreach (string name in _connMgr.GetConnectionNames()) { string connName = name; //Can't bind to iter variable var item = btnAddConnection.DropDown.Items.Add(connName, null, delegate(object sender, EventArgs e) { if (!ConnectionAdded(connName)) { AddParticipatingConnection(connName); } else { MessageService.ShowMessage("Connection " + connName + " already added"); } }); item.Name = name; } }