private void btnAddTrackerGroup_Click(object sender, EventArgs e) { InputBox ib = new InputBox(); ib.Text = "Enter group name"; ib.InputText = "Linux ISOs"; if (ib.ShowDialog() == DialogResult.OK) { TrackerGroup tg = new TrackerGroup(ib.InputText); Tracker t = new Tracker("Ubuntu", "http://torrent.ubuntu.com:6969"); tg.Trackers.Add(t); Program.Settings.TrackerGroups.Add(tg); lbTrackerGroups.Items.Add(tg); lbTrackerGroups.SelectedIndex = lbTrackerGroups.Items.Count - 1; btnRefreshTrackers_Click(sender, e); } }
private void BtnAddTrackerClick(object sender, EventArgs e) { if (lbTrackerGroups.SelectedIndex > -1) { TrackerGroup tg = lbTrackerGroups.Items[lbTrackerGroups.SelectedIndex] as TrackerGroup; if (tg != null) { Tracker t = new Tracker("Ubuntu", "http://torrent.ubuntu.com:6969"); tg.Trackers.Add(t); lbTrackers.Items.Add(t); lbTrackers.SelectedIndex = lbTrackers.Items.Count - 1; } } }