public GetAverageSpeedForm(TrainNet _trainNet) : this() { this._trainNet = _trainNet; var some = Enum.GetValues(typeof(TrainKind)); comboBox1.DataSource = some; //comboBox1.SelectedItem = TrainKind.Express; }
public GetTrainsForm(TrainNet trainNet, List <string> sStation = null, List <string> eStation = null) : this() { _trainNet = trainNet; //if sStation and eStation are not passed initialize them to empty List<string> sStation = sStation ?? new List <string>(); eStation = eStation ?? new List <string>(); textBox1.AutoCompleteCustomSource.AddRange(sStation.ToArray()); textBox2.AutoCompleteCustomSource.AddRange(eStation.ToArray()); }
private void UpdateDatabase() { _trainContext = new TrainContext(); List <KindTrain> trains = new List <KindTrain>(); trains = _trainContext.KindTrains.ToList() .Select(t => new KindTrain(t.Id, t.TrainKind, t.ArrivalTime.ToUniversalTime().ToLocalTime(), t.Stops.ToDictionary(c => c.Station, c => c.ArrivalTime), t.FirstStation, t.LastStation, t.DepartureTime.ToUniversalTime().ToLocalTime(), t.Distance)) .ToList(); _trainNet = new TrainNet(trains); }
private void Form1_Load(object sender, EventArgs e) { _trainContext = new TrainContext(); List <KindTrain> trains = new List <KindTrain>(); trains = _trainContext.KindTrains.ToList() .Select(t => new KindTrain(t.Id, t.TrainKind, t.ArrivalTime.ToUniversalTime().ToLocalTime(), t.Stops.ToDictionary(c => c.Station, c => c.ArrivalTime), t.FirstStation, t.LastStation, t.DepartureTime.ToUniversalTime().ToLocalTime(), t.Distance)) .ToList(); _trainNet = new TrainNet(trains); }