add IsWifiAvailable

This commit is contained in:
stubbfel
2013-08-26 18:35:18 +02:00
parent b8145a8488
commit 94ce3f1c6e
4 changed files with 45 additions and 4 deletions

View File

@@ -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);
}
}
}
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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;
}
}
}