private void CalculateProximityStatus(ProximityRangeEnum previousProximityRange) { if (ProximityRange != previousProximityRange && previousProximityRange != ProximityRangeEnum.Unknown && ProximityRange != ProximityRangeEnum.Unknown) { if (previousProximityRange == ProximityRangeEnum.Far) { ProximityStatus = ProximityStatusEnum.GettingCloser; } else if (previousProximityRange == ProximityRangeEnum.Near) { if (ProximityRange == ProximityRangeEnum.Far) { ProximityStatus = ProximityStatusEnum.GettingFurther; } else if (ProximityRange == ProximityRangeEnum.Immediate) { ProximityStatus = ProximityStatusEnum.GettingCloser; } } else if (previousProximityRange == ProximityRangeEnum.Immediate) { ProximityStatus = ProximityStatusEnum.GettingFurther; } } else { ProximityStatus = ProximityStatusEnum.NotMoving; } }
private void CalculateProximityRange() { ProximityRangeEnum previousProximityRange = ProximityRange; if (Distance <= AppConfig.ZeroDistance) { ProximityRange = ProximityRangeEnum.Unknown; } else if (Distance > AppConfig.ZeroDistance && Distance < AppConfig.ImmediateDistance) { ProximityRange = ProximityRangeEnum.Immediate; } else if (Distance >= AppConfig.ImmediateDistance && Distance < AppConfig.NearDistance) { ProximityRange = ProximityRangeEnum.Near; } else { ProximityRange = ProximityRangeEnum.Far; } CalculateProximityStatus(previousProximityRange); }