diff --git a/.gitattributes b/.gitattributes
index ad3aeb41..83a97a87 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -25,6 +25,7 @@
*.csproj -text merge=union
*.sln -text merge=union
*.resx -text merge=union
+*.StyleCop -text merge=union
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
diff --git a/CampusAppWP8/CampusAppW8.sln b/CampusAppWP8/CampusAppW8.sln
index f65bd6ee..479bc0b1 100644
--- a/CampusAppWP8/CampusAppW8.sln
+++ b/CampusAppWP8/CampusAppW8.sln
@@ -11,6 +11,8 @@ Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "IconCreator", "IconCreator\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CampusAppDLL", "CampusAppDLL\CampusAppDLL.csproj", "{E4EC5B95-06FC-4304-97E2-9E3F9B980303}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CampusAppWP8ScheduledTaskAgent", "CampusAppWP8ScheduledTaskAgent\CampusAppWP8ScheduledTaskAgent.csproj", "{2A51FA6C-791B-4935-B869-FDBA9ED774D7}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -139,6 +141,28 @@ Global
{E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|Win32.ActiveCfg = Release|Any CPU
{E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|x64.ActiveCfg = Release|Any CPU
{E4EC5B95-06FC-4304-97E2-9E3F9B980303}.Release|x86.ActiveCfg = Release|Any CPU
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|ARM.ActiveCfg = Debug|ARM
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|ARM.Build.0 = Debug|ARM
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|Win32.ActiveCfg = Debug|x86
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|Win32.Build.0 = Debug|x86
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|x86.ActiveCfg = Debug|x86
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Debug|x86.Build.0 = Debug|x86
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|ARM.ActiveCfg = Release|ARM
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|ARM.Build.0 = Release|ARM
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|Mixed Platforms.Build.0 = Release|x86
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|Win32.ActiveCfg = Release|x86
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|Win32.Build.0 = Release|x86
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|x64.ActiveCfg = Release|Any CPU
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|x86.ActiveCfg = Release|x86
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/PisApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/PisApi.cs
index 2409d10a..958ea718 100644
--- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/PisApi.cs
+++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/PisApi.cs
@@ -12,7 +12,8 @@ namespace CampusAppWP8.Api.GeoApi
using CampusAppWP8.Model;
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Model.Utility;
- using CampusAppWP8.Resources;
+ using CampusAppWP8.Resources;
+ using CampusAppWPortalLib8.Model.Utility;
/// Pis api.
/// Stubbfel, 09.09.2013.
diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/PssApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/PssApi.cs
index b6cb614e..7ff2444c 100644
--- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/PssApi.cs
+++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/PssApi.cs
@@ -13,6 +13,7 @@ namespace CampusAppWP8.Api.GeoApi
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Resources;
+ using CampusAppWPortalLib8.Model.Utility;
/// Pss api.
/// Stubbfel, 09.09.2013.
diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs
index 18d727f7..2a0988ef 100644
--- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs
+++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs
@@ -12,7 +12,8 @@ namespace CampusAppWP8.Api.GeoApi
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Resources;
- using CampusAppWP8.Utility;
+ using CampusAppWP8.Utility;
+ using CampusAppWPortalLib8.Model.Utility;
///
/// Class for SPSAPI
diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index 7fab7caa..5494815e 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -122,7 +122,6 @@
-
@@ -131,7 +130,6 @@
-
Exams.xaml
@@ -145,7 +143,9 @@
ShowPad.xaml
+
+
@@ -178,8 +178,6 @@
-
-
@@ -190,13 +188,10 @@
-
-
-
CampusMapPage.xaml
@@ -249,7 +244,6 @@
NewsPage.xaml
-
OpeninghoursPage.xaml
@@ -275,7 +269,6 @@
-
@@ -287,11 +280,10 @@
QRScanner.xaml
-
+
Code
-
@@ -547,7 +539,16 @@
-
+
+
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}
+ CampusAppWP8ScheduledTaskAgent
+
+
+ {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}
+ CampusAppWPortalLib8
+
+
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
index 03f83d24..685568fa 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
@@ -13,12 +13,12 @@ namespace CampusAppWP8.Pages.Events
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
- using CampusAppWP8.Model.RSS;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Windows.Phone.Speech.Synthesis;
+ using CampusAppWPortalLib8.Model.RSS;
///
/// EventPage, where every event fees has his own PivotItem.
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs
index ee02e75c..37f79f70 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs
@@ -17,6 +17,7 @@ namespace CampusAppWP8.Pages.Lecture
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
+ using CampusAppWPortalLib8.Model.Utility;
///
/// Class for the LecturePage
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
index 66988df9..013edcb0 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
@@ -18,6 +18,7 @@ namespace CampusAppWP8.Pages.Mensa
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
+ using CampusAppWPortalLib8.Model.Mensa;
///
/// Class for the MensaPage
@@ -177,7 +178,7 @@ namespace CampusAppWP8.Pages.Mensa
}
else
{
- this.feed.LoadData(Utilities.GetLoadModus());
+ this.feed.LoadData(Utilities.GetLoadModus());
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs
index 7b5f8e7e..69814293 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs
@@ -16,6 +16,7 @@ namespace CampusAppWP8.Pages.News
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
+ using CampusAppWPortalLib8.Model.RSS;
///
/// Overview page of all news.
@@ -55,7 +56,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(Utilities.GetLoadModus());
+ NewsIndexPage.newsFeed.LoadData(Utilities.GetLoadModus());
}
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml
index 36992213..85e6faf4 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml
@@ -6,17 +6,12 @@
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:viewModel="clr-namespace:CampusAppWP8.Model.RSS"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
-
-
-
-
diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs
index 3565b225..d6ab0753 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs
@@ -13,12 +13,12 @@ namespace CampusAppWP8.Pages.News
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
- using CampusAppWP8.Model.RSS;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Windows.Phone.Speech.Synthesis;
+ using CampusAppWPortalLib8.Model.RSS;
///
/// EventPage, where every news fees has his own PivotItem.
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs
index b95c31e2..289d4ad4 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Person/PersonPage.xaml.cs
@@ -18,6 +18,7 @@ namespace CampusAppWP8.Pages.Person
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
+ using CampusAppWPortalLib8.Model.Utility;
/// Person page.
/// Stubbfel, 09.09.2013.
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs
index 2a5f9a81..a868f4c1 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs
@@ -12,7 +12,7 @@ namespace CampusAppWP8.Pages.Setting
using System.Windows.Navigation;
using CampusAppWP8.Model.Setting;
using CampusAppWP8.Model.Utility;
- using CampusAppWP8.Utility;
+ using CampusAppWPortalLib8.Utility;
using Microsoft.Phone.Controls;
///
diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml
index 2502caf2..7a3c07a2 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml
@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
+ xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
@@ -50,6 +51,12 @@
+
+
+
+
+
+
@@ -57,6 +64,12 @@
+
+
+
+
+
+
@@ -82,6 +95,12 @@
+
+
+
+
+
+
@@ -89,12 +108,18 @@
+
+
+
+
+
+
-
+
@@ -106,13 +131,25 @@
+
+
+
+
+
+
-
+
+
+
+
+
+
+
@@ -120,6 +157,11 @@
+
+
+
+
+
@@ -138,6 +180,12 @@
+
+
+
+
+
+
@@ -145,6 +193,12 @@
+
+
+
+
+
+
@@ -155,6 +209,12 @@
+
+
+
+
+
+
@@ -173,6 +233,12 @@
+
+
+
+
+
+
@@ -180,12 +246,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
index 3bd7cdc6..9f58635d 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
@@ -8,6 +8,7 @@
namespace CampusAppWP8.Pages
{
using System;
+ using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
@@ -19,6 +20,7 @@ namespace CampusAppWP8.Pages
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.File.Places;
+ using CampusAppWP8.Utility.Lui.Tiles;
///
/// Class for the StartPage
@@ -278,6 +280,87 @@ namespace CampusAppWP8.Pages
#endregion
+ private void PintoStart_Click(object sender, RoutedEventArgs e)
+ {
+ FrameworkElement elment = sender as FrameworkElement;
+ if (elment == null)
+ {
+ return;
+ }
+
+ string tagButtonName = elment.Tag as string;
+ if (tagButtonName == null)
+ {
+ return;
+ }
+
+ switch (tagButtonName)
+ {
+ case "MensaAppButton":
+ TileCreator.CreateMensaTile();
+ break;
+ case "MailAppButton":
+ TileCreator.CreateWebMailTile();
+ break;
+ case "NewsAppButton":
+ TileCreator.CreateNewsTile();
+ break;
+ case "LectureAppButton":
+ TileCreator.CreateLectureTile();
+ break;
+ case "EventAppButton":
+ TileCreator.CreateEventTile();
+ break;
+ case "CampusMapAppButton":
+ TileCreator.CreateCampusMapTile();
+ break;
+ case "DepartmentAppButton":
+ TileCreator.CreateDepartmentTile();
+ break;
+ case "OpenHoursAppButton":
+ TileCreator.CreateOpeningHoursTile();
+ break;
+ case "LinkAppButton":
+ TileCreator.CreateLinkTile();
+ break;
+ case "OSAAppButton":
+ TileCreator.CreateStudentCouncilTile();
+ break;
+ case "examinationAppButton":
+ TileCreator.CreateExamsTile();
+ break;
+ case "personAppButton":
+ TileCreator.CreatePersonTile();
+ break;
+ case "placeNewsAppButton":
+ TileCreator.CreatePlaceNewsTile();
+ break;
+ }
+
+ }
+
+ private void PintoStart_Click2(object sender, RoutedEventArgs e)
+ {
+ IconicTileData oIcontile = new IconicTileData();
+ oIcontile.Title = "WebmailPage";
+
+ oIcontile.IconImage = new Uri(Icons.Mensa, UriKind.Relative);
+ oIcontile.SmallIconImage = new Uri(Icons.Mensa, UriKind.Relative);
+
+ // find the tile object for the application tile that using "Iconic" contains string in it.
+ ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("WebmailPage".ToString()));
+
+ if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains("WebmailPage"))
+ {
+ TileToFind.Delete();
+ ShellTile.Create(new Uri(Constants.PathMail_WebMailPage, UriKind.Relative), oIcontile, true);
+ }
+ else
+ {
+ ShellTile.Create(new Uri(Constants.PathMail_WebMailPage, UriKind.Relative), oIcontile, true);
+ }
+ }
+
#endregion
}
}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index 1840f04c..b4a616bb 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -150,6 +150,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Auf Startseite ähnelt.
+ ///
+ public static string ContextMenu_PinToStart {
+ get {
+ return ResourceManager.GetString("ContextMenu_PinToStart", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Bachelor ähnelt.
///
@@ -483,69 +492,6 @@ namespace CampusAppWP8.Resources {
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Aktion ähnelt.
- ///
- public static string MensaApp_Action {
- get {
- return ResourceManager.GetString("MensaApp_Action", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Bio ähnelt.
- ///
- public static string MensaApp_Bio {
- get {
- return ResourceManager.GetString("MensaApp_Bio", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Essen 1 ähnelt.
- ///
- public static string MensaApp_Dinner1 {
- get {
- return ResourceManager.GetString("MensaApp_Dinner1", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Essen 2 ähnelt.
- ///
- public static string MensaApp_Dinner2 {
- get {
- return ResourceManager.GetString("MensaApp_Dinner2", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Essen 3 ähnelt.
- ///
- public static string MensaApp_Dinner3 {
- get {
- return ResourceManager.GetString("MensaApp_Dinner3", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Essen 4 ähnelt.
- ///
- public static string MensaApp_Dinner4 {
- get {
- return ResourceManager.GetString("MensaApp_Dinner4", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Essen 5 ähnelt.
- ///
- public static string MensaApp_Dinner5 {
- get {
- return ResourceManager.GetString("MensaApp_Dinner5", resourceCulture);
- }
- }
-
///
/// Sucht eine lokalisierte Zeichenfolge, die 84 ähnelt.
///
@@ -555,24 +501,6 @@ namespace CampusAppWP8.Resources {
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Heute nicht im Angbot ähnelt.
- ///
- public static string MensaApp_NotToday {
- get {
- return ResourceManager.GetString("MensaApp_NotToday", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Suppe ähnelt.
- ///
- public static string MensaApp_Soup {
- get {
- return ResourceManager.GetString("MensaApp_Soup", resourceCulture);
- }
- }
-
///
/// Sucht eine lokalisierte Zeichenfolge, die Mensaplan ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
index 3fd4d90c..08e76485 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -206,27 +206,6 @@
Mittwoch
-
- Aktion
-
-
- Bio
-
-
- Essen 1
-
-
- Essen 2
-
-
- Essen 3
-
-
- Essen 4
-
-
- Heute nicht im Angbot
-
zur Übersicht
@@ -353,12 +332,6 @@
Semesterauswahl
-
- Essen 5
-
-
- Suppe
-
Ortung
@@ -464,4 +437,7 @@
Beschreibung
+
+ Auf Startseite
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
index 23152345..8bb7086c 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
@@ -1068,15 +1068,6 @@ namespace CampusAppWP8.Resources {
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_veranstaltungen.php ähnelt.
- ///
- public static string UrlEvents_Addr {
- get {
- return ResourceManager.GetString("UrlEvents_Addr", resourceCulture);
- }
- }
-
///
/// Sucht eine lokalisierte Zeichenfolge, die https://www.zv.tu-cottbus.de/CMS-Webservice/Pruefungsordnung/Uebersicht ähnelt.
///
@@ -1122,51 +1113,6 @@ namespace CampusAppWP8.Resources {
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/index.php?mensa=CottbusBTU&v=1 ähnelt.
- ///
- public static string UrlMensa_Week_CBMain {
- get {
- return ResourceManager.GetString("UrlMensa_Week_CBMain", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/index.php?mensa=CottbusBTU&v=1 ähnelt.
- ///
- public static string UrlMensa_Week_CBNorth {
- get {
- return ResourceManager.GetString("UrlMensa_Week_CBNorth", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/index.php?mensa=CottbusHL&v=1 ähnelt.
- ///
- public static string UrlMensa_Week_CBSouth {
- get {
- return ResourceManager.GetString("UrlMensa_Week_CBSouth", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/index.php?mensa=Senftenberg&v=1 ähnelt.
- ///
- public static string UrlMensa_Week_SBFMain {
- get {
- return ResourceManager.GetString("UrlMensa_Week_SBFMain", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php ähnelt.
- ///
- public static string UrlNews_Addr {
- get {
- return ResourceManager.GetString("UrlNews_Addr", resourceCulture);
- }
- }
-
///
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=openinghours&app=2&appversion=1 ähnelt.
///
@@ -1301,14 +1247,5 @@ namespace CampusAppWP8.Resources {
return ResourceManager.GetString("Valid_MaxCourseNumber", resourceCulture);
}
}
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die root ähnelt.
- ///
- public static string XMLRootElementName {
- get {
- return ResourceManager.GetString("XMLRootElementName", resourceCulture);
- }
- }
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index 9c2833fb..2e17a5d2 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -138,9 +138,6 @@
https://www.tu-cottbus.de/modul/
-
- root
-
https://webmail.tu-cottbus.de
@@ -174,9 +171,6 @@
/Pages/Lecture/LecturePage.xaml
-
- /Pages/Events/EventIndexPage.xaml
-
/Pages/Webmail/WebmailPage.xaml
@@ -225,9 +219,6 @@
pivotindex
-
- /Pages/Events/EventPage.xaml
-
/Pages/Links/LinkPage.xaml
@@ -264,12 +255,6 @@
NewsFeed.xml
-
- http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_veranstaltungen.php
-
-
- http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php
-
IsolatedStorage_DepartmentModel
@@ -378,18 +363,6 @@
MensaFeed_SFBMain.xml
-
- http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/index.php?mensa=CottbusBTU&v=1
-
-
- http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/index.php?mensa=CottbusBTU&v=1
-
-
- http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/index.php?mensa=CottbusHL&v=1
-
-
- http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/index.php?mensa=Senftenberg&v=1
-
1
@@ -534,4 +507,10 @@
Kurzname
+
+ /Pages/Events/EventIndexPage.xaml
+
+
+ /Pages/Events/EventPage.xaml
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Settings.StyleCop b/CampusAppWP8/CampusAppWP8/Settings.StyleCop
index cf756198..a049e944 100644
--- a/CampusAppWP8/CampusAppWP8/Settings.StyleCop
+++ b/CampusAppWP8/CampusAppWP8/Settings.StyleCop
@@ -1,26 +1,27 @@
-
-
-
- akadgrad
- api
- apis
- enum
- initialise
- initialises
- ndef
- ndefs
- nfc
- param
- pid
- pids
- pis
- prev
- pss
- Senftenberg
- sps
- Stubbfel
- uni
- wifi
-
-
+
+
+
+ akadgrad
+ api
+ apis
+ enum
+ initialise
+ initialises
+ ndef
+ ndefs
+ nfc
+ param
+ perodic
+ pid
+ pids
+ pis
+ prev
+ pss
+ Senftenberg
+ sps
+ Stubbfel
+ uni
+ wifi
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Utility/BackgroundTasks.cs b/CampusAppWP8/CampusAppWP8/Utility/BackgroundTasks.cs
new file mode 100644
index 00000000..76acf9d1
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/BackgroundTasks.cs
@@ -0,0 +1,125 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 18.09.2013
+//----------------------------------------------------------------------
+
+namespace CampusAppWP8.Utility
+{
+ using System;
+ using CampusAppWP8ScheduledTaskAgent.Resources;
+ using CampusAppWPortalLib8.Utility;
+ using Microsoft.Phone.Scheduler;
+
+ ///
+ /// Class provide some static methods for background tasks
+ ///
+ public class BackgroundTasks : AbstractBackgroundTasks
+ {
+ ///
+ /// Method start a certain PerodicTask
+ ///
+ /// name of the task
+ /// description of the task
+ public static void StartPerodicTask(string taskName, string taskDesc)
+ {
+ BackgroundTasks.StopPerodicTask(BackgroundTasks.LastAddedTaskName);
+ BackgroundTasks.StopPerodicTask(taskName);
+
+ PeriodicTask periodicTask = new PeriodicTask(taskName);
+
+ // load description from localized strings
+ periodicTask.Description = taskDesc;
+
+ try
+ {
+ ScheduledActionService.Add(periodicTask);
+
+ // ScheduledActionService.LaunchForTest(taskName, new TimeSpan(10));
+ }
+ catch (Exception e)
+ {
+ Logger.LogException(e);
+ return;
+ }
+
+ BackgroundTasks.LastAddedTaskName = taskName;
+ }
+
+ ///
+ /// Method stop a certain PerodicTask
+ ///
+ /// name of the task
+ public static void StopPerodicTask(string taskName)
+ {
+ if (taskName == null)
+ {
+ return;
+ }
+
+ PeriodicTask periodicTask = ScheduledActionService.Find(taskName) as PeriodicTask;
+ if (periodicTask != null)
+ {
+ try
+ {
+ ScheduledActionService.Remove(taskName);
+ }
+ catch (Exception e)
+ {
+ Logger.LogException(e);
+ }
+ }
+ }
+
+ ///
+ /// Method start MensaBackgroundTask
+ ///
+ public static void StartMensaTask()
+ {
+ int campusId = (int)Settings.UserProfil.DefaultCampus;
+ BackgroundTasks.StartPerodicTask(Constants.BackgroundTask_Mensa, AppResources.BackGroundTaskDesc_Mensa + " - Feed " + campusId);
+ }
+
+ ///
+ /// Method stop MensaBackgroundTask
+ ///
+ public static void StopMensaTask()
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Mensa);
+ }
+
+ ///
+ /// Method start EventBackgroundTask
+ ///
+ public static void StartEventTask()
+ {
+ BackgroundTasks.StartPerodicTask(Constants.BackgroundTask_Event, AppResources.BackGroundTaskDesc_Event);
+ }
+
+ ///
+ /// Method stop EventBackgroundTask
+ ///
+ public static void StopEventTask()
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Event);
+ }
+
+ ///
+ /// Method start NewsBackgroundTask
+ ///
+ public static void StartNewsTask()
+ {
+ BackgroundTasks.StartPerodicTask(Constants.BackgroundTask_News, AppResources.BackGroundTaskDesc_News);
+ }
+
+ ///
+ /// Method stop NewsBackgroundTask
+ ///
+ public static void StopNewsTask()
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_News);
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/File.cs b/CampusAppWP8/CampusAppWP8/Utility/File.cs
index 7905b1d9..d49ee632 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/File.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/File.cs
@@ -11,6 +11,7 @@ namespace CampusAppWP8.Utility
using System.IO;
using System.Threading;
using System.Threading.Tasks;
+ using CampusAppWPortalLib8.Utility;
using Windows.Storage;
///
diff --git a/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs b/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs
index e8cd4db7..2d3b73c1 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs
@@ -11,6 +11,7 @@ namespace CampusAppWP8.Utility
using System.Collections.Generic;
using System.Net;
using CampusAppWP8.Model.Utility;
+ using CampusAppWPortalLib8.Model.Utility;
///
/// Class realize the access of restful HttpRequest
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Logger.cs b/CampusAppWP8/CampusAppWP8/Utility/Logger.cs
deleted file mode 100644
index 4416a3b4..00000000
--- a/CampusAppWP8/CampusAppWP8/Utility/Logger.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-//--------------------------------------------------------------------
-//
-// Company copyright tag.
-//
-// stubbfel
-// 03.05.2013
-//----------------------------------------------------------------------
-namespace CampusAppWP8.Utility
-{
- using System;
-
- ///
- /// This Class creates logs for the app
- ///
- public class Logger
- {
- #region Method
-
- ///
- /// Method log a Exception
- ///
- /// exception which has to log
- public static void LogException(Exception exception)
- {
- Console.WriteLine(exception);
- }
-
- ///
- /// Log a message.
- ///
- /// to be logged message
- public static void LogMsg(string msg)
- {
- Console.WriteLine(msg);
- }
-
- #endregion
- }
-}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs
new file mode 100644
index 00000000..f393a002
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs
@@ -0,0 +1,166 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 18.09.2013
+//----------------------------------------------------------------------
+
+namespace CampusAppWP8.Utility.Lui.Tiles
+{
+ using System;
+ using System.Linq;
+ using CampusAppWP8.Resources;
+ using Microsoft.Phone.Shell;
+
+ ///
+ /// Class creates different live tiles
+ ///
+ public class TileCreator
+ {
+ ///
+ /// Method creates an IconicTile
+ ///
+ /// title of the tile
+ /// path the the page
+ /// icon url of the main icon
+ /// icon url of the small icon
+ /// string for the wide content 1
+ /// string for the wide content 2
+ /// string for the wide content 3
+ public static void CreateIconicTile(string title, string path, string iconUrl, string smallIcon, string wideContent1 = null, string wideContent2 = null, string wideContent3 = null)
+ {
+ IconicTileData iconTile = new IconicTileData();
+ iconTile.Title = title;
+ iconTile.WideContent1 = wideContent1;
+ iconTile.WideContent2 = wideContent2;
+ iconTile.WideContent3 = wideContent3;
+
+ iconTile.IconImage = new Uri(iconUrl, UriKind.Relative);
+ iconTile.SmallIconImage = new Uri(smallIcon, UriKind.Relative);
+
+ // find the tile object for the application tile that using "Iconic" contains string in it.
+ ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(path));
+
+ if (tileToFind != null && tileToFind.NavigationUri.ToString().Contains(path))
+ {
+ tileToFind.Delete();
+ }
+
+ ShellTile.Create(new Uri(path, UriKind.Relative), iconTile, true);
+ }
+
+ ///
+ /// Method creates the MensaTile
+ ///
+ public static void CreateMensaTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.MensaApp_Title, Constants.PathMensa_MensaPage, Icons.Mensa, Icons.Mensa);
+
+ // create a new task
+ BackgroundTasks.StartMensaTask();
+ }
+
+ ///
+ /// Method creates the MailTile
+ ///
+ public static void CreateWebMailTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.MailApp_Title, Constants.PathMail_WebMailPage, Icons.WebMail, Icons.WebMail);
+ }
+
+ ///
+ /// Method creates the NewsTile
+ ///
+ public static void CreateNewsTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.NewsApp_Title, Constants.PathNews_NewsIndexPage, Icons.News, Icons.News);
+
+ // create a new Task
+ BackgroundTasks.StartNewsTask();
+ }
+
+ ///
+ /// Method creates the LectureTile
+ ///
+ public static void CreateLectureTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.LectureApp_Title, Constants.PathLecture_LecturePage, Icons.Lectures, Icons.Lectures);
+ }
+
+ ///
+ /// Method creates the EventTile
+ ///
+ public static void CreateEventTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.EventApp_Title, Constants.PathEvents_EventsIndexPage, Icons.News, Icons.News);
+
+ // create a new taskk
+ BackgroundTasks.StartEventTask();
+ }
+
+ ///
+ /// Method creates the DepartmentTile
+ ///
+ public static void CreateDepartmentTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.DepartmentApp_Title, Constants.PathDepartment_DepartmentIndexPage, Icons.Departments, Icons.Departments);
+ }
+
+ ///
+ /// Method creates the OpeningHoursTile
+ ///
+ public static void CreateOpeningHoursTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.OpenHoursApp_Title, Constants.PathOpeninghours_OpeninghoursPage, Icons.Openhours, Icons.Openhours);
+ }
+
+ ///
+ /// Method creates the linkTile
+ ///
+ public static void CreateLinkTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.LinkApp_Title, Constants.PathLinks_LinkPage, Icons.Link, Icons.Link);
+ }
+
+ ///
+ /// Method creates the StudentCouncilTile
+ ///
+ public static void CreateStudentCouncilTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.OSAApp_Title, Constants.PathStudentCouncil_StudentCouncilPage, Icons.StudentCouncil, Icons.StudentCouncil);
+ }
+
+ ///
+ /// Method creates the ExamsTile
+ ///
+ public static void CreateExamsTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.ExaminationApp_Header, Constants.PathExams_ExamsPage, Icons.Exams, Icons.Exams);
+ }
+
+ ///
+ /// Method creates the PersonTile
+ ///
+ public static void CreatePersonTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.PersonApp_Title, Constants.PathPerson_Person, Icons.Person, Icons.Person);
+ }
+
+ ///
+ /// Method creates the PlaceNewsTile
+ ///
+ public static void CreatePlaceNewsTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.PlaceNewsApp_Title, Constants.PathPlaceNews_PlaceNewsPage, Icons.News, Icons.News);
+ }
+
+ ///
+ /// Method creates the CampusMapTile
+ ///
+ public static void CreateCampusMapTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.CampusMapApp_Title, Constants.PathCampusmap_Campusmap, Icons.Campus, Icons.Campus);
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs
index 1f67154c..b70ca222 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs
@@ -17,6 +17,7 @@ namespace CampusAppWP8.Utility
using System.Windows.Media;
using CampusAppWP8.Resources;
using Microsoft.Phone.Net.NetworkInformation;
+ using CampusAppWPortalLib8.Utility;
///
/// Collection of utility functions.
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Wp8StringManager.cs b/CampusAppWP8/CampusAppWP8/Utility/Wp8StringManager.cs
new file mode 100644
index 00000000..f8c57b83
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/Wp8StringManager.cs
@@ -0,0 +1,29 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 06.06.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Utility
+{
+ using System;
+ using System.Text.RegularExpressions;
+ using CampusAppWP8.Resources;
+
+ ///
+ /// Class provides some special StringMethods
+ ///
+ public class Wp8StringManager : CampusAppWPortalLib8.Utility.DefaultStringManager
+ {
+ ///
+ /// Method removes Html-Tag of a String
+ ///
+ /// String with Html-Tags
+ /// String without Html-Tags
+ public static string StripAndDecodeHTML(string inputString)
+ {
+ return System.Net.HttpUtility.HtmlDecode(Wp8StringManager.StripHTML(inputString));
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/XmlManager.cs b/CampusAppWP8/CampusAppWP8/Utility/XmlManager.cs
deleted file mode 100644
index 118e8a11..00000000
--- a/CampusAppWP8/CampusAppWP8/Utility/XmlManager.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Company copyright tag.
-//
-// stubbfel
-// 18.06.2013
-//----------------------------------------------------------------------
-namespace CampusAppWP8.Utility
-{
- using System.IO;
- using System.Xml.Linq;
- using System.Xml.Serialization;
-
- ///
- /// Class provides some Xml-methods
- ///
- public class XmlManager
- {
- #region Method
-
- ///
- /// Method deserialization a string to a Model
- ///
- /// the model
- /// the XmlString
- /// name of the RootTag
- /// return the deserialization of the model
- public static T DeserializationToModel(string xmlString, string validRootName)
- {
- XmlSerializer serializer = new XmlSerializer(typeof(T));
- XDocument document = XDocument.Parse(xmlString);
- if (!document.Root.Name.ToString().Equals(validRootName))
- {
- XElement content = document.Root;
- document = new XDocument();
- document.Add(new XElement(validRootName, content));
- }
-
- T model = (T)serializer.Deserialize(document.CreateReader());
- return model;
- }
-
- /// Deserialization a xml file to a model.
- /// Stubbfel, 20.08.2013.
- /// Generic type parameter.
- /// Path to the a XmlFile.
- /// model of the XmlFile.
- public static T DeserializationFileToModel(string xmlFilePath)
- {
- XmlSerializer serializer = new XmlSerializer(typeof(T));
- XDocument document = XDocument.Load(xmlFilePath);
- T model = (T)serializer.Deserialize(document.CreateReader());
- return model;
- }
-
- /// Method serializes a model to a string.
- /// Stubbfel, 12.09.2013.
- /// type of the model.
- /// model object.
- /// serialized string.
- public static string SerializationToString(T model)
- {
- string retValue = string.Empty;
-
- XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
- ns.Add(string.Empty, string.Empty);
-
- XmlSerializer serializer = new XmlSerializer(typeof(T));
- TextWriter writer = new StringWriter();
-
- serializer.Serialize(writer, model, ns);
-
- retValue = writer.ToString();
-
- if (retValue.StartsWith("");
- retValue = retValue.Substring(endTag + 2);
-
- if (retValue.StartsWith("\r\n") == true)
- {
- retValue = retValue.Substring(2);
- }
- }
-
- return retValue;
- }
-
- #endregion
- }
-}
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/CampusAppWP8ScheduledTaskAgent.csproj b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/CampusAppWP8ScheduledTaskAgent.csproj
new file mode 100644
index 00000000..8f6f7018
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/CampusAppWP8ScheduledTaskAgent.csproj
@@ -0,0 +1,133 @@
+
+
+
+ Debug
+ AnyCPU
+ 10.0.20506
+ 2.0
+ {2A51FA6C-791B-4935-B869-FDBA9ED774D7}
+ {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
+ Library
+ Properties
+ CampusAppWP8ScheduledTaskAgent
+ CampusAppWP8ScheduledTaskAgent
+ WindowsPhone
+ v8.0
+ $(TargetFrameworkVersion)
+ false
+ true
+ true
+ 11.0
+ AgentLibrary
+
+
+ true
+ full
+ false
+ Bin\Debug
+ DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ Bin\Release
+ TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
+
+
+ true
+ full
+ false
+ Bin\x86\Debug
+ DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ Bin\x86\Release
+ TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
+
+
+ true
+ full
+ false
+ Bin\ARM\Debug
+ DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ Bin\ARM\Release
+ TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
+
+
+
+ AppResources.resx
+ True
+ True
+
+
+ True
+ True
+ Constants.resx
+
+
+
+
+
+
+
+
+ PublicResXFileCodeGenerator
+ AppResources.Designer.cs
+ Designer
+
+
+ Designer
+ Constants1.Designer.cs
+ PublicResXFileCodeGenerator
+
+
+
+
+
+
+
+ {67D80BE2-0FB7-44C8-A495-7D44FC2AC262}
+ CampusAppWPortalLib8
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Properties/AssemblyInfo.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..b1d78706
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Properties/AssemblyInfo.cs
@@ -0,0 +1,37 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Resources;
+
+// Allgemeine Informationen über eine Assembly werden über die folgende
+// Attributgruppe gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
+// die einer Assembly zugeordnet sind.
+[assembly: AssemblyTitle("CampusAppWP8ScheduledTaskAgent")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("CampusAppWP8ScheduledTaskAgent")]
+[assembly: AssemblyCopyright("Copyright © 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly
+// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
+// COM aus zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
+[assembly: ComVisible(false)]
+
+// Die folgende GUID ist für die ID der typelib, wenn dieses Projekt für COM verfügbar gemacht wird
+[assembly: Guid("2a51fa6c-791b-4935-b869-fdba9ed774d7")]
+
+// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
+//
+// Hauptversion
+// Nebenversion
+// Buildnummer
+// Revision
+//
+// Sie können alle Werte angeben oder die Standardwerte für Revisions- und Buildnummer verwenden
+// übernehmen, indem Sie "*" wie folgt verwenden:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: NeutralResourcesLanguageAttribute("de-DE")]
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.Designer.cs
new file mode 100644
index 00000000..e4e6fcca
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.Designer.cs
@@ -0,0 +1,99 @@
+//------------------------------------------------------------------------------
+//
+// Dieser Code wurde von einem Tool generiert.
+// Laufzeitversion:4.0.30319.18051
+//
+// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
+// der Code erneut generiert wird.
+//
+//------------------------------------------------------------------------------
+
+namespace CampusAppWP8ScheduledTaskAgent.Resources {
+ using System;
+
+
+ ///
+ /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
+ ///
+ // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
+ // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
+ // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
+ // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class AppResources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal AppResources() {
+ }
+
+ ///
+ /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CampusAppWP8ScheduledTaskAgent.Resources.AppResources", typeof(AppResources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
+ /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Hintergrunddienst für die BTU-Event-Feed ähnelt.
+ ///
+ public static string BackGroundTaskDesc_Event {
+ get {
+ return ResourceManager.GetString("BackGroundTaskDesc_Event", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Hintergrunddienst für die BTU-Mensa ähnelt.
+ ///
+ public static string BackGroundTaskDesc_Mensa {
+ get {
+ return ResourceManager.GetString("BackGroundTaskDesc_Mensa", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Hintergrunddienst für die BTU-News-Feed ähnelt.
+ ///
+ public static string BackGroundTaskDesc_News {
+ get {
+ return ResourceManager.GetString("BackGroundTaskDesc_News", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Die Mensa ist heute geschlossen ähnelt.
+ ///
+ public static string MensaApp_CloseMensa {
+ get {
+ return ResourceManager.GetString("MensaApp_CloseMensa", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.resx
new file mode 100644
index 00000000..eeaa3432
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.resx
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Hintergrunddienst für die BTU-Mensa
+
+
+ Hintergrunddienst für die BTU-Event-Feed
+
+
+ Hintergrunddienst für die BTU-News-Feed
+
+
+ Die Mensa ist heute geschlossen
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants.resx
new file mode 100644
index 00000000..e71129ca
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants.resx
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ MensaTask
+
+
+ EventTask
+
+
+ NewsTask
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants1.Designer.cs
new file mode 100644
index 00000000..e475252a
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants1.Designer.cs
@@ -0,0 +1,90 @@
+//------------------------------------------------------------------------------
+//
+// Dieser Code wurde von einem Tool generiert.
+// Laufzeitversion:4.0.30319.18051
+//
+// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
+// der Code erneut generiert wird.
+//
+//------------------------------------------------------------------------------
+
+namespace CampusAppWP8ScheduledTaskAgent.Resources {
+ using System;
+
+
+ ///
+ /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
+ ///
+ // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
+ // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
+ // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
+ // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class Constants {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Constants() {
+ }
+
+ ///
+ /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CampusAppWP8ScheduledTaskAgent.Resources.Constants", typeof(Constants).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
+ /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die EventTask ähnelt.
+ ///
+ public static string BackgroundTask_Event {
+ get {
+ return ResourceManager.GetString("BackgroundTask_Event", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die MensaTask ähnelt.
+ ///
+ public static string BackgroundTask_Mensa {
+ get {
+ return ResourceManager.GetString("BackgroundTask_Mensa", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die NewsTask ähnelt.
+ ///
+ public static string BackgroundTask_News {
+ get {
+ return ResourceManager.GetString("BackgroundTask_News", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs
new file mode 100644
index 00000000..597e72cb
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs
@@ -0,0 +1,373 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 18.09.2013
+//----------------------------------------------------------------------
+
+namespace CampusAppWP8ScheduledTaskAgent
+{
+ using System;
+ using System.Diagnostics;
+ using System.Globalization;
+ using System.Linq;
+ using System.Windows;
+ using CampusAppWP8ScheduledTaskAgent.Resources;
+ using CampusAppWP8ScheduledTaskAgent.Utility;
+ using CampusAppWPortalLib8.Model.Mensa;
+ using CampusAppWPortalLib8.Model.RSS;
+ using CampusAppWPortalLib8.Utility;
+ using Microsoft.Phone.Scheduler;
+ using Microsoft.Phone.Shell;
+
+ ///
+ /// Class for agent of the BackgroundTask
+ ///
+ public class ScheduledAgent : ScheduledTaskAgent
+ {
+ #region Member
+
+ ///
+ /// Model for the mensa feed
+ ///
+ private MenuWeekModel mensaModel;
+
+ ///
+ /// Model for the event feed
+ ///
+ private RSSViewModel eventModel;
+
+ ///
+ /// Model for the news feed
+ ///
+ private RSSViewModel newsModel;
+
+ #endregion
+
+ #region Constructor
+
+ ///
+ /// Initializes static members of the class.
+ ///
+ static ScheduledAgent()
+ {
+ Deployment.Current.Dispatcher.BeginInvoke(delegate
+ {
+ Application.Current.UnhandledException += UnhandledException;
+ });
+ }
+
+ #endregion
+
+ #region Method
+
+ #region protected
+
+ ///
+ /// override OnInvoke
+ ///
+ /// the background Task
+ protected override void OnInvoke(ScheduledTask task)
+ {
+ switch (task.Name)
+ {
+ case "MensaTask":
+ this.HandleMensaTask(task);
+ break;
+
+ case "EventTask":
+ this.HandleEventTask(task);
+ break;
+
+ case "NewsTask":
+ this.HandleNewsTask(task);
+ break;
+ }
+ }
+
+ #endregion
+
+ #region private
+
+ ///
+ /// Method handle UnhandledException
+ ///
+ /// sender of Exception
+ /// Exception Args
+ private static void UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
+ {
+ if (Debugger.IsAttached)
+ {
+ Debugger.Break();
+ }
+ }
+
+ ///
+ /// Method handle the EventBackgroundTask
+ ///
+ /// the eventTask
+ private void HandleEventTask(ScheduledTask task)
+ {
+ if (this.eventModel == null || !this.CheckRssIsUpToDate(this.eventModel.CreateTime))
+ {
+ HttpRequest api = new HttpRequest();
+ Uri url = new Uri(CampusAppWPortalLib8.Resources.Constants.UrlEvents_Addr, UriKind.Absolute);
+ api.HttpGet(url, this.GetEventIsReady);
+ }
+ else
+ {
+ this.UpdateEventTile();
+ }
+ }
+
+ ///
+ /// Method handle the NewsBackgroundTask
+ ///
+ /// the newsTask
+ private void HandleNewsTask(ScheduledTask task)
+ {
+ if (this.newsModel == null || !this.CheckRssIsUpToDate(this.newsModel.CreateTime))
+ {
+ HttpRequest api = new HttpRequest();
+ Uri url = new Uri(CampusAppWPortalLib8.Resources.Constants.UrlNews_Addr, UriKind.Absolute);
+ api.HttpGet(url, this.GetNewsIsReady);
+ }
+ else
+ {
+ this.UpdateNewsTile();
+ }
+ }
+
+ ///
+ /// ResponseHandler for the EventFeed
+ ///
+ /// sender of the Event
+ /// Event Args
+ private void GetEventIsReady(object sender, System.Net.DownloadStringCompletedEventArgs arg)
+ {
+ if (arg.Result != null)
+ {
+ this.eventModel = XmlManager.DeserializationToModel(arg.Result, CampusAppWPortalLib8.Resources.Constants.XMLRootElementName);
+ this.UpdateEventTile();
+ }
+ }
+
+ ///
+ /// ResponseHandler for the NewsFeed
+ ///
+ /// sender of the Event
+ /// Event Args
+ private void GetNewsIsReady(object sender, System.Net.DownloadStringCompletedEventArgs arg)
+ {
+ if (arg.Result != null)
+ {
+ this.newsModel = XmlManager.DeserializationToModel(arg.Result, CampusAppWPortalLib8.Resources.Constants.XMLRootElementName);
+ this.UpdateNewsTile();
+ }
+ }
+
+ ///
+ /// Method update the NewsTile
+ ///
+ private void UpdateNewsTile()
+ {
+ ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathNews_NewsIndexPage));
+
+ if (tileToFind != null && tileToFind.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathNews_NewsIndexPage))
+ {
+ IconicTileData data = new IconicTileData();
+ Random random = new Random();
+ int randomNumber = random.Next(0, this.newsModel.Channel[0].Item.Count);
+ RSSModel item = this.newsModel.Channel[0].Item[randomNumber];
+ data.WideContent1 = item.Date;
+ data.WideContent2 = DefaultStringManager.ToShortString(item.Title, 40, "...");
+ data.WideContent3 = DefaultStringManager.ToShortString(item.Text, 40, "...");
+ data.Count = this.newsModel.Channel[0].Item.Count;
+ tileToFind.Update(data);
+ }
+ else
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_News);
+ }
+
+ this.NotifyComplete();
+ }
+
+ ///
+ /// Method update the EventTile
+ ///
+ private void UpdateEventTile()
+ {
+ ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathEvents_EventsIndexPage));
+
+ if (tileToFind != null && tileToFind.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathEvents_EventsIndexPage))
+ {
+ IconicTileData data = new IconicTileData();
+ Random random = new Random();
+ int randomNumber = random.Next(0, this.eventModel.Channel[0].Item.Count);
+ RSSModel item = this.eventModel.Channel[0].Item[randomNumber];
+ data.WideContent1 = item.Date;
+ data.WideContent2 = DefaultStringManager.ToShortString(item.Title, 40, "...");
+ data.WideContent3 = DefaultStringManager.ToShortString(item.Text, 40, "...");
+ data.Count = this.eventModel.Channel[0].Item.Count;
+ tileToFind.Update(data);
+ }
+ else
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Event);
+ }
+
+ this.NotifyComplete();
+ }
+
+ ///
+ /// Determine the correct MensaFeed/Url
+ ///
+ /// the Description of the MensaTask
+ /// Url of a mensa, which is set is in the UserProfile
+ private Uri CalcMensaUrl(string mensaTaskDesc)
+ {
+ Uri url;
+ char feedNumber = mensaTaskDesc[mensaTaskDesc.Length - 1];
+
+ switch (feedNumber)
+ {
+ case '1':
+ url = new Uri(CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_CBMain, UriKind.Absolute);
+ break;
+ case '2':
+ url = new Uri(CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_CBSouth, UriKind.Absolute);
+ break;
+ case '3':
+ url = new Uri(CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_SBFMain, UriKind.Absolute);
+ break;
+ case '4':
+ url = new Uri(CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_CBMain, UriKind.Absolute);
+ break;
+ default:
+ url = new Uri(CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_CBMain, UriKind.Absolute);
+ break;
+ }
+
+ return url;
+ }
+
+ ///
+ /// Method handle the MensaBackgroundTask
+ ///
+ /// the newsTask
+ private void HandleMensaTask(ScheduledTask task)
+ {
+ if (this.mensaModel == null || !this.CheckMensaIsUpToDate(this.mensaModel.CreateTime))
+ {
+ HttpRequest api = new HttpRequest();
+ Uri url = this.CalcMensaUrl(task.Description);
+ api.HttpGet(url, this.GetMensaIsReady);
+ }
+ else
+ {
+ this.UpdateMensaTile();
+ }
+ }
+
+ ///
+ /// ResponseHandler for the MensaFeed
+ ///
+ /// sender of the Event
+ /// Event Args
+ private void GetMensaIsReady(object sender, System.Net.DownloadStringCompletedEventArgs arg)
+ {
+ if (arg.Result != null)
+ {
+ this.mensaModel = XmlManager.DeserializationToModel(arg.Result, CampusAppWPortalLib8.Resources.Constants.XMLRootElementName);
+ this.UpdateMensaTile();
+ }
+ }
+
+ ///
+ /// Method update the NewsTile
+ ///
+ private void UpdateMensaTile()
+ {
+ ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathMensa_MensaPage));
+
+ if (tileToFind != null && tileToFind.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathMensa_MensaPage))
+ {
+ IconicTileData data = new IconicTileData();
+ DateTime now = DateTime.Now;
+ int dayIndex = (int)DateTime.Now.DayOfWeek;
+ data.WideContent1 = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[dayIndex];
+ data.WideContent2 = now.Date.ToShortDateString();
+ if (dayIndex == 0 || dayIndex > this.mensaModel.Menus.Count)
+ {
+ data.WideContent3 = AppResources.MensaApp_CloseMensa;
+ }
+ else
+ {
+ // correct index (week sart with monday not sunday
+ dayIndex--;
+ int mealCount = this.mensaModel.Menus[dayIndex].Meals.Count;
+ if (mealCount < 1)
+ {
+ data.WideContent3 = AppResources.MensaApp_CloseMensa;
+ }
+ else
+ {
+ Random random = new Random();
+ int randomNumber = random.Next(0, mealCount);
+ MealModel meal = this.mensaModel.Menus[dayIndex].Meals[randomNumber];
+ data.WideContent3 = meal.MealName + ": " + DefaultStringManager.ToShortString(meal.MealDesc, 30, "...");
+ data.Count = this.mensaModel.Menus[dayIndex].Meals.Count;
+ }
+ }
+
+ tileToFind.Update(data);
+ }
+ else
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Mensa);
+ }
+
+ this.NotifyComplete();
+ }
+
+ ///
+ /// Check if the model of the mensa is up-to-date
+ ///
+ /// Date of the last modification
+ /// true, if it is up-to-date, otherwise false
+ private bool CheckMensaIsUpToDate(DateTime lastModified)
+ {
+ int diff = lastModified.CompareTo(MenuWeekModel.CalcFirstWeekDay());
+
+ if (diff < 0)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ ///
+ /// Check if the model of the RSS feed is up-to-date
+ ///
+ /// Date of the last modification
+ /// true, if it is up-to-date, otherwise false
+ private bool CheckRssIsUpToDate(DateTime lastModified)
+ {
+ int diff = lastModified.CompareTo(DateTime.Now.AddDays(1));
+
+ if (diff < 0)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ #endregion
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Settings.StyleCop b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Settings.StyleCop
new file mode 100644
index 00000000..6e72570c
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Settings.StyleCop
@@ -0,0 +1,7 @@
+
+
+
+ perodic
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/BackgroundTasks.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/BackgroundTasks.cs
new file mode 100644
index 00000000..26963480
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/BackgroundTasks.cs
@@ -0,0 +1,40 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 18.09.2013
+//----------------------------------------------------------------------
+
+namespace CampusAppWP8ScheduledTaskAgent.Utility
+{
+ using System;
+ using CampusAppWPortalLib8.Utility;
+ using Microsoft.Phone.Scheduler;
+
+ ///
+ /// Class provide some static methods for background tasks
+ ///
+ public class BackgroundTasks : AbstractBackgroundTasks
+ {
+ ///
+ /// Method stop a certain PerodicTask
+ ///
+ /// name of the task
+ public static void StopPerodicTask(string taskName)
+ {
+ PeriodicTask periodicTask = ScheduledActionService.Find(taskName) as PeriodicTask;
+ if (periodicTask != null)
+ {
+ try
+ {
+ ScheduledActionService.Remove(taskName);
+ }
+ catch (Exception e)
+ {
+ Logger.LogException(e);
+ }
+ }
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/HttpRequest.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/HttpRequest.cs
new file mode 100644
index 00000000..2c558936
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/HttpRequest.cs
@@ -0,0 +1,55 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 10.06.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8ScheduledTaskAgent.Utility
+{
+ using System;
+ using System.Net;
+ using CampusAppWPortalLib8.Utility;
+
+ ///
+ /// Class realize the access of restful HttpRequest
+ ///
+ public class HttpRequest : AbstractHttpRequest
+ {
+ #region Constructor
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public HttpRequest()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// the url of the HttpRequest base address
+ public HttpRequest(Uri apiBaseAddress)
+ {
+ this.BaseAddress = apiBaseAddress.AbsoluteUri;
+ }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ /// Method realize the http-get-method resource
+ ///
+ /// Url of the resource
+ /// callback method
+ public void HttpGet(Uri url, Action