Example #1
0
        public MapDirectionStep GetShortestLocation(DirectionType direction)
        {
            var result = new MapDirectionStep();

            switch (direction)
            {
            case DirectionType.Distantance:
                result = Steps.ShortestDistance()
                         .FirstOrDefault();
                break;

            case DirectionType.Duration:
                result = Steps.ShortestDuration()
                         .FirstOrDefault();
                break;

            case DirectionType.DistanceAndDuration:
                result = Steps.ShortestDistance()
                         .ShortestDuration()
                         .FirstOrDefault();
                break;

            default:
                result = null;
                break;
            }

            return(result);
        }
Example #2
0
        public void AddDirectionStep(Direction direction, string instructions, string travelMode)
        {
            var existingDirectionStep = Steps.Where(x => x.Direction.Equals(direction)).FirstOrDefault();

            if (existingDirectionStep == null)
            {
                var directionStep = new MapDirectionStep(direction, instructions, travelMode);
                Steps.Add(directionStep);
            }
        }