Esempio n. 1
0
        public async Task GetPins()
        {
            IsBusy = true;

            //Setting the current location
            var locator  = CrossGeolocator.Current;
            var position = await locator.GetPositionAsync(new TimeSpan(0, 0, 10));

            var map = (Xamarin.Forms.Maps.Map) this.View.FindByName("map");

            map.MoveToRegion(Xamarin.Forms.Maps.MapSpan.FromCenterAndRadius(new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude), Xamarin.Forms.Maps.Distance.FromKilometers(1)));

            //Setting the zoom on current position
            var zoomLevel      = 14; //Level between 1 and 18
            var latlongdegress = 360 / (Math.Pow(2, zoomLevel));

            map.MoveToRegion(new Xamarin.Forms.Maps.MapSpan(map.VisibleRegion.Center, latlongdegress, latlongdegress));

            for (int i = 0; i < 8; i++)
            {
                map.Pins.Add(new Pin()
                {
                    Address  = $"Pin {i}",
                    Label    = $"Buteko {i}",
                    Position = RandomPosition.Next(new Position(position.Latitude, position.Longitude), 0.001, 0.001),
                    Type     = PinType.Place
                });
            }

            await Task.Delay(500);

            IsBusy = false;
        }
Esempio n. 2
0
 public Location GetNewLocation()
 {
     _pinCreatedCount++;
     return(new Location(
                $"Pin {_pinCreatedCount}",
                $"Desc {_pinCreatedCount}",
                RandomPosition.Next(new Position(-33.933329, 18.6333308), 4, 10)));
 }
            Place NewPlace()
            {
                ++_pinCreatedCount;

                return(new Place(
                           $"Pin {_pinCreatedCount}",
                           $"Desc {_pinCreatedCount}",
                           RandomPosition.Next(startPosition, 8, 19)));
            }
        public void ShouldPickRandomNextValue()
        {
            var values = _fixture.CreateMany <(char, int)>().ToArray();

            _random.Setup(x => x.Next(0, values.Length))
            .Returns(2);

            _randomPosition.Next(values)
            .Should().Be(values[2]);
        }
Esempio n. 5
0
        Place NewPlace()
        {
            var rand = new Random(Environment.TickCount);

            ++_pinCreatedCount;

            return(new Place(
                       $"Pin {_pinCreatedCount}",
                       $"Desc {_pinCreatedCount}",
                       RandomPosition.Next(PinItemsSourcePage.startPosition, 8, 19),
                       rand.Next(0, 4)));
        }