Пример #1
0
        private async void SendLocationExecute()
        {
            var page = new DialogSendLocationPage();

            var dialog = new ContentDialogBase();

            dialog.Content = page;

            page.Dialog = dialog;

            var confirm = await dialog.ShowAsync();

            if (confirm == ContentDialogBaseResult.OK)
            {
                if (page.Media is TLMessageMediaVenue venue)
                {
                    await SendGeoPointAsync(venue);
                }
                else if (page.Media is TLMessageMediaGeo geo && geo.Geo is TLGeoPoint geoPoint)
                {
                    await SendGeoPointAsync(geoPoint.Lat, geoPoint.Long);
                }
            }

            //NavigationService.Navigate(typeof(DialogSendLocationPage));
        }
Пример #2
0
        private async void SendLocationExecute()
        {
            var page = new DialogSendLocationPage();

            var dialog = new ContentDialogBase();

            dialog.Content = page;

            page.Dialog       = dialog;
            page.LiveLocation = !_liveLocationService.IsTracking(Peer.ToPeer());

            var confirm = await dialog.ShowAsync();

            if (confirm == ContentDialogBaseResult.OK)
            {
                if (page.Media is TLMessageMediaVenue venue)
                {
                    await SendGeoAsync(venue);
                }
                else if (page.Media is TLMessageMediaGeoLive geoLive)
                {
                    if (geoLive.Geo == null || geoLive.Period == 0 || _liveLocationService.IsTracking(Peer.ToPeer()))
                    {
                        _liveLocationService.StopTracking(Peer.ToPeer());
                    }
                    else
                    {
                        await SendGeoAsync(geoLive);
                    }
                }
                else if (page.Media is TLMessageMediaGeo geo && geo.Geo is TLGeoPoint geoPoint)
                {
                    await SendGeoAsync(geoPoint.Lat, geoPoint.Long);
                }
            }

            //NavigationService.Navigate(typeof(DialogSendLocationPage));
        }