Skip to content

Commit

Permalink
#315: Added popup box if airplane mode is on or netweork is off. Chec…
Browse files Browse the repository at this point in the history
…k it out Gab and se eif it works for you? I checked and I dont think you are capable of turning airplane on or off in the app anymore.
  • Loading branch information
jameljoseph committed Dec 13, 2023
1 parent d679838 commit 3879cca
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion GSCFieldApp/GSCFieldApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
<RuntimeIdentifiers>win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot</RuntimeIdentifiers>
<PackageCertificateThumbprint>14CF0ECF911C8A37CF0E2EF4F8E06F25425B80C1</PackageCertificateThumbprint>
<PackageCertificateThumbprint>2BEF7CE5EC4647A64DCBB60C29D4EE6084BDFC6E</PackageCertificateThumbprint>
<AppxPackageDir>C:\work data\datacollections\PublishedVersions\</AppxPackageDir>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppInstallerUpdateFrequency>100</AppInstallerUpdateFrequency>
Expand Down
2 changes: 1 addition & 1 deletion GSCFieldApp/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="NaturalResourcesCanada.GeologicalSurveyCanadaField" Publisher="CN=Geological Survey of Canada, O=Natural Resources Canada, C=CA" Version="2.4.2.0" />
<Identity Name="NaturalResourcesCanada.GeologicalSurveyCanadaField" Publisher="CN=jjoseph" Version="2.4.2.0" />
<mp:PhoneIdentity PhoneProductId="06e90cbe-1a34-4205-8fe6-3ce0ad4467db" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Geological Survey Canada Field Application</DisplayName>
Expand Down
1 change: 1 addition & 0 deletions GSCFieldApp/Views/MapPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
</TextBlock>

</Border>

</RelativePanel>


Expand Down
29 changes: 26 additions & 3 deletions GSCFieldApp/Views/MapPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;
using Symbol = Windows.UI.Xaml.Controls.Symbol;
using Windows.Networking.Connectivity;
using Windows.UI.Xaml.Hosting;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Core;
using Windows.UI.Popups;
using System.Linq;
using Windows.Devices.Enumeration;

namespace GSCFieldApp.Views
{
Expand All @@ -20,8 +27,9 @@ public sealed partial class MapPage : Page
#region INIT
public Map esriMap;
public bool mapsLoaded = false;
//private DispatcherTimer timer;
readonly DataLocalSettings localSetting = new DataLocalSettings();

private ConnectionProfile connectionProfile;
//UI headers enable/disable colors
private readonly string resourceNameGridColor = "MapViewGridColor";

Expand All @@ -38,6 +46,12 @@ public MapPage()

this.InitializeComponent();
NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
//Window.Current.Activated += CurrentWindow_Activated;

// Subscribe to the NetworkStatusChanged event
connectionProfile = NetworkInformation.GetInternetConnectionProfile();
CheckAirplaneMode();


this.Loaded -= MapPage_Loaded;
this.Loaded += MapPage_Loaded;
Expand Down Expand Up @@ -340,9 +354,18 @@ public void SetBackgroundGrid()
}

}
private async void 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();
}
}

#endregion

Expand Down

0 comments on commit 3879cca

Please sign in to comment.