Exemplo n.º 1
0
 private void lbBuses_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lbBuses.SelectedIndex != -1)
     {
         btnRemoveBus.Enabled = true;
         btnAddLine.Enabled   = true;
         lbLines.Items.Clear();
         Buses bus = busLines.ElementAt(lbBuses.SelectedIndex);
         loadLines(bus);
         if (lbLines.Items.Count == 0)
         {
             tbMostExpensiveLine.Text = "Нема линии за овој автобус!";
             tbAveragePerLine.Text    = "Нема линии за овој автобус!";
         }
         else
         {
             tbAveragePerLine.Text    = bus.averagePriceOfLines().ToString();
             tbMostExpensiveLine.Text = bus.mostExpensiveLine().ToString();
         }
     }
     else
     {
         btnRemoveBus.Enabled = false;
     }
 }
Exemplo n.º 2
0
 private void loadLines(Buses bus)
 {
     lbLines.Items.Clear();
     foreach (Lines l in bus.listLines)
     {
         lbLines.Items.Add(l);
     }
 }
Exemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            AddLine form = new AddLine();

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Buses bus = busLines.ElementAt(lbBuses.SelectedIndex);
                bus.addLine(form.line);
                loadLines(bus);
                AverageAndMostExpensiveRoutes(bus);
            }
        }
Exemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Buses a = new Buses("Transkop", "OH213BT", true);

            a.addLine(new Lines("4:20", "Jamaica", 500));
            Buses b = new Buses("Galeb", "OH111VG", false);

            b.addLine(new Lines("15:20", "Bitola", 150));
            busLines.Add(a);
            busLines.Add(b);

            btnRemoveBus.Enabled = false;

            loadBuses();
        }
Exemplo n.º 5
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     bus          = new Buses(tbName.Text, tbDestination.Text, cbLocal.Checked);
     DialogResult = System.Windows.Forms.DialogResult.OK;
     MessageBox.Show("Автобусот е успешно додаден.", "Успех!", MessageBoxButtons.OK);
 }
Exemplo n.º 6
0
 private void AverageAndMostExpensiveRoutes(Buses bus)
 {
     tbAveragePerLine.Text    = bus.averagePriceOfLines().ToString();
     tbMostExpensiveLine.Text = bus.mostExpensiveLine().ToString();
 }
Exemplo n.º 7
0
 internal void addAndLoad(Buses bus)
 {
     busLines.Add(bus);
     loadBuses();
 }