//Thread safe initialization of the geocoder
 private static async Task InitGeocoderAsync()
 {
     lock (LockInstance)
     {
         if (locator != null)
         {
             return;
         }
         if (initializeTask == null)
         {
             string path = System.IO.Path.Combine(ProvisionDataHelper.GetDataFolder(), "Geocoder", "CampusRooms.loc");
             var    task = LocatorTask.CreateAsync(new Uri(path, UriKind.RelativeOrAbsolute));                  //Using relative path makes the create never complete.
             initializeTask = task.ContinueWith(t =>
             {
                 if (t.IsFaulted)
                 {
                     throw t.Exception;
                 }
                 lock (LockInstance)
                     locator = t.Result;
             });
         }
     }
     await initializeTask.ConfigureAwait(false);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initiates offline data provisioning on first run
        /// </summary>
        /// <returns></returns>
        private async Task ProvisionDataAsync()
        {
            await ProvisionDataHelper.GetDataAsync((status) =>
            {
                UpdateLoadStatus(status);
            });

            UpdateLoadStatus("");
        }
Ejemplo n.º 3
0
 //Thread safe initialization of the route task
 private static Task <RouteTask> InitRouterAsync()
 {
     if (initializeTask == null)
     {
         string path = System.IO.Path.Combine(ProvisionDataHelper.GetDataFolder(), "Network", "IndoorNavigation.geodatabase");
         initializeTask = RouteTask.CreateAsync(path, "Transportation_ND");
     }
     return(initializeTask);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a 2D Map of the campus using the locally stored data
        /// This map works offline, but if online, is also supplemented by a world map for better reference
        /// </summary>
        /// <returns></returns>
        private async Task InitializeMap()
        {
            Basemap basemap = Basemap.CreateTopographic();
            var     layer   = new ArcGISVectorTiledLayer(new Uri(Path.Combine(ProvisionDataHelper.GetDataFolder(), "Basemap/CampusBasemap.vtpk"), UriKind.RelativeOrAbsolute));
            await layer.LoadAsync();

            basemap.BaseLayers.Add(layer);

            Map = new Map(SpatialReferences.WebMercator)
            {
                Basemap          = basemap,
                InitialViewpoint = new Viewpoint(new MapPoint(-13046209, 4036456, SpatialReferences.WebMercator), 30000),
                MaxScale         = 160,
                MinScale         = 30000
            };

            await Map.LoadAsync();

            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Map)));
        }