private void SetLidar(Lidar lidar) { if (_selectedLidar != lidar) { if (_selectedLidar != null) { _selectedLidar.NewMeasure -= lidar_NewMeasure; if (_selectedLidar == AllDevices.LidarGround) { _selectedLidar.StopLoopMeasure(); } } _selectedLidar = lidar; if (_selectedLidar != null) { _selectedLidar.NewMeasure += lidar_NewMeasure; if (_selectedLidar == AllDevices.LidarGround) { _selectedLidar.StartLoopMeasure(); } } _measureObjects = null; _measureBoard = null; picWorld.Invalidate(); } }