add IsWifiAvailable
This commit is contained in:
@@ -76,5 +76,20 @@ namespace CampusAppWP8.Model.Setting
|
||||
App.SaveToAppState<bool>(Constants.AppSetting_UniNet, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a value indicating whether this object is WiFi enable.</summary>
|
||||
/// <value>true if WiFi enable, false if not.</value>
|
||||
public bool WifiEnable
|
||||
{
|
||||
get
|
||||
{
|
||||
return App.LoadFromAppState<bool>(Constants.AppSetting_WifiEnable);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
App.SaveToAppState<bool>(Constants.AppSetting_WifiEnable, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,6 +114,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die WifiEnable ähnelt.
|
||||
/// </summary>
|
||||
public static string AppSetting_WifiEnable {
|
||||
get {
|
||||
return ResourceManager.GetString("AppSetting_WifiEnable", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -426,4 +426,7 @@
|
||||
<data name="AppSetting_UniNetworkName" xml:space="preserve">
|
||||
<value>802.1X</value>
|
||||
</data>
|
||||
<data name="AppSetting_WifiEnable" xml:space="preserve">
|
||||
<value>WifiEnable</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -12,14 +12,11 @@ namespace CampusAppWP8.Utility
|
||||
using System.Device.Location;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility.NDEF;
|
||||
using Windows.Networking.Proximity;
|
||||
using Microsoft.Phone.Net.NetworkInformation;
|
||||
|
||||
/// <summary>
|
||||
@@ -288,7 +285,7 @@ namespace CampusAppWP8.Utility
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Query if the phon is in the uni network. Method compares only Networkname and Description!</summary>
|
||||
/// <summary>Query if the phone is in the uni network. Method compares only Networkname and Description!</summary>
|
||||
/// <remarks>Stubbfel, 26.08.2013.</remarks>
|
||||
/// <returns>true if uni networkavailable, false if not.</returns>
|
||||
public static bool IsUniNetworkAvailable()
|
||||
@@ -306,5 +303,22 @@ namespace CampusAppWP8.Utility
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Queries if a wifik is available.</summary>
|
||||
/// <remarks>Stubbfel, 26.08.2013.</remarks>
|
||||
/// <returns>true if a wifik is available, false if not.</returns>
|
||||
public static bool IsWifiAvailable()
|
||||
{
|
||||
NetworkInterfaceList networkInterfaceList = new NetworkInterfaceList();
|
||||
foreach (NetworkInterfaceInfo networkInterfaceInfo in networkInterfaceList)
|
||||
{
|
||||
if (networkInterfaceInfo.InterfaceType == NetworkInterfaceType.Wireless80211
|
||||
&& networkInterfaceInfo.InterfaceSubtype == NetworkInterfaceSubType.WiFi)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user