public TimeAdjustmentWindow(TimeSpan defaultTimeShift, RouteStationViewModel station, List <RouteBeginTime> beginTimes, IEnumerable <TimeAdjustmentViewModel> timeAdjustments) { TimeAdjustments = new ObservableCollection <TimeAdjustmentViewModel>(); Times = new List <RouteBeginTime>(); foreach (var beginTime in beginTimes) { var timeForStation = new RouteBeginTime(beginTime); timeForStation.Time += defaultTimeShift; var adjustments = timeAdjustments.Where(item => item.RouteBeginTime.Id == beginTime.Id); if (adjustments.Count() > 0) { foreach (var adj in adjustments) { timeForStation.Time += adj.TimeAdjustment; } } Times.Add(timeForStation); } _station = station; InitializeComponent(); DataContext = this; }
public TimeAdjustmentViewModel(RouteBeginTime time, TimeSpan timeAdjustment, int stationId) { this.RouteBeginTime = time; this.TimeAdjustment = timeAdjustment; this.StationId = stationId; }