AnsweredAssumed Answered

Map Loaded but DrawStatus InProgress and UI freeze

Question asked by arxit20 on Jul 19, 2019
Latest reply on Aug 26, 2019 by minerjoe

Hi,
I have a webmap which I use in a mobile app with Xamarin Forms, ArcGIS and Prism .NET Runtime 100.5.

 

Often my MapView is loaded (Map.LoadStatus → Loaded) but the draw status remains in progress (DrawStatus → InProgress), (the application show a blank grid with the attribution) and freeze the UI. Sometimes all works fine (Map.LoadStatus → Loaded & DrawStatus → Completed). The issue is independent of the web connection and come from the mapView.
There are no other threads I invoke in my code that could freeze the UI.

The problem persists despite different implementations.
I followed the following sample: Display a map—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

XAML :

<viewmodels:MapViewViewModel x:Name="mapView" />

MapViewViewModel.cs :

public class MapViewViewModel : MapView, INotifyPropertyChanged
{
        public MapViewViewModel()
        {

            const string WebMapId = "..." ;
            DrawStatusChanged += OnDrawStatusChanged;

 

            Device.BeginInvokeOnMainThread(async () =>
            {
                var portal = await ArcGISPortal.CreateAsync(new Uri("http://www.arcgis.com/sharing/rest"));
                var portalItem = await PortalItem.CreateAsync(portal, WebMapId);
                Map = new Esri.ArcGISRuntime.Mapping.Map(portalItem);
                await Map.LoadAsync();
            });
        }

 

        private async void OnDrawStatusChanged(object sender, DrawStatusChangedEventArgs e)
        {
            Console.WriteLine(e.Status.ToString());
        }
}

Thanks,

Outcomes