private void registerEvent() { event_id = this.Name + Num; vh.addEventHandler(event_id , nameof(vh.isTcpIpConnect) , (s1, e1) => { updateVehicleModeStatus(); updateVehicleActionStatus(); Adapter.Invoke((obj) => { pic_VhStatus.Refresh(); }, null); }); vh.addEventHandler(event_id , nameof(vh.VhPositionChangeEvent) , (s1, e1) => { updateVehiclePosition(); }); vh.addEventHandler(event_id , nameof(vh.VhStatusChangeEvent) , (s1, e1) => { updateVehicleModeStatus(); updateVehicleActionStatus(); Adapter.Invoke((obj) => { pic_VhStatus.Refresh(); }, null); }); //vh.addEventHandler(event_id // , nameof(vh.procProgress_Percen) // , (s1, e1) => { updateVhCurrentProcProgress(); }); }
public void setMonitorVehicle(string vh_id) { lock (predictPathHandler) { if (InObservationVh != null) { InObservationVh.removeEventHandler(predictPathHandler); } resetSpecifyRail(); resetSpecifyAdr(); if (!BCFUtility.isEmpty(vh_id)) { InObservationVh = scApp.getEQObjCacheManager().getVehicletByVHID(vh_id); changePredictPathByInObservation(); InObservationVh.addEventHandler(predictPathHandler , BCFUtility.getPropertyName(() => InObservationVh.VhExcuteCMDStatusChangeEvent) , (s1, e1) => { changePredictPathByInObservation(); }); InObservationVh.addEventHandler(predictPathHandler , BCFUtility.getPropertyName(() => InObservationVh.VhStatusChangeEvent) , (s1, e1) => { changePredictPathByInObservation(); }); cmb_Vehicle.Text = vh_id; VehicleObjToShow veicleObjShow = scApp.getEQObjCacheManager().CommonInfo.ObjectToShow_list.Where(o => o.VEHICLE_ID == vh_id).FirstOrDefault(); if (veicleObjShow != null) { int selectIndex = scApp.getEQObjCacheManager().CommonInfo.ObjectToShow_list.IndexOf(veicleObjShow); if (selectIndex >= 0) { if ((dgv_vhStatus.SelectedRows.Count > 0 && dgv_vhStatus.SelectedRows[0].Index != selectIndex) || dgv_vhStatus.SelectedRows.Count == 0) { dgv_vhStatus.Rows[selectIndex].Selected = true; dgv_vhStatus.FirstDisplayedScrollingRowIndex = selectIndex; } } } } else { if (dgv_vhStatus.SelectedRows.Count > 0) { dgv_vhStatus.SelectedRows[0].Selected = false; } cmb_Vehicle.Text = string.Empty; } } }
private void registerEvent() { event_id = this.Name + m_iNum; eqpt.addEventHandler(event_id , BCFUtility.getPropertyName(() => eqpt.isTcpIpConnect) , (s1, e1) => { changeVehicleStatus(); }); eqpt.addEventHandler(event_id , BCFUtility.getPropertyName(() => eqpt.VhPositionChangeEvent) , (s1, e1) => { moveVehiclePosition(); }); //eqpt.addEventHandler(event_id // , BCFUtility.getPropertyName(() => eqpt.PredictPath) // , (s1, e1) => { setPredictPath(); }); eqpt.addEventHandler(event_id , BCFUtility.getPropertyName(() => eqpt.VhStatusChangeEvent) , (s1, e1) => { changeVehicleStatus(); }); eqpt.addEventHandler(event_id , BCFUtility.getPropertyName(() => eqpt.procProgress_Percen) , (s1, e1) => { updateVhCurrentProcProgress(); }); }
public void setMonitorVehicle(object obj, string vh_id) { try { lock (predictPathHandler) { if (InObservationVh != null) { InObservationVh.removeEventHandler(predictPathHandler); } resetSpecifyRail(); resetSpecifyAdr(); if (!BCFUtility.isEmpty(vh_id)) { InObservationVh = app.ObjCacheManager.GetVEHICLE(vh_id); changePredictPathByInObservation(); InObservationVh.addEventHandler(predictPathHandler , BCFUtility.getPropertyName(() => InObservationVh.VhExcuteCMDStatusChangeEvent) , (s1, e1) => { changePredictPathByInObservation(); }); InObservationVh.addEventHandler(predictPathHandler , BCFUtility.getPropertyName(() => InObservationVh.VhStatusChangeEvent) , (s1, e1) => { changePredictPathByInObservation(); }); IndicateVhInfoFromDgv(vh_id); } //else //{ // if (dgv_vehilce_status.SelectedRows.Count > 0) // dgv_vehilce_status.SelectedRows[0].Selected = false; //} } } catch (Exception ex) { logger.Error(ex, "Exception"); } }