Skip to content

Commit

Permalink
#315 quick fix for airplane mode crashing the app.
Browse files Browse the repository at this point in the history
  • Loading branch information
ghuotvez committed Feb 27, 2024
1 parent 82404c0 commit ea02367
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions GSCFieldApp/ViewModels/MapPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1538,18 +1538,37 @@ public async Task NoLocationRoutine()
/// When no location is available probably due to flight mode. Display this message.
/// </summary>

private async void CheckAirplaneMode()
private async Task CheckAirplaneMode()
{
var connectionProfile = NetworkInformation.GetInternetConnectionProfile();

if (connectionProfile == null)
{
// Possible airplane mode
var messageDialog = new Windows.UI.Popups.MessageDialog("Airplane Mode or No Network Connection Found");
messageDialog.Commands.Add(new Windows.UI.Popups.UICommand("OK"));
await messageDialog.ShowAsync();


ContentDialog noLocationFlightModeDialog = new ContentDialog()
{
Title = "No Data",
Content = "Airplane Mode or No Network Connection Found",
PrimaryButtonText = "OK",
};

noLocationFlightModeDialog.Style = (Style)Application.Current.Resources["WarningDialog"];


try
{
ContentDialogResult flightModeResult = await Services.ContentDialogMaker.CreateContentDialogAsync(noLocationFlightModeDialog, false).Result;
}
catch (Exception)
{
Debug.WriteLine("Warning dialog for location allocation failed.");
}



}
//Windows.UI.Popups.MessageDialog.Style = (Style)Application.Current.Resources["WarningDialog"];

}
public async Task NoLocationFlightMode()
{
Expand Down

0 comments on commit ea02367

Please sign in to comment.