private void navigate()
{
if (Mymap.Layers.Contains(floorPoisDetail))
{
floorPoisDetail.Clear();
Mymap.Layers.Remove(floorPoisDetail);
}
if (Mymap.Layers.Contains(_sourceLayer))
Mymap.Layers.Remove(_sourceLayer);
if (_locationManager.Status != GeoPositionStatus.Ready && !_externalSource && !_sourcePoi)
{
//MessageBox.Show("No location services found. Please enable location services and try again!");
if (Mymap.Layers.Contains(floorPoisDetail))
Mymap.Layers.Remove(floorPoisDetail);
}
else
{
if (to_entrance)
{
Mymap.Layers.Remove(mapHoldLayer);
ApplicationBar.IsVisible = false;
MoveViewWindow(-70);
stackpanelOpen();
directions_grid.Visibility = Visibility.Visible;
calcProgrBar.Visibility = Visibility.Visible;
time.Visibility = Visibility.Collapsed;
distance.Visibility = Visibility.Collapsed;
calcProgrBar.IsIndeterminate = true;
GetNavigationRoute(entrance_location);
Mymap.SetView(entrance_location, 20, MapAnimationKind.Parabolic);
return;
}
else
{
if (start_nav && intobuilding())
{
Mymap.MapElements.Clear();
GetNavigationRoutesBuilding(_selectedBuild, _floorPoiTo, _selectedFloor, _myLatitude.ToString(CultureInfo.InvariantCulture),
_myLongitude.ToString(CultureInfo.InvariantCulture));
return;
}
}
if (_searchBuilding && into_selectedbuiding())
{
_searchBuilding = false;
}
// if we are into the building and no source poi set get navigations route from location to poi
if (_tileLoaded && !_sourcePoi && !_externalSource && !_searchBuilding)
{
Mymap.MapElements.Clear();
GetNavigationRoutesBuilding(_selectedBuild, _floorPoiTo, _selectedFloor, _myLatitude.ToString(CultureInfo.InvariantCulture),
_myLongitude.ToString(CultureInfo.InvariantCulture));
}
else
{
// if we set source poi get navigations route from source poi else get all routes
if (_sourcePoi)
BuildingSourcePoi();
else
{
NavigateToFloorPoi();
}
}
}
}