protected override async void OnNavigatedTo(NavigationEventArgs e)
{
try
{
base.OnNavigatedTo(e);
displayInformation.OrientationChanged += DisplayInformation_OrientationChanged;
if (world == null)
{
InitializeWorld();
PopulateWorld();
}
if (cameraFeedUtility == null)
{
cameraFeedUtility = new CameraFeedUtility(CameraPreview, Dispatcher);
}
if (world != null)
{
world.StartSensors();
await cameraFeedUtility.StartPreviewAsync(world.Rotation.ToVideoRotation());
world.UpdateRotation();
cameraFeedUtility.UpdatePreviewRotation(world.Rotation);
}
geolocator = new Geolocator();
geolocator.PositionChanged += Geolocator_PositionChanged;
var position = await geolocator.GetGeopositionAsync();
UpdateLocation(position);
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}