ThreadPool.QueueUserWorkItem(_ =>
{
this.Invoke((MethodInvoker)(() =>
{
try
{
lock (m_objLock5)
{
if (EVIs.Count != Evss.Count) return; //出現異常,返回不提取
foreach (EntityVehicleInfo evi in EVIs)
{
int mcuid = evi.MCUID;
/////////////////////////添加地理位置信息
EntityVehicleInfo vehicleInfo = null;
vehicleInfo = DataReader.Instance.HtVehicleInfo[mcuid]asEntityVehicleInfo;
if (vehicleInfo == null) return;
int Add_InfoIndex = dgvVehicleInfo.Rows.Add(1);
DataGridViewRow row = dgvVehicleInfo.Rows[Add_InfoIndex];
dituHelper.GetAddressByGPS(vehicleInfo.Longitude, vehicleInfo.Latitude, Add_InfoIndex);
row.Cells["VehicleInfoMCUID"].Value = vehicleInfo.MCUID;
row.Cells["VEHICLENO"].Value = vehicleInfo.VehicleNo;
row.Cells["ONLINE"].Value = vehicleInfo.Online;
row.Cells["ACC"].Value = vehicleInfo.ACC;
//row.Cells["LONGITUDE"].Value = vehicleInfo.Longitude.ToString("f5");
//row.Cells["LATITUDE"].Value = vehicleInfo.Latitude.ToString("f5");
row.Cells["ANGLE"].Value =UtilityHelper.Angle2Direction((int)vehicleInfo.Angle);
row.Cells["VELOCITY"].Value = vehicleInfo.Velocity;
row.Cells["LOCATIONSTATE"].Value = vehicleInfo.LocationState;
row.Cells["RECEIVETIME"].Value = vehicleInfo.ReceiveTime;
////////////////////////////添加狀態信息
EntityVehicleState vehicleState = null;
vehicleState = DataReader.Instance.HtVehicleState[mcuid]asEntityVehicleState;
if (vehicleState == null) return;
int Add_StateIndex = dgvVehicleState.Rows.Add(1);
DataGridViewRow row2 = dgvVehicleState.Rows[Add_StateIndex];
row2.Cells["VEHICLENOS"].Value = vehicleInfo.VehicleNo.ToString();
vehicleInfo = null;
row2.Cells["PositionTime"].Value = vehicleState.PositionTime.ToString();
row2.Cells["STOPFUEL"].Value = vehicleState.StopFuel ?"是" : "否";
row2.Cells["FUELCUT"].Value = vehicleState.FuelCut ? "斷油電" : "通油電";
row2.Cells["AUTODEFENCE"].Value = vehicleState.AutoFence ?"設防" : "解防";
row2.Cells["TRUNKBOOT"].Value = vehicleState.TrunkBoot ?"開啟" : "關閉";
row2.Cells["BRAKING"].Value = vehicleState.Braking ? "剎車踩下" : "剎車松開";
row2.Cells["DOOROPEN"].Value = vehicleState.DoorOpen ? "打開" : "關閉";
row2.Cells["ACCON"].Value = vehicleState.ACCOn ? "點火" :"熄火";
row2.Cells["POWERSAVER"].Value = vehicleState.PowerSaver ?"是" : "否";
vehicleState = null;
}
}
}
catch (Exception ex)
{
LogHelper.Writeln("Instance_NotifyInfo " + ex.StackTrace);
}
}));
});
效果如下: