Exemplo n.º 1
0
    public void CreateMap(Map map)
    {
        nowMapMessage.Clear();
        nowMap = map;
        for (short i = 0; i < map.mapXCount; i++)
        {
            for (short j = 0; j < map.mapYCount; j++)
            {
                MapNode node = new MapNode();
                node.xPoint = i;
                node.yPoint = j;
                MapPointMessage temp = new MapPointMessage();
                temp.xPoint    = i;
                temp.yPoint    = j;
                temp.xposition = (i - map.mapXCount / 2) * 10;
                temp.yposition = (j - map.mapYCount / 2) * 10;
                int index = i * map.mapYCount + j;
                if (index >= map.mapData.Count)
                {
                    temp.textureID = 0;
                }
                else
                {
                    temp.textureID = map.mapData[index];
                }

                nowMapMessage.Add(node, temp);
            }
        }
        SceneAction.OnUpDateMap();
    }
        private void SetPoint(MapPointMessage message)
        {
            ShowHeaderLoader();

            cancellationTokenSource.Cancel();
            cancellationTokenSource = new CancellationTokenSource();

            Point           = message.Point.GeoCoordinate;
            PointVisibility = Visibility.Visible;

            FooterBarVisibility = Visibility.Collapsed;

            Action search = async() =>
            {
                try
                {
                    Address customAddress = await BumbleApiService.ReverseGeoCode(cancellationTokenSource.Token, user, message.Point);

                    SelectedCustomPoint = new Entities.PlaceOfInterest(customAddress.AddressText, null, customAddress.ShortAddressText, message.Point, -1);

                    FooterBarVisibility = Visibility.Visible;
                }
                catch (Exception ex)
                {
                    if (ex.Message != AppResources.ApiErrorTaskCancelled)
                    {
                        base.ShowPopup(CustomPopupMessageType.Error, ex.Message, AppResources.CustomPopupGenericOkMessage, null);
                    }
                }

                HideHeaderLoader();
            };

            DispatcherHelper.CheckBeginInvokeOnUI(search);
        }
        private void Map_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            Map           map      = (sender as Map);
            Point         p        = e.GetPosition(map);
            GeoCoordinate location = (map).ConvertViewportPointToGeoCoordinate(p);

            VibrateController.Default.Start(TimeSpan.FromMilliseconds(500));

            MapPointMessage.Send(Coordinate.FromGeoCoordinate(location));
        }
        private void Map_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            GeoCoordinate location;
            bool          canConvert = (sender as Map).TryViewportPointToLocation(e.GetPosition(sender as Map), out location);

            VibrateController.Default.Start(TimeSpan.FromMilliseconds(500));

            if (canConvert)
            {
                MapPointMessage.Send(Coordinate.FromGeoCoordinate(location));
            }
        }
        private void SetPoint(MapPointMessage message)
        {
            ShowHeaderLoader();

            cancellationTokenSource.Cancel();
            cancellationTokenSource = new CancellationTokenSource();

            Point = message.Point.GeoCoordinate;
            PointVisibility = Visibility.Visible;

            FooterBarVisibility = Visibility.Collapsed;

            Action search = async () =>
            {
                try
                {
                    Address customAddress = await BumbleApiService.ReverseGeoCode(cancellationTokenSource.Token, user, message.Point);

                    SelectedCustomPoint = new Entities.PlaceOfInterest(customAddress.AddressText, null, customAddress.ShortAddressText, message.Point, -1);

                    FooterBarVisibility = Visibility.Visible;
                }
                catch (Exception ex)
                {
                    if (ex.Message != AppResources.ApiErrorTaskCancelled)
                    {
                        base.ShowPopup(CustomPopupMessageType.Error, ex.Message, AppResources.CustomPopupGenericOkMessage, null);
                    }
                }

                HideHeaderLoader();
            };

            DispatcherHelper.CheckBeginInvokeOnUI(search);
        }