Skip to content

Commit

Permalink
fix(iOS): SimpleOrientationSensor sample
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Nov 22, 2024
1 parent 4dcf8cf commit b619e81
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.ComponentModel;
using Uno.Gallery.ViewModels;
using Windows.Devices.Sensors;
using Windows.ApplicationModel.Core;
using Windows.UI.Core;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;

Expand Down Expand Up @@ -84,10 +86,13 @@ public void StopObservingReadingChange()
ObservingReadingChange = false;
}

private void SimpleOrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
private async void SimpleOrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
{
LastReadTimestamp = args.Timestamp;
Orientation = args.Orientation;
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
LastReadTimestamp = args.Timestamp;
Orientation = args.Orientation;
});
}
}
}

0 comments on commit b619e81

Please sign in to comment.