private void btnAddLine_Click(object sender, EventArgs e) { AddLines addLine = new AddLines(); addLine.Show(); if (addLine.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Bus newBus = lbBusses.SelectedItem as Bus; newBus.AddLine(addLine.NewLine); loadLines(); } }
{ /* ** author: Damjan Miloshevski ** contact: [email protected]; ** skype: damjan.milosevski ** phone: +38978566409; ** web: https://www.facebook.com/damjan.miloshevski ** http://miloshevski.us.to/ */ public Busses() { InitializeComponent(); Bus b = new Bus("ЈСП 50", "4432", true); Bus k = new Bus("ЈСП 22", "1132", true); Bus m = new Bus("Пролетер", "1123", false); Bus f = new Bus("Јоцо Турс", "5598", false); Bus g = new Bus("Руле Турс", "7785", false); Bus c = new Bus("Алпар Туризам, Domino Line", "8865", false); Bus y = new Bus("Ниш Експрес", "3250", false); Line l = new Line("Битпазар", 12, 33, 35); Line z = new Line("Хотел Карпош", 7, 25, 35); Line i = new Line("Истанбул", 17, 30, 3580); Line a = new Line("Бурса", 23, 30, 6690); Line x = new Line("Белград", 6, 30, 2400); Line q = new Line("Крива Паланка", 16, 0, 350); Line p = new Line("Крива Паланка", 16, 30, 400); Line v = new Line("Крива Паланка", 17, 0, 320); Line o = new Line("Куманово", 16, 30, 170); Line n = new Line("Куманово", 17, 0, 120); b.AddLine(l); c.AddLine(i); c.AddLine(a); y.AddLine(x); k.AddLine(z); m.AddLine(q); f.AddLine(o); f.AddLine(p); g.AddLine(n); g.AddLine(v); lstBusses.Items.Add(b); lstBusses.Items.Add(k); lstBusses.Items.Add(m); lstBusses.Items.Add(f); lstBusses.Items.Add(g); lstBusses.Items.Add(c); lstBusses.Items.Add(y); }
private void btnAddLine_Click(object sender, EventArgs e) { if (btnAddLine.Enabled) { NewLine nl = new NewLine(); DialogResult response = nl.ShowDialog(); if (lstBusses.SelectedIndex != -1) { Bus b = lstBusses.SelectedItem as Bus; if (response == DialogResult.OK) { b.AddLine(nl.Line); loadLines(); } } } }