示例#1
0
 private void buttonCalculate_Click(object sender, EventArgs e)
 {
     listBoxFast.Items.Clear();
     listBoxCheap.Items.Clear();
     if ((int)comboBoxStart.SelectedItem == (int)comboBoxFinish.SelectedItem)
     {
         listBoxFast.Items.Add("Start add finish are equivalent");
         listBoxCheap.Items.Add("Start add finish are equivalent");
     }
     else if (busNet.FindRoutes((int)comboBoxStart.SelectedItem, (int)comboBoxFinish.SelectedItem, startTimePicker.Value))
     {
         listBoxFast.Items.AddRange(busNet.FastRoute.ToArray());
         listBoxCheap.Items.AddRange(busNet.CheapRoute.ToArray());
         listBoxFast.Items.Add("Cost: " + busNet.FastRoute.Last().Cost);
         listBoxFast.Items.Add("Time: " + TimeConverter.IntToTime(busNet.FastRoute.Last().Time).ToShortTimeString());
         listBoxCheap.Items.Add("Cost: " + busNet.CheapRoute.Last().Cost);
         listBoxCheap.Items.Add("Time: " + TimeConverter.IntToTime(busNet.CheapRoute.Last().Time).ToShortTimeString());
     }
     else
     {
         listBoxFast.Items.Add("Route not exist");
         listBoxCheap.Items.Add("Route not exist");
     }
 }
示例#2
0
 public override String ToString()
 {
     return(point.ToString() + ((bus >= 0) ? "\t" + (bus + 1).ToString() : "\t") +
            "\t" + TimeConverter.IntToTime(time).ToShortTimeString() +
            ((startTime >= 0) ? ("\t" + TimeConverter.IntToTime(startTime).ToShortTimeString()) : ""));
 }