コード例 #1
0
        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            SwissTransport.Transport connection = new SwissTransport.Transport();
            var connect = connection.GetConnections(textBox1.Text, textBox2.Text);

            foreach (var conn in connect.ConnectionList)
            {
                abfahrtsstation.Visible = true;
                abfahrtszeit.Visible    = true;
                abfahrtszone.Visible    = true;
                ankunftsstation.Visible = true;
                ankunftszeit.Visible    = true;
                ankunftszone.Visible    = true;
                verspaetung.Visible     = true;
                DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone();
                row.Cells[0].Value = textBox1.Text;
                row.Cells[1].Value = DateTime.Parse(conn.From.Departure).ToString("HH:mm");
                row.Cells[1].Value = row.Cells[1].Value + " h";
                row.Cells[2].Value = conn.From.Platform;
                row.Cells[3].Value = textBox2.Text;
                row.Cells[4].Value = DateTime.Parse(conn.To.Arrival).ToString("HH:mm");
                row.Cells[4].Value = row.Cells[4].Value + " h";
                row.Cells[5].Value = conn.To.Platform;
                row.Cells[6].Value = conn.To.Delay;
                dataGridView1.Rows.Add(row);
            }

            // List<Connections> connections = transport.GetConnections(textBox1.Text, textBox2.Text).fromStation;
            //foreach (Connections connection in connections)
            //{
            //  listBox3.Items.Add(connection.Name);
            //}
        }
コード例 #2
0
        //Bereitet die Form während des ladens vor
        private void FormMain_Load(object sender, EventArgs e)
        {
            SwissTransport.Transport transport = new SwissTransport.Transport();

            //Macht aus dem DateTimePicker eine TimePicker
            dtpttTime.Format       = DateTimePickerFormat.Custom;
            dtpttTime.CustomFormat = "HH:mm";
            dtpttTime.ShowUpDown   = true;

            dtpdbTime.Format       = DateTimePickerFormat.Custom;
            dtpdbTime.CustomFormat = "HH:mm";
            dtpdbTime.ShowUpDown   = true;

            //Setzt den Cursor in das erste Steuerelement
            cmbttFrom.Select();
        }