add IsUniNetworkAvailable()
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Net.NetworkInformation;
|
||||
using Microsoft.Phone.Shell;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
@@ -150,6 +151,9 @@ namespace CampusAppWP8
|
||||
}
|
||||
|
||||
this.UserSettingsLoaded();
|
||||
|
||||
Settings.AppSetting.UniNetwork = Utilities.IsUniNetworkAvailable();
|
||||
|
||||
if (Settings.AppSetting.GeoWatchEnable)
|
||||
{
|
||||
Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPosition));
|
||||
|
||||
@@ -61,5 +61,20 @@ namespace CampusAppWP8.Model.Setting
|
||||
App.SaveToAppState<bool>(Constants.AppSetting_DevMode, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a value indicating whether the uni network.</summary>
|
||||
/// <value>true if uni network, false if not.</value>
|
||||
public bool UniNetwork
|
||||
{
|
||||
get
|
||||
{
|
||||
return App.LoadFromAppState<bool>(Constants.AppSetting_UniNet);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
App.SaveToAppState<bool>(Constants.AppSetting_UniNet, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,7 +185,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// </summary>
|
||||
private void InitializeFeed()
|
||||
{
|
||||
if (Settings.AppSetting.GeoWatchEnable)
|
||||
if (Settings.AppSetting.GeoWatchEnable && Settings.AppSetting.UniNetwork)
|
||||
{
|
||||
Thread thread = new Thread(new ThreadStart(this.DeterminCurrentCampusAndLoadFeed));
|
||||
thread.Start();
|
||||
|
||||
@@ -87,6 +87,33 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die UniNet ähnelt.
|
||||
/// </summary>
|
||||
public static string AppSetting_UniNet {
|
||||
get {
|
||||
return ResourceManager.GetString("AppSetting_UniNet", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die 802.1X ähnelt.
|
||||
/// </summary>
|
||||
public static string AppSetting_UniNetworkDesc {
|
||||
get {
|
||||
return ResourceManager.GetString("AppSetting_UniNetworkDesc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die 802.1X ähnelt.
|
||||
/// </summary>
|
||||
public static string AppSetting_UniNetworkName {
|
||||
get {
|
||||
return ResourceManager.GetString("AppSetting_UniNetworkName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -417,4 +417,13 @@
|
||||
<data name="AppSetting_DevMode" xml:space="preserve">
|
||||
<value>DevMode</value>
|
||||
</data>
|
||||
<data name="AppSetting_UniNet" xml:space="preserve">
|
||||
<value>UniNet</value>
|
||||
</data>
|
||||
<data name="AppSetting_UniNetworkDesc" xml:space="preserve">
|
||||
<value>802.1X</value>
|
||||
</data>
|
||||
<data name="AppSetting_UniNetworkName" xml:space="preserve">
|
||||
<value>802.1X</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -6,13 +6,13 @@
|
||||
// <sience>16.07.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Device.Location;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -20,6 +20,7 @@ namespace CampusAppWP8.Utility
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility.NDEF;
|
||||
using Windows.Networking.Proximity;
|
||||
using Microsoft.Phone.Net.NetworkInformation;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of utility functions.
|
||||
@@ -212,7 +213,7 @@ namespace CampusAppWP8.Utility
|
||||
{
|
||||
if (!Settings.AppSetting.GeoWatchEnable)
|
||||
{
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
|
||||
@@ -286,5 +287,24 @@ namespace CampusAppWP8.Utility
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Query if the phon 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()
|
||||
{
|
||||
NetworkInterfaceList networkInterfaceList = new NetworkInterfaceList();
|
||||
foreach (NetworkInterfaceInfo networkInterfaceInfo in networkInterfaceList)
|
||||
{
|
||||
if (networkInterfaceInfo.InterfaceType == NetworkInterfaceType.Wireless80211
|
||||
&& networkInterfaceInfo.InterfaceSubtype == NetworkInterfaceSubType.WiFi
|
||||
&& networkInterfaceInfo.InterfaceName.Equals(Constants.AppSetting_UniNetworkName)
|
||||
&& networkInterfaceInfo.Description.Equals(Constants.AppSetting_UniNetworkDesc))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user