private void btnDodajStanicu_Click(object sender, EventArgs e) { int poz; if (int.TryParse(txtDodajStanicu.Text, out poz)) { if (poz < 0 || poz > route.Stations.Count) { return; } } else { return; } ChoseStation ss = new ChoseStation(route); ss.ShowDialog(); if (ss.station != null) { route = RouteModel.Rout(route.Id, ss.station.Id, poz); listBox1.Items.Clear(); listBox1.Items.AddRange(route.Stations.ToArray()); } }
private void button1_Click(object sender, EventArgs e) { ChoseStation st = new ChoseStation(); st.ShowDialog(); if (st.station != null) { listBox1.Items.Add(st.station); } }