/// <summary> /// retrieve given connectin profile info /// </summary> /// <param name="connectionProfile"></param> /// <returns></returns> public static string GetConnectionProfile(ConnectionProfile connectionProfile) { string connectionProfileInfo = string.Empty; if (connectionProfile != null) { connectionProfileInfo = "Profile Name : " + connectionProfile.ProfileName + "\n"; switch (connectionProfile.GetNetworkConnectivityLevel()) { case NetworkConnectivityLevel.None: connectionProfileInfo += "Connectivity Level : None\n"; break; case NetworkConnectivityLevel.LocalAccess: connectionProfileInfo += "Connectivity Level : Local Access\n"; break; case NetworkConnectivityLevel.ConstrainedInternetAccess: connectionProfileInfo += "Connectivity Level : Constrained Internet Access\n"; break; case NetworkConnectivityLevel.InternetAccess: connectionProfileInfo += "Connectivity Level : Internet Access\n"; break; } } return connectionProfileInfo; }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile(); NetworkUsageStates = new NetworkUsageStates(); StartTimePicker.Time -= TimeSpan.FromHours(1); }
private static bool IsInternetProfile(ConnectionProfile connectionProfile) { if (connectionProfile == null) { return false; } var connectivityLevel = connectionProfile.GetNetworkConnectivityLevel(); return connectivityLevel != NetworkConnectivityLevel.None; }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; this.profile = NetworkInformation.GetInternetConnectionProfile(); this.navigator = new Navigator(); NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged; }
string GetConnectionProfile(ConnectionProfile connectionProfile) { var connectionProfileInfo = string.Empty; if (connectionProfile != null) { connectionProfileInfo = "Profile Name : " + connectionProfile.ProfileName + "\n"; switch (connectionProfile.GetNetworkConnectivityLevel()) { case NetworkConnectivityLevel.None: connectionProfileInfo += "Connectivity Level : None\n"; break; case NetworkConnectivityLevel.LocalAccess: connectionProfileInfo += "Connectivity Level : Local Access\n"; break; case NetworkConnectivityLevel.ConstrainedInternetAccess: connectionProfileInfo += "Connectivity Level : Constrained Internet Access\n"; break; case NetworkConnectivityLevel.InternetAccess: connectionProfileInfo += "Connectivity Level : Internet Access\n"; break; } switch (connectionProfile.GetDomainConnectivityLevel()) { case DomainConnectivityLevel.None: connectionProfileInfo += "Domain Connectivity Level : None\n"; break; case DomainConnectivityLevel.Unauthenticated: connectionProfileInfo += "Domain Connectivity Level : Unauthenticated\n"; break; case DomainConnectivityLevel.Authenticated: connectionProfileInfo += "Domain Connectivity Level : Authenticated\n"; break; } //Get the Service Provider GUID if (connectionProfile.ServiceProviderGuid.HasValue) { connectionProfileInfo += "====================\n"; connectionProfileInfo += "Service Provider GUID: " + connectionProfile.ServiceProviderGuid + "\n"; } //Get the number of signal bars if (connectionProfile.GetSignalBars().HasValue) { connectionProfileInfo += "====================\n"; connectionProfileInfo += "Signal Bars: " + connectionProfile.GetSignalBars() + "\n"; } } return connectionProfileInfo; }
private HostName getHostName(ConnectionProfile profile) { HostName hostname = NetworkInformation.GetHostNames().SingleOrDefault( hn => ( hn.IPInformation != null && hn.IPInformation.NetworkAdapter != null && hn.IPInformation.NetworkAdapter.NetworkAdapterId == profile.NetworkAdapter.NetworkAdapterId ) ); return hostname; }
public string GetConnectionProfile(ConnectionProfile connectionProfile) { string connectionProfileInfo = string.Empty; if (connectionProfile != null) { connectionProfileInfo = "Profile Name : " + connectionProfile.ProfileName + "\n"; switch (connectionProfile.GetNetworkConnectivityLevel()) { case NetworkConnectivityLevel.None: connectionProfileInfo += "Connectivity Level : None\n"; break; case NetworkConnectivityLevel.LocalAccess: connectionProfileInfo += "Connectivity Level : Local Access\n"; break; case NetworkConnectivityLevel.ConstrainedInternetAccess: connectionProfileInfo += "Connectivity Level : Constrained Internet Access\n"; break; case NetworkConnectivityLevel.InternetAccess: connectionProfileInfo += "Connectivity Level : Internet Access\n"; break; } switch (connectionProfile.GetDomainConnectivityLevel()) { case DomainConnectivityLevel.None: connectionProfileInfo += "Domain Connectivity Level : None\n"; break; case DomainConnectivityLevel.Unauthenticated: connectionProfileInfo += "Domain Connectivity Level : Unauthenticated\n"; break; case DomainConnectivityLevel.Authenticated: connectionProfileInfo += "Domain Connectivity Level : Authenticated\n"; break; } //Get Connection Cost information ConnectionCost connectionCost = connectionProfile.GetConnectionCost(); connectionProfileInfo += GetConnectionCostInfo(connectionCost); //Get Dataplan Status information DataPlanStatus dataPlanStatus = connectionProfile.GetDataPlanStatus(); connectionProfileInfo += GetDataPlanStatusInfo(dataPlanStatus); } return connectionProfileInfo; }
internal static bool InternalGetIsNetworkAvailable() { RTConnectivity.ConnectionProfile connectionProfile = RTConnectivity.NetworkInformation.GetInternetConnectionProfile(); if (connectionProfile == null) { return(false); } RTConnectivity.NetworkConnectivityLevel level = connectionProfile.GetNetworkConnectivityLevel(); switch (level) { case RTConnectivity.NetworkConnectivityLevel.InternetAccess: case RTConnectivity.NetworkConnectivityLevel.ConstrainedInternetAccess: case RTConnectivity.NetworkConnectivityLevel.LocalAccess: return(true); default: return(false); } }
public IPInfoItem(HostName hostName, ConnectionProfile connectionProfile) { if (hostName == null || connectionProfile == null) return; IsWLAN = connectionProfile.IsWlanConnectionProfile; IsWWAN = connectionProfile.IsWwanConnectionProfile; if (IsWLAN) { this.InterfaceType = "WiFi"; this.InterfaceName = connectionProfile.ProfileName; } else if (IsWWAN) { this.InterfaceType = "mobile"; this.InterfaceName = connectionProfile.WwanConnectionProfileDetails.AccessPointName; } this.IPType = hostName.Type.ToString(); this.IPAddress = hostName.DisplayName; this.NetworkConnectivityLevel = connectionProfile.GetNetworkConnectivityLevel(); switch (this.NetworkConnectivityLevel) { case NetworkConnectivityLevel.LocalAccess: this.NetworkConnectivityLevelString = "Local network access only"; break; case NetworkConnectivityLevel.ConstrainedInternetAccess: this.NetworkConnectivityLevelString = "Limited internet access"; break; case NetworkConnectivityLevel.InternetAccess: this.NetworkConnectivityLevelString = "Local and Internet access"; break; default: this.NetworkConnectivityLevelString = "No connectivity"; break; } }
private bool CheckInternetIsConnect() { InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile(); if (InternetConnectionProfile == null) { noNetPath.Visibility = Visibility.Visible; noNetText.Visibility = Visibility.Visible; wifiPath.Visibility = Visibility.Collapsed; wapPath.Visibility = Visibility.Collapsed; loadText.Visibility = Visibility.Collapsed; return false; } if (InternetConnectionProfile.IsWlanConnectionProfile == false && InternetConnectionProfile.IsWwanConnectionProfile == false) { noNetPath.Visibility = Visibility.Visible; noNetText.Visibility = Visibility.Visible; wifiPath.Visibility = Visibility.Collapsed; wapPath.Visibility = Visibility.Collapsed; loadText.Visibility = Visibility.Collapsed; return false; } else if (InternetConnectionProfile.IsWlanConnectionProfile == true) { wifiPath.Visibility = Visibility.Visible; loadText.Visibility = Visibility.Visible; noNetPath.Visibility = Visibility.Collapsed; noNetText.Visibility = Visibility.Collapsed; wapPath.Visibility = Visibility.Collapsed; } else { wapPath.Visibility = Visibility.Visible; loadText.Visibility = Visibility.Visible; wifiPath.Visibility = Visibility.Collapsed; noNetPath.Visibility = Visibility.Collapsed; noNetText.Visibility = Visibility.Collapsed; } return true; }
private static bool IsCurrentHostName(ConnectionProfile profile, HostName hostName) { var result = hostName.IPInformation != null && hostName.IPInformation.NetworkAdapter != null && hostName.IPInformation.NetworkAdapter.NetworkAdapterId == profile.NetworkAdapter.NetworkAdapterId; return result; }
// //Get Connection Profile name and cost information // string GetConnectionProfile(ConnectionProfile connectionProfile) { string connectionProfileInfo = string.Empty; if (connectionProfile != null) { connectionProfileInfo = "Profile Name : " + connectionProfile.ProfileName + "\n"; switch (connectionProfile.GetNetworkConnectivityLevel()) { case NetworkConnectivityLevel.None: connectionProfileInfo += "Connectivity Level : None\n"; break; case NetworkConnectivityLevel.LocalAccess: connectionProfileInfo += "Connectivity Level : Local Access\n"; break; case NetworkConnectivityLevel.ConstrainedInternetAccess: connectionProfileInfo += "Connectivity Level : Constrained Internet Access\n"; break; case NetworkConnectivityLevel.InternetAccess: connectionProfileInfo += "Connectivity Level : Internet Access\n"; break; } //Get Connection Cost information ConnectionCost connectionCost = connectionProfile.GetConnectionCost(); connectionProfileInfo += GetConnectionCostInfo(connectionCost); //Get Dataplan Status information DataPlanStatus dataPlanStatus = connectionProfile.GetDataPlanStatus(); connectionProfileInfo += GetDataPlanStatusInfo(dataPlanStatus); //Get Network Security Settings NetworkSecuritySettings netSecuritySettings = connectionProfile.NetworkSecuritySettings; connectionProfileInfo += GetNetworkSecuritySettingsInfo(netSecuritySettings); } return connectionProfileInfo; }
/// <summary> /// Creates an instance of RoutePolicy using the defined connection /// profile and host name values. /// </summary> /// <param name="pConnectionProfile">The connection profile</param> /// <param name="pHostName"> /// The host name for the route policy to the special PDP context. /// </param> public RoutePolicy(ConnectionProfile pConnectionProfile, HostName pHostName) { ConnectionProfile = pConnectionProfile; HostName = pHostName; }
public CheckStatusInternet() { connectProfile = NetworkInformation.GetInternetConnectionProfile(); }
private async void refreshFeedList() {//-------------------------------------------------------------------refresh dedomenwn feedList.Clear(); List<Road> list = await parseHtml(url); StreetList.ItemsSource = null; StreetList.ItemsSource = feedList; if (feedList.Count == 0)//fix tou bug xamilis taxititas { await parseHtml(url); StreetList.ItemsSource = null; StreetList.ItemsSource = feedList; } InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile(); if (offlineMode && InternetConnectionProfile != null && InternetConnectionProfile.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess) { await parseHtml(url); if (!offlineMode) { StreetList.ItemsSource = null; StreetList.ItemsSource = feedList; } } }//------------------------------------------------------------------------------------------------------------------
/// <summary> /// Gets the current network status. /// </summary> /// <param name="sender">The object notifying that network status changed.</param> /// <returns> /// An instance of <see cref="NetworkChangedEventArgs" /> describing the current network status. /// </returns> protected override NetworkChangedEventArgs GetCurrentNetworkStatus(object sender) { try { _cachedProfile = NetworkInformation.GetInternetConnectionProfile(); _usedCachedProfile = true; return new NetworkChangedEventArgs(this.IsNetworkAvailable, this.ConnectionType); } finally { _cachedProfile = null; _usedCachedProfile = false; } }
private static bool IsCurrentIPv4Address(ConnectionProfile profile, HostName hostName) { var result = hostName.Type == HostNameType.Ipv4 && IsCurrentHostName(profile, hostName); return result; }
// //Get Connection Profile name and cost information // string GetConnectionProfile(ConnectionProfile connectionProfile) { string connectionProfileInfo = string.Empty; if (connectionProfile != null) { connectionProfileInfo = "Profile Name : " + connectionProfile.ProfileName + "\n"; switch (connectionProfile.GetNetworkConnectivityLevel()) { case NetworkConnectivityLevel.None: connectionProfileInfo += "Connectivity Level : None\n"; break; case NetworkConnectivityLevel.LocalAccess: connectionProfileInfo += "Connectivity Level : Local Access\n"; break; case NetworkConnectivityLevel.ConstrainedInternetAccess: connectionProfileInfo += "Connectivity Level : Constrained Internet Access\n"; break; case NetworkConnectivityLevel.InternetAccess: connectionProfileInfo += "Connectivity Level : Internet Access\n"; break; } switch (connectionProfile.GetDomainConnectivityLevel()) { case DomainConnectivityLevel.None: connectionProfileInfo += "Domain Connectivity Level : None\n"; break; case DomainConnectivityLevel.Unauthenticated: connectionProfileInfo += "Domain Connectivity Level : Unauthenticated\n"; break; case DomainConnectivityLevel.Authenticated: connectionProfileInfo += "Domain Connectivity Level : Authenticated\n"; break; } //Get Connection Cost information ConnectionCost connectionCost = connectionProfile.GetConnectionCost(); connectionProfileInfo += GetConnectionCostInfo(connectionCost); //Get Dataplan Status information DataPlanStatus dataPlanStatus = connectionProfile.GetDataPlanStatus(); connectionProfileInfo += GetDataPlanStatusInfo(dataPlanStatus); //Get Network Security Settings NetworkSecuritySettings netSecuritySettings = connectionProfile.NetworkSecuritySettings; connectionProfileInfo += GetNetworkSecuritySettingsInfo(netSecuritySettings); //Get Wlan Connection Profile Details if this is a Wlan ConnectionProfile if (connectionProfile.IsWlanConnectionProfile) { WlanConnectionProfileDetails wlanConnectionProfileDetails = connectionProfile.WlanConnectionProfileDetails; connectionProfileInfo += GetWlanConnectionProfileDetailsInfo(wlanConnectionProfileDetails); } //Get Wwan Connection Profile Details if this is a Wwan ConnectionProfile if (connectionProfile.IsWwanConnectionProfile) { WwanConnectionProfileDetails wwanConnectionProfileDetails = connectionProfile.WwanConnectionProfileDetails; connectionProfileInfo += GetWwanConnectionProfileDetailsInfo(wwanConnectionProfileDetails); } //Get the Service Provider GUID if (connectionProfile.ServiceProviderGuid.HasValue) { connectionProfileInfo += "====================\n"; connectionProfileInfo += "Service Provider GUID: " + connectionProfile.ServiceProviderGuid + "\n"; } //Get the number of signal bars if (connectionProfile.GetSignalBars().HasValue) { connectionProfileInfo += "====================\n"; connectionProfileInfo += "Signal Bars: " + connectionProfile.GetSignalBars() + "\n"; } } return connectionProfileInfo; }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile(); NetworkUsageStates = new NetworkUsageStates(); }