private async void Lidar_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(Lidar.RunCollector) when Lidar.RunCollector == false: CalculateHorizontalPoints = false; break; case nameof(Lidar.RaiseNotificationForSelective) when Lidar.RaiseNotificationForSelective == false: AutoCalculateDirections = false; AutoCalculateLargestDistance = false; break; } if (e.PropertyName != nameof(Lidar.LastUpdate)) { return; } if (AutoCalculateDirections) { Task.Run(() => { float fwd = Lidar.Fwd; float left = Lidar.Left; float right = Lidar.Right; }); } if (AutoCalculateLargestDistance) { HorizontalPoint point = Lidar.LargestDistance; } if (CalculateHorizontalPoints) { float fromAngle = CenterForAnglesInRange - BeamOpeningForAnglesInRange / 2; float toAngle = CenterForAnglesInRange + BeamOpeningForAnglesInRange / 2; if (fromAngle < 0) { fromAngle += 360; } if (toAngle > 360) { fromAngle -= 360; } SelectedAngleRange = $"From {fromAngle} to {toAngle}"; HorizontalPointsInRange = await Task.Run(() => Lidar.GetHorizontalPointsInRange(fromAngle, toAngle, Lidar.Config.DefaultVerticalAngle)); } }