I am trying to load a basemap for offline use. I used ArcGISPro to creat a .tpk file.
The following is my code to load the tpk. I am expecting the content of the tpk to be rendered in my Map, but it doesn't.
try
{
var picker = new Windows.Storage.Pickers.FileOpenPicker();
picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary;
picker.FileTypeFilter.Add(".tpk");
picker.FileTypeFilter.Add(".mmpk");
Windows.Storage.StorageFile file = await picker.PickSingleFileAsync();
if (file != null)
{
// Application now has read/write access to the picked file
var result = "Picked photo: " + file.Name;
}
else
{
var error = "Operation cancelled.";
}
TileCache cache = new TileCache(file.Path);
ArcGISTiledLayer layer = new ArcGISTiledLayer(cache);
ViewModel.Map = new Map(new Basemap(layer));
}
catch (Exception ex)
{
var tmp = ex.ToString();
}
If i try to add a "await ViewModel.Map.LoadAsync()" at the end of the code above. It doesnt seem to load and i dont catch an exception either.
Not sure what i am doing wrong. I chose this code based on the example posted here: https://developers.arcgis.com/net/latest/uwp/guide/work-with-offline-layers.htm
attached is a zipped up tpk file that i am attempting load.