private void QueryData(List<Car> list, Action<Exception> ready)
{
FirstTime = Start.ToString("dd.MM.yyyy") + " " + StartTime.ToString("HH:mm:ss");
LastTime = End.ToString("dd.MM.yyyy") + " " + EndTime.ToString("HH:mm:ss");
Task.Factory
.StartNew(() => ReadNext(list))
.ContinueWith(t => ready(t.Exception));
}
private void ReadNext(List<Car> list)
{
for (var i = 0; i < list.Count; i++)
{
var car = list[i];
car.Reset();
Graph.WaitForComputing(car.GroupName, car.CarDevice, FirstTime, LastTime, Gsm, 1);
car.OnEndComputing(Graph);
SetProgress(i, list.Count);
}
_exporter.Export(list);
}
public void OnEndComputing(IAutoGRAPHAutomation graph)
{
var tripsNum = graph.TripsNum;// <-- всегда однинаковые данные
for (var tripIndex = 1; tripIndex <= tripsNum; tripIndex++)
{
graph.TripIndex = tripIndex;
var item = new Trip();
AddTrip(item);
item.TripIndex = tripIndex;
item.TripDriverName = graph.TripDriverName;
item.TripDriverId = graph.TripDriverID;
item.TripStartRealTime = graph.TripStartRealTime;
item.CarDevice = graph.CarDevice;
}
} |