private async void ExecuteCommand()
        {
            CancelMoveMap();

            _moveMapCommand = new CancellationTokenSource();

            try
            {
                await Task.Delay(500, _moveMapCommand.Token);
            }
            catch (TaskCanceledException e)
            {
                Logger.LogMessage(e.Message);
            }

            if (!IsMapTouchDown)
            {
                var center = Map.CameraPosition.Target;
                MapMoved.ExecuteIfPossible(new Address
                {
                    Latitude  = center.Latitude,
                    Longitude = center.Longitude
                });
            }
        }
        private void ExecuteMoveMapCommand()
        {
            CancelMoveMap();

            _moveMapCommand = new CancellationTokenSource();

            var t = new Task(() => Thread.Sleep(500), _moveMapCommand.Token);

            t.ContinueWith(r =>
            {
                if (r.IsCompleted && !r.IsCanceled && !r.IsFaulted)
                {
                    InvokeOnMainThread(() =>
                    {
                        MapMoved.ExecuteIfPossible(new Address {
                            Latitude = CenterCoordinate.Latitude, Longitude = CenterCoordinate.Longitude
                        });
                    });
                }
            }, _moveMapCommand.Token);
            t.Start();
        }
Beispiel #3
0
 public void MoveMap()
 {
     MapMoved?.Invoke(this, EventArgs.Empty);
 }