Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Catch FeatureNotSupportedException when navigating back for Barometer #558

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Samples/Samples/ViewModel/BarometerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,16 @@ void OnBarometerReadingChanged(object sender, BarometerChangedEventArgs e)

void OnStop()
{
IsActive = false;
Barometer.Stop();
Barometer.ReadingChanged -= OnBarometerReadingChanged;
try
{
IsActive = false;
Barometer.Stop();
Barometer.ReadingChanged -= OnBarometerReadingChanged;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"An exception occured: {ex.Message}");
}
}
}
}