Ejemplo n.º 1
0
        private void Train_Click(object sender, RoutedEventArgs e)
        {
            int      i;
            winTrain myTrain = new winTrain(listData_train);

            myTrain.Owner = this;
            myTrain.ShowDialog();
            if (bool.Parse(listData_train[6].ToString()) == true)
            {
                train_len         = int.Parse(listData_train[0].ToString());
                v_max             = int.Parse(listData_train[1].ToString());
                t_int             = int.Parse(listData_train[2].ToString());
                train_num         = int.Parse(listData_train[3].ToString());
                acc_a             = int.Parse(listData_train[4].ToString());
                acc_b             = int.Parse(listData_train[5].ToString());
                standard_time     = Standard_Time();
                txtTrain.Text    += "添加列车信息:\n";
                txtTrain.Text    += "列车长度:" + train_len;
                txtTrain.Text    += "\n最高时速:" + v_max;
                txtTrain.Text    += "\n发车间隔:" + t_int;
                txtTrain.Text    += "\n列车数量:" + train_num;
                txtTrain.Text    += "\n加速度:" + acc_a;
                txtTrain.Text    += "\n减速度:" + acc_b;
                txtTrain.Text    += "\n----------------------------\n";
                listData_train[6] = false;
                for (i = 0 + add_count; i < train_num + add_count; i++)
                {
                    train[i].train_len     = train_len;
                    train[i].V_max         = v_max;
                    train[i].T_int         = t_int;
                    train[i].a             = acc_a;
                    train[i].b             = acc_b;
                    train[i].c             = 0;
                    train[i].x             = 0;
                    train[i].v             = 0;
                    train[i].pause         = 0;
                    train[i].standard_time = standard_time;
                    train[i].gap           = station_site;
                    train[i].start_time    = 0;
                    train[i].spacetime     = new ArrayList();
                }
                add_count += train_num;
            }
        }
Ejemplo n.º 2
0
 private void Train_Click(object sender, RoutedEventArgs e)
 {
     int i;
     winTrain myTrain = new winTrain(listData_train);
     myTrain.Owner = this;
     myTrain.ShowDialog();
     if (bool.Parse(listData_train[6].ToString()) == true)
     {
         train_len = int.Parse(listData_train[0].ToString());
         v_max = int.Parse(listData_train[1].ToString());
         t_int = int.Parse(listData_train[2].ToString());
         train_num = int.Parse(listData_train[3].ToString());
         acc_a = int.Parse(listData_train[4].ToString());
         acc_b = int.Parse(listData_train[5].ToString());
         standard_time = Standard_Time();
         txtTrain.Text += "添加列车信息:\n";
         txtTrain.Text += "列车长度:" + train_len;
         txtTrain.Text += "\n最高时速:" + v_max;
         txtTrain.Text += "\n发车间隔:" + t_int;
         txtTrain.Text += "\n列车数量:" + train_num;
         txtTrain.Text += "\n加速度:" + acc_a;
         txtTrain.Text += "\n减速度:" + acc_b;
         txtTrain.Text += "\n----------------------------\n";
         listData_train[6] = false;
         for (i = 0 + add_count; i < train_num + add_count; i++)
         {
             train[i].train_len = train_len;
             train[i].V_max = v_max;
             train[i].T_int = t_int;
             train[i].a = acc_a;
             train[i].b = acc_b;
             train[i].c = 0;
             train[i].x = 0;
             train[i].v = 0;
             train[i].pause = 0;
             train[i].standard_time = standard_time;
             train[i].gap = station_site;
             train[i].start_time = 0;
             train[i].spacetime = new ArrayList();
         }
         add_count += train_num;
     }
 }