Ejemplo n.º 1
0
        /// <summary>
        /// Loads the mobile map package and the map
        /// </summary>
        /// <returns>Async task</returns>
        internal async Task InitializeAsync()
        {
            // Get Mobile Map Package from the location on device
            var mmpk = await this.LoadMMPKAsync().ConfigureAwait(false);

            // Display map from the mmpk. Assumption is made that the first map of the mmpk is the one used
            this.Map = mmpk.Maps.FirstOrDefault();
            await Map.LoadAsync().ConfigureAwait(false);

            // Get the locator to be used in the app
            var locator = mmpk.LocatorTask;
            await locator.LoadAsync().ConfigureAwait(false);

            // Create instance of the Location View Model
            if (LocationViewModel.Instance == null)
            {
                LocationViewModel.Instance = LocationViewModel.Create(Map, locator);
            }

            // Set viewpoint of the map depending on user's setting
            await this.SetInitialViewPointAsync().ConfigureAwait(false);
        }