Created
May 26, 2017 12:43
-
-
Save mushfiqweb/4e235d4c577e84d99c33acafc11295a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // register for network status change notifications | |
| networkStatusCallback = new NetworkStatusChangedEventHandler(OnNetworkStatusChange); | |
| if (!registeredNetworkStatusNotif) | |
| { | |
| NetworkInformation.NetworkStatusChanged += networkStatusCallback; | |
| registeredNetworkStatusNotif = true; | |
| } | |
| async void OnNetworkStatusChange(object sender) | |
| { | |
| // get the ConnectionProfile that is currently used to connect to the Internet | |
| ConnectionProfile InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile(); | |
| if (InternetConnectionProfile == null) | |
| { | |
| await _cd.RunAsync(CoreDispatcherPriority.Normal, () => | |
| { | |
| rootPage.NotifyUser("Not connected to Internet\n", NotifyType.StatusMessage); | |
| }); | |
| } | |
| else | |
| { | |
| connectionProfileInfo = GetConnectionProfile(InternetConnectionProfile); | |
| await _cd.RunAsync(CoreDispatcherPriority.Normal, () => | |
| { | |
| rootPage.NotifyUser(connectionProfileInfo, NotifyType.StatusMessage); | |
| }); | |
| } | |
| internetProfileInfo = ""; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment