Merge branch 'feature/#154' into develop

This commit is contained in:
stubbfel
2013-08-27 11:23:29 +02:00
22 changed files with 172 additions and 19 deletions

View File

@@ -152,7 +152,15 @@ namespace CampusAppWP8
this.UserSettingsLoaded();
Settings.AppSetting.UniNetwork = Utilities.IsUniNetworkAvailable();
Settings.AppSetting.UniNetwork = Utilities.IsUniNetworkAvailable();
if (!Settings.AppSetting.UniNetwork)
{
Settings.AppSetting.WifiEnable = Utilities.IsWifiAvailable();
}
else
{
Settings.AppSetting.WifiEnable = true;
}
if (Settings.AppSetting.GeoWatchEnable)
{

View File

@@ -483,6 +483,9 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<Folder Include="Feed\Utility\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -62,7 +62,7 @@ namespace CampusAppWP8.Feed.Link
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
{
if (fileInfo == null || !fileInfo.Exists)
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
{
return false;
}

View File

@@ -62,7 +62,7 @@ namespace CampusAppWP8.Feed.Link
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
{
if (fileInfo == null || !fileInfo.Exists)
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
{
return false;
}

View File

@@ -96,7 +96,7 @@ namespace CampusAppWP8.Feed.Mensa
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(MenuWeekModel model, FileInfo fileInfo)
{
if (fileInfo == null || !fileInfo.Exists)
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
{
return false;
}

View File

@@ -62,7 +62,7 @@ namespace CampusAppWP8.Feed.StudentCouncil
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(StudentCouncilListModel model, FileInfo fileInfo)
{
if (fileInfo == null || !fileInfo.Exists)
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
{
return false;
}

View File

@@ -76,5 +76,35 @@ 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);
}
}
/// <summary>Gets or sets a value indicating whether the only WiFi.</summary>
/// <value>true if only wifi, false if not.</value>
public bool OnlyWifi
{
get
{
return App.LoadFromAppState<bool>(Constants.AppSetting_OnlyWifi);
}
set
{
App.SaveToAppState<bool>(Constants.AppSetting_OnlyWifi, value);
}
}
}
}

View File

@@ -15,6 +15,7 @@ namespace CampusAppWP8.Pages.Departments
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using CampusAppWP8.Utility;
/// <summary>
/// Page with a list of the faculties.
@@ -48,7 +49,8 @@ namespace CampusAppWP8.Pages.Departments
DepartmentIndexPage.feed.OnLoaded += new DepartmentFeed.OnIO(this.SetupFacultyList);
DepartmentIndexPage.feed.OnFailedWeb += new DepartmentFeed.OnFailed(this.FeedIsFailedWeb);
DepartmentIndexPage.feed.OnFailedFile += new DepartmentFeed.OnFailed(this.FeedIsFailedFile);
DepartmentIndexPage.feed.LoadData();
DepartmentIndexPage.feed.LoadData(Utilities.getLoadModus<Model.Departments.DepartmentModel>());
if (DepartmentIndexPage.favorite == null)
{

View File

@@ -12,6 +12,7 @@ namespace CampusAppWP8.Pages.Events
using System.Windows.Navigation;
using CampusAppWP8.Feed.Events;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
@@ -48,7 +49,7 @@ namespace CampusAppWP8.Pages.Events
EventIndexPage.eventFeed.OnLoaded += new EventFeed.OnIO(this.SetupEventPageList);
EventIndexPage.eventFeed.OnFailedWeb += new EventFeed.OnFailed(this.FeedIsFailedWeb);
EventIndexPage.eventFeed.OnFailedFile += new EventFeed.OnFailed(this.FeedIsFailedFile);
EventIndexPage.eventFeed.LoadData();
EventIndexPage.eventFeed.LoadData(Utilities.getLoadModus<Model.RSS.RSSViewModel>());
}
/// <summary>
@@ -88,6 +89,21 @@ namespace CampusAppWP8.Pages.Events
base.OnNavigatedTo(e);
}
/// <summary>
/// Methods overrides the OnNavigatedFrom-Method
/// </summary>
/// <param name="e">some NavigationEventArgs</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (NavigationMode.Back == e.NavigationMode)
{
// delete all models
EventIndexPage.eventFeed.SaveData();
}
base.OnNavigatedFrom(e);
}
/// <summary>
/// Is called after the RSS feeds are loaded into the eventFeed model.
/// If there was no feed information set to the UI, the feed list

View File

@@ -63,6 +63,7 @@ namespace CampusAppWP8.Pages.Lecture
#region methods
#region protected
/// <summary>
/// Methods overrides the OnNavigatedFrom-Method
/// </summary>

View File

@@ -14,6 +14,7 @@ namespace CampusAppWP8.Pages.Links
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using CampusAppWP8.Utility;
/// <summary>
/// Class for the LinkPage
@@ -66,8 +67,8 @@ namespace CampusAppWP8.Pages.Links
this.InitializeFeeds();
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.loadingFeeds = 2;
this.commonLinkFeed.LoadData();
this.clubLinkFeed.LoadData();
this.commonLinkFeed.LoadData(Utilities.getLoadModus<Model.Link.LinkListModel>());
this.clubLinkFeed.LoadData(Utilities.getLoadModus<Model.Link.LinkListModel>());
}
/// <summary>

View File

@@ -17,6 +17,7 @@ namespace CampusAppWP8.Pages.Mensa
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Utility;
/// <summary>
/// Class for the MensaPage
@@ -176,7 +177,7 @@ namespace CampusAppWP8.Pages.Mensa
}
else
{
this.feed.LoadData();
this.feed.LoadData(Utilities.getLoadModus<Model.Mensa.MenuWeekModel>());
}
}

View File

@@ -15,6 +15,7 @@ namespace CampusAppWP8.Pages.News
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Utility;
/// <summary>
/// Overview page of all news.
@@ -48,7 +49,7 @@ namespace CampusAppWP8.Pages.News
NewsIndexPage.newsFeed.OnLoaded += new NewsFeed.OnIO(this.SetupNewsPageList);
NewsIndexPage.newsFeed.OnFailedWeb += new NewsFeed.OnFailed(this.FeedIsFailWeb);
NewsIndexPage.newsFeed.OnFailedFile += new NewsFeed.OnFailed(this.FeedIsFailFile);
NewsIndexPage.newsFeed.LoadData();
NewsIndexPage.newsFeed.LoadData(Utilities.getLoadModus<Model.RSS.RSSViewModel>());
}
/// <summary>
@@ -88,6 +89,20 @@ namespace CampusAppWP8.Pages.News
base.OnNavigatedTo(e);
}
/// <summary>
/// Methods overrides the OnNavigatedFrom-Method
/// </summary>
/// <param name="e">some NavigationEventArgs</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (NavigationMode.Back == e.NavigationMode)
{
// delete all models
NewsIndexPage.newsFeed.SaveData();
}
base.OnNavigatedFrom(e);
}
/// <summary>
/// Is called after the RSS feeds are loaded into the newsFeed model.
/// If there was no feed information set to the UI, the feed list

View File

@@ -15,6 +15,7 @@ namespace CampusAppWP8.Pages.Openinghours
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using CampusAppWP8.Utility;
/// <summary>
/// Opening hours page.
@@ -51,7 +52,7 @@ namespace CampusAppWP8.Pages.Openinghours
this.feed.OnLoaded += new OpeninghoursFeed.OnIO(this.FeedIsReady);
this.feed.OnFailedWeb += new OpeninghoursFeed.OnFailed(this.FeedIsFailedWeb);
this.feed.OnFailedFile += new OpeninghoursFeed.OnFailed(this.FeedIsFailedFile);
this.feed.LoadData();
this.feed.LoadData(Utilities.getLoadModus<Model.Openinghours.OpeninghoursModel>());
}
this.isNewInstance = true;

View File

@@ -30,12 +30,16 @@
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel>
<StackPanel Grid.Row="0">
<toolkit:ToggleSwitch Name="GeoWatchToggle" Content="{Binding Path=LocalizedResources.Setting_AppGeoWatch, Source={StaticResource LocalizedStrings}}"></toolkit:ToggleSwitch>
</StackPanel>
<StackPanel Grid.Row="1">
<toolkit:ToggleSwitch Name="OnlyWiFiToggle" Content="{Binding Path=LocalizedResources.Setting_AppOnlyWifi, Source={StaticResource LocalizedStrings}}"></toolkit:ToggleSwitch>
</StackPanel>
</Grid>
</Grid>

View File

@@ -22,6 +22,7 @@ namespace CampusAppWP8.Pages.Setting
{
this.InitializeComponent();
GeoWatchToggle.IsChecked = Settings.AppSetting.GeoWatchEnable;
OnlyWiFiToggle.IsChecked = Settings.AppSetting.OnlyWifi;
}
/// <summary>
@@ -33,6 +34,7 @@ namespace CampusAppWP8.Pages.Setting
if (NavigationMode.Back == e.NavigationMode)
{
Settings.AppSetting.GeoWatchEnable = GeoWatchToggle.IsChecked.Value;
Settings.AppSetting.OnlyWifi = OnlyWiFiToggle.IsChecked.Value;
}
}
}

View File

@@ -14,6 +14,7 @@ namespace CampusAppWP8.Pages.StudentCouncil
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using CampusAppWP8.Utility;
/// <summary>
/// Class for the StudentCouncilPage
@@ -59,7 +60,7 @@ namespace CampusAppWP8.Pages.StudentCouncil
}
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.feed.LoadData();
this.feed.LoadData(Utilities.getLoadModus<Model.StudentCouncil.StudentCouncilListModel>());
}
/// <summary>

View File

@@ -771,6 +771,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Nur mit Wlan laden ähnelt.
/// </summary>
public static string Setting_AppOnlyWifi {
get {
return ResourceManager.GetString("Setting_AppOnlyWifi", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Mitarbeiter ähnelt.
/// </summary>

View File

@@ -416,4 +416,7 @@
<data name="TextToSpeech_Btn" xml:space="preserve">
<value>vorlesen</value>
</data>
<data name="Setting_AppOnlyWifi" xml:space="preserve">
<value>Nur mit Wlan laden</value>
</data>
</root>

View File

@@ -87,6 +87,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die OnlyWifi ähnelt.
/// </summary>
public static string AppSetting_OnlyWifi {
get {
return ResourceManager.GetString("AppSetting_OnlyWifi", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die UniNet ähnelt.
/// </summary>
@@ -114,6 +123,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,10 @@
<data name="AppSetting_UniNetworkName" xml:space="preserve">
<value>802.1X</value>
</data>
<data name="AppSetting_WifiEnable" xml:space="preserve">
<value>WifiEnable</value>
</data>
<data name="AppSetting_OnlyWifi" xml:space="preserve">
<value>OnlyWifi</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()
@@ -299,12 +296,47 @@ namespace CampusAppWP8.Utility
if (networkInterfaceInfo.InterfaceType == NetworkInterfaceType.Wireless80211
&& networkInterfaceInfo.InterfaceSubtype == NetworkInterfaceSubType.WiFi
&& networkInterfaceInfo.InterfaceName.Equals(Constants.AppSetting_UniNetworkName)
&& networkInterfaceInfo.Description.Equals(Constants.AppSetting_UniNetworkDesc))
&& networkInterfaceInfo.Description.Equals(Constants.AppSetting_UniNetworkDesc)
&& networkInterfaceInfo.InterfaceState == ConnectState.Connected)
{
return true;
}
}
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
&& networkInterfaceInfo.InterfaceState == ConnectState.Connected)
{
return true;
}
}
return false;
}
/// <summary>Gets load modus. Is check if the only Wifi option is active</summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
/// <typeparam name="T">Generic type parameter.</typeparam>
/// <returns>The load modus&lt; t&gt;</returns>
public static MainModel<T>.ForceType getLoadModus<T>()
{
if (Settings.AppSetting.OnlyWifi && !Settings.AppSetting.WifiEnable)
{
return MainModel<T>.ForceType.FORCE_FILE;
}
else
{
return MainModel<T>.ForceType.INVALID;
}
}
}
}