diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index 6f3bad02..6b976e58 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -224,6 +224,9 @@
+
+ Code
+
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs
index 5c8b4eab..bdd59d24 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs
@@ -24,6 +24,7 @@ namespace CampusAppWP8.Feed.Departments
///
/// Initializes a new instance of the class.
///
+ /// automatic loading of the data
public DepartmentFavoriteFeed(bool autoLoad = true)
: base(ModelType.File, Constants.FileDepartment_Favorite_Name, string.Empty)
{
@@ -45,12 +46,13 @@ namespace CampusAppWP8.Feed.Departments
///
/// Method implement CheckIsModelUpToDate()-Method .
///
+ /// model object
/// true, if model is up-to-date, otherwise false
private bool CheckIsModelUpToDate(DepartmentModel model)
{
bool retValue = true;
- if((model == null)
+ if ((model == null)
|| (model.Faculties == null)
|| (model.Faculties.Count != 1))
{
@@ -63,6 +65,8 @@ namespace CampusAppWP8.Feed.Departments
///
/// Method implement CheckIsFileUpToDate()-Method .
///
+ /// model object
+ /// file info object
/// true, if file is up-to-date, otherwise false
private bool CheckIsFileUpToDate(DepartmentModel model, FileInfo info)
{
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs
index d8b46d93..e967ec95 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs
@@ -7,7 +7,6 @@
//----------------------------------------------------------------------
namespace CampusAppWP8.Feed.Departments
{
- using System;
using System.IO;
using CampusAppWP8.Model;
using CampusAppWP8.Model.Departments;
@@ -24,6 +23,7 @@ namespace CampusAppWP8.Feed.Departments
///
/// Initializes a new instance of the class.
///
+ /// automatic loading of the data
public DepartmentFeed(bool autoLoad = true)
: base(ModelType.FileAndFeed, Constants.FileDepartment_Name, Constants.UrlDepartment_Addr)
{
@@ -46,6 +46,7 @@ namespace CampusAppWP8.Feed.Departments
///
/// Method implement CheckIsModelUpToDate()-Method .
///
+ /// model object
/// true, if model is up-to-date, otherwise false
private bool CheckIsModelUpToDate(DepartmentModel model)
{
@@ -57,12 +58,7 @@ namespace CampusAppWP8.Feed.Departments
}
else
{
- TimeSpan diff = DateTime.Now.Subtract(model.CreateTime);
-
- if (diff.TotalDays >= 7.0)
- {
- retValue = false;
- }
+ retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 7.0);
}
return retValue;
@@ -71,25 +67,24 @@ namespace CampusAppWP8.Feed.Departments
///
/// Method implement CheckIsFileUpToDate()-Method .
///
+ /// model object
+ /// file info object
/// true, if file is up-to-date, otherwise false
private bool CheckIsFileUpToDate(DepartmentModel model, FileInfo info)
{
bool retValue = true;
- if (model == null) // at loading
+ if (model == null)
{
+ // at loading
if (info.Exists == true)
{
- TimeSpan diff = DateTime.Now.Subtract(info.LastWriteTime);
-
- if (diff.TotalDays >= 7.0)
- {
- retValue = false;
- }
+ retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 7.0);
}
}
- else // at saving
+ else
{
+ // at saving
if ((info.Exists == false)
|| (info.Length == 0))
{
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs
index c82949ab..099c8571 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs
@@ -7,37 +7,83 @@
//----------------------------------------------------------------------
namespace CampusAppWP8.Feed.Events
{
+ using System.IO;
+ using CampusAppWP8.Model;
using CampusAppWP8.Model.RSS;
+ using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
///
/// Event Feed.
///
- public class EventFeed : XmlFeed
+ public class EventFeed : XmlModel
{
///
/// Initializes a new instance of the class.
///
- public EventFeed() : base(URLList.EventsFeedURL, "EventFeed.xml")
+ /// automatic loading of the data
+ public EventFeed(bool autoLoad = true)
+ : base(ModelType.FileAndFeed, Constants.FileEvents_Name, Constants.UrlEvents_Addr)
{
+ this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
+
+ if (autoLoad == true)
+ {
+ this.LoadData();
+ }
}
///
/// Method implement CheckIsModelUpToDate()-Method
///
+ /// model object
/// true, if model is up-to-date, otherwise false
- protected override bool CheckIsModelUpToDate()
+ private bool CheckIsModelUpToDate(RSSViewModel model)
{
- return false;
+ bool retValue = true;
+
+ if (model == null)
+ {
+ retValue = false;
+ }
+ else
+ {
+ retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 1.0);
+ }
+
+ return retValue;
}
///
/// Method implement CheckIsFileUpToDate()-Method
///
+ /// model object
+ /// file info object
/// true, if file is up-to-date, otherwise false
- protected override bool CheckIsFileUpToDate()
+ private bool CheckIsFileUpToDate(RSSViewModel model, FileInfo info)
{
- return true;
+ bool retValue = true;
+
+ if (model == null)
+ {
+ // at loading
+ if (info.Exists == true)
+ {
+ retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0);
+ }
+ }
+ else
+ {
+ // at saving
+ if ((info.Exists == false)
+ || (info.Length == 0))
+ {
+ retValue = false;
+ }
+ }
+
+ return retValue;
}
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs
index 652dd442..d6cd0411 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs
@@ -7,39 +7,83 @@
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Feed.News
{
+ using System.IO;
+ using CampusAppWP8.Model;
using CampusAppWP8.Model.RSS;
+ using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
///
/// News Feed.
///
- public class NewsFeed : XmlFeed
+ public class NewsFeed : XmlModel
{
///
/// Initializes a new instance of the class.
///
- public NewsFeed() : base(URLList.NewsFeedURL, "NewsFeed.xml")
+ /// automatic loading of the data
+ public NewsFeed(bool autoLoad = true)
+ : base(ModelType.FileAndFeed, Constants.FileNews_Name, Constants.UrlNews_Addr)
{
-
+ this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
+ if (autoLoad == true)
+ {
+ this.LoadData();
+ }
}
///
/// Method implement CheckIsModelUpToDate()-Method
///
+ /// model object
/// true, if model is up-to-date, otherwise false
- protected override bool CheckIsModelUpToDate()
+ private bool CheckIsModelUpToDate(RSSViewModel model)
{
- return false;
+ bool retValue = true;
+
+ if (model == null)
+ {
+ retValue = false;
+ }
+ else
+ {
+ retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 1.0);
+ }
+
+ return retValue;
}
///
/// Method implement CheckIsFileUpToDate()-Method
///
+ /// model object
+ /// info object of the file
/// true, if file is up-to-date, otherwise false
- protected override bool CheckIsFileUpToDate()
+ private bool CheckIsFileUpToDate(RSSViewModel model, FileInfo info)
{
- return false;
+ bool retValue = true;
+
+ if (model == null)
+ {
+ // at loading
+ if (info.Exists == true)
+ {
+ retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0);
+ }
+ }
+ else
+ {
+ // at saving
+ if ((info.Exists == false)
+ || (info.Length == 0))
+ {
+ retValue = false;
+ }
+ }
+
+ return retValue;
}
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml
index 349a04cc..91c75427 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml
@@ -10,7 +10,7 @@
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
- SupportedOrientations="Portrait" Orientation="Portrait"
+ SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs
index 883d8085..d79cc557 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs
@@ -21,7 +21,7 @@ namespace CampusAppWP8.Pages.Events
///
/// Event Feed object, which contains the RSS models and data.
///
- private static EventFeed eventFeed;
+ private static EventFeed eventFeed = null;
///
/// Initializes a new instance of the class.
@@ -29,18 +29,23 @@ namespace CampusAppWP8.Pages.Events
public EventIndexPage()
{
this.InitializeComponent();
- EventIndexPage.eventFeed = new EventFeed();
+
+ if (EventIndexPage.eventFeed == null)
+ {
+ EventIndexPage.eventFeed = new EventFeed(false);
+ }
+
+ EventIndexPage.eventFeed.onLoaded += new EventFeed.OnLoaded(this.SetupEventPageList);
+ EventIndexPage.eventFeed.LoadData();
}
///
- /// Gets the eventFeed object.
+ /// Return the eventFeed object.
///
- public static EventFeed GetEventFeed
+ /// event feed object
+ public static EventFeed GetEventFeed()
{
- get
- {
- return EventIndexPage.eventFeed;
- }
+ return EventIndexPage.eventFeed;
}
///
@@ -50,22 +55,10 @@ namespace CampusAppWP8.Pages.Events
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
-
- if ((EventIndexPage.eventFeed.Model == null)
- || (EventIndexPage.eventFeed.Model.Channel == null)
- || (EventIndexPage.eventFeed.Model.Channel.Count() == 0)
- || (EventIndexPage.eventFeed.Model.Channel[0].Item == null)
- || (EventIndexPage.eventFeed.Model.Channel[0].Item.Count() == 0))
- {
- // Set handler and load the fees informations.
- EventIndexPage.eventFeed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.SetupEventPageList);
- EventIndexPage.eventFeed.LoadFeed();
- }
}
///
/// 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
/// will be sorted by timestamp and the buttons will be created.
///
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml
index b4ab9f42..0f72f4bf 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml
@@ -11,7 +11,7 @@
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
- SupportedOrientations="Portrait" Orientation="Portrait"
+ SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
index 751f69b6..35882882 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
@@ -5,7 +5,6 @@
// fiedlchr
// 03.05.2013
//-----------------------------------------------------------------------------
-
namespace CampusAppWP8.Pages.Events
{
using System;
@@ -46,13 +45,8 @@ namespace CampusAppWP8.Pages.Events
// Set pivotitem Source
if (this.isSourceSet == false)
{
- if ((EventIndexPage.GetEventFeed.Model != null)
- && (EventIndexPage.GetEventFeed.Model.Channel != null)
- && (EventIndexPage.GetEventFeed.Model.Channel.Count() >= 1))
- {
- this.EventPivot.ItemsSource = EventIndexPage.GetEventFeed.Model.Channel[0].Item;
- this.isSourceSet = true;
- }
+ this.EventPivot.ItemsSource = EventIndexPage.GetEventFeed().Model.Channel[0].Item;
+ this.isSourceSet = true;
}
string pivotIndex = string.Empty;
@@ -63,7 +57,7 @@ namespace CampusAppWP8.Pages.Events
int pivotIndexInt = int.Parse(pivotIndex);
// if the index is in the range of the array
- if ((pivotIndexInt >= 0) && (pivotIndexInt < EventIndexPage.GetEventFeed.Model.Channel[0].Item.Count()))
+ if ((pivotIndexInt >= 0) && (pivotIndexInt < EventIndexPage.GetEventFeed().Model.Channel[0].Item.Count()))
{
EventPivot.SelectedIndex = pivotIndexInt;
}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml
index 9d7ab689..16f279a4 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml
@@ -10,7 +10,7 @@
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
- SupportedOrientations="Portrait" Orientation="Portrait"
+ SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs
index 3eb12db7..a7974800 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs
@@ -21,7 +21,7 @@ namespace CampusAppWP8.Pages.News
///
/// News Feed object, which contains the RSS models and data.
///
- private static NewsFeed newsFeed;
+ private static NewsFeed newsFeed = null;
///
/// Initializes a new instance of the class.
@@ -29,18 +29,23 @@ namespace CampusAppWP8.Pages.News
public NewsIndexPage()
{
this.InitializeComponent();
- NewsIndexPage.newsFeed = new NewsFeed();
+
+ if (NewsIndexPage.newsFeed == null)
+ {
+ NewsIndexPage.newsFeed = new NewsFeed(false);
+ }
+
+ NewsIndexPage.newsFeed.onLoaded += new NewsFeed.OnLoaded(this.SetupNewsPageList);
+ NewsIndexPage.newsFeed.LoadData();
}
///
- /// Gets the newsFeed object.
+ /// Return the newsFeed object.
///
- public static NewsFeed GetNewsFeed
+ /// news feed object
+ public static NewsFeed GetNewsFeed()
{
- get
- {
- return NewsIndexPage.newsFeed;
- }
+ return NewsIndexPage.newsFeed;
}
///
@@ -50,17 +55,6 @@ namespace CampusAppWP8.Pages.News
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
-
- if ((NewsIndexPage.newsFeed.Model == null)
- || (NewsIndexPage.newsFeed.Model.Channel == null)
- || (NewsIndexPage.newsFeed.Model.Channel.Count() == 0)
- || (NewsIndexPage.newsFeed.Model.Channel[0].Item == null)
- || (NewsIndexPage.newsFeed.Model.Channel[0].Item.Count() == 0))
- {
- // Set handler and load the fees informations.
- NewsIndexPage.newsFeed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.SetupNewsPageList);
- NewsIndexPage.newsFeed.LoadFeed();
- }
}
///
diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml
index 0b898115..887d4de0 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml
@@ -11,7 +11,7 @@
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
- SupportedOrientations="Portrait" Orientation="Portrait"
+ 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 10071b16..9454bc7e 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs
@@ -46,14 +46,8 @@ namespace CampusAppWP8.Pages.News
// Set pivotitem Source
if (this.isSourceSet == false)
{
- if ((NewsIndexPage.GetNewsFeed.Model != null)
- && (NewsIndexPage.GetNewsFeed.Model.Channel != null)
- && (NewsIndexPage.GetNewsFeed.Model.Channel.Count() >= 1)
- && (this.NewsPivot.Items.Count() == 0))
- {
- this.NewsPivot.ItemsSource = NewsIndexPage.GetNewsFeed.Model.Channel[0].Item;
- this.isSourceSet = true;
- }
+ this.NewsPivot.ItemsSource = NewsIndexPage.GetNewsFeed().Model.Channel[0].Item;
+ this.isSourceSet = true;
}
string pivotIndex = string.Empty;
@@ -64,7 +58,7 @@ namespace CampusAppWP8.Pages.News
int pivotIndexInt = int.Parse(pivotIndex);
// if the index is in the range of the array
- if ((pivotIndexInt >= 0) && (pivotIndexInt < NewsIndexPage.GetNewsFeed.Model.Channel[0].Item.Count()))
+ if ((pivotIndexInt >= 0) && (pivotIndexInt < NewsIndexPage.GetNewsFeed().Model.Channel[0].Item.Count()))
{
NewsPivot.SelectedIndex = pivotIndexInt;
}
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
index 9e260590..888ded3e 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// Dieser Code wurde von einem Tool generiert.
-// Laufzeitversion:4.0.30319.18051
+// Laufzeitversion:4.0.30319.18046
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
@@ -78,6 +78,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die EventsFeed.xml ähnelt.
+ ///
+ public static string FileEvents_Name {
+ get {
+ return ResourceManager.GetString("FileEvents_Name", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die ClubLinks.xml ähnelt.
///
@@ -114,6 +123,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die NewsFeed.xml ähnelt.
+ ///
+ public static string FileNews_Name {
+ get {
+ return ResourceManager.GetString("FileNews_Name", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die StudentCouncils.xml ähnelt.
///
@@ -411,6 +429,15 @@ 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 http://www.zv.tu-cottbus.de/LSFveranst/LSF4 ähnelt.
///
@@ -465,6 +492,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// 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=studentcouncils&app=2&appversion=1 ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index 8a91912e..3764f24d 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -251,6 +251,8 @@
MensaFeed.xml
+
+ EventsFeed.xml
http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/
@@ -261,4 +263,13 @@
http://www.tu-cottbus.de/campusapp-data/getdata.php?db=openinghours&app=2&appversion=1
+
+ NewsFeed.xml
+
+
+ http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_veranstaltungen.php
+
+
+ http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/model/RSS/RSSChannelModel.cs b/CampusAppWP8/CampusAppWP8/model/RSS/RSSChannelModel.cs
index f09c964b..52c1d499 100644
--- a/CampusAppWP8/CampusAppWP8/model/RSS/RSSChannelModel.cs
+++ b/CampusAppWP8/CampusAppWP8/model/RSS/RSSChannelModel.cs
@@ -18,7 +18,6 @@ namespace CampusAppWP8.Model.RSS
///
/// RSS feed information item list.
///
- [XmlElement("item")]
private ObservableCollection item;
///
@@ -32,6 +31,7 @@ namespace CampusAppWP8.Model.RSS
///
/// Gets or sets the RSS feed item list.
///
+ [XmlElement("item")]
public ObservableCollection Item
{
get
diff --git a/CampusAppWP8/CampusAppWP8/model/RSS/RSSModel.cs b/CampusAppWP8/CampusAppWP8/model/RSS/RSSModel.cs
index a361ecce..725cd074 100644
--- a/CampusAppWP8/CampusAppWP8/model/RSS/RSSModel.cs
+++ b/CampusAppWP8/CampusAppWP8/model/RSS/RSSModel.cs
@@ -16,11 +16,11 @@ namespace CampusAppWP8.Model.RSS
///
public class RSSModel
{
- ///
- /// Gets or sets the ListIndex
+ ///
+ /// Index of this object.
///
- public int Index { get; set; }
-
+ private int index = -1;
+
///
/// Title of the fees
///
@@ -160,7 +160,23 @@ namespace CampusAppWP8.Model.RSS
}
}
}
-
+
+ ///
+ /// Gets or sets the ListIndex.
+ ///
+ public int Index
+ {
+ get
+ {
+ return this.index;
+ }
+
+ set
+ {
+ this.index = value;
+ }
+ }
+
///
/// Comparing function for DateTime timestamps.
/// (currently unused)
diff --git a/CampusAppWP8/CampusAppWP8/model/RSS/RSSViewModel.cs b/CampusAppWP8/CampusAppWP8/model/RSS/RSSViewModel.cs
index f182f1a8..e09a01f0 100644
--- a/CampusAppWP8/CampusAppWP8/model/RSS/RSSViewModel.cs
+++ b/CampusAppWP8/CampusAppWP8/model/RSS/RSSViewModel.cs
@@ -7,6 +7,7 @@
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.RSS
{
+ using System;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
@@ -16,11 +17,14 @@ namespace CampusAppWP8.Model.RSS
[XmlRoot("root")]
public class RSSViewModel
{
+ ///
+ /// Object to store the time when the instance was created.
+ ///
+ private DateTime createTime;
+
///
/// Channel list for the RSS feeds.
///
- [XmlArray("rss")]
- [XmlArrayItem("channel")]
private ObservableCollection channel;
///
@@ -29,11 +33,14 @@ namespace CampusAppWP8.Model.RSS
public RSSViewModel()
{
this.channel = new ObservableCollection();
+ this.createTime = DateTime.Now;
}
///
/// Gets or sets the channel list.
///
+ [XmlArray("rss")]
+ [XmlArrayItem("channel")]
public ObservableCollection Channel
{
get
@@ -49,5 +56,16 @@ namespace CampusAppWP8.Model.RSS
}
}
}
+
+ ///
+ /// Gets the creation time.
+ ///
+ public DateTime CreateTime
+ {
+ get
+ {
+ return this.createTime;
+ }
+ }
}
}
diff --git a/CampusAppWP8/CampusAppWP8/utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/utility/Utilities.cs
new file mode 100644
index 00000000..2c700413
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/utility/Utilities.cs
@@ -0,0 +1,57 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 16.07.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8.Utility
+{
+ using System;
+
+ public static class Utilities
+ {
+ public enum DifferenceType
+ {
+ Equal,
+ Less,
+ LessEqual,
+ Greater,
+ GreaterEqual
+ };
+
+
+ public static bool DayDifference(DifferenceType type, DateTime date, double totalDiff)
+ {
+ bool retValue = false;
+
+ TimeSpan diff = DateTime.Now.Subtract(date);
+
+ if ((DifferenceType.Less == type) || (DifferenceType.LessEqual == type))
+ {
+ if (diff.TotalDays < totalDiff)
+ {
+ retValue = true;
+ }
+ }
+
+ if ((DifferenceType.Greater == type) || (DifferenceType.GreaterEqual == type))
+ {
+ if (diff.TotalDays > totalDiff)
+ {
+ retValue = true;
+ }
+ }
+
+ if ((DifferenceType.Equal == type) || (DifferenceType.LessEqual == type) || (DifferenceType.GreaterEqual == type))
+ {
+ if (diff.TotalDays == totalDiff)
+ {
+ retValue = true;
+ }
+ }
+
+ return retValue;
+ }
+ }
+}
\ No newline at end of file