rrefactor linkpage
This commit is contained in:
@@ -8,14 +8,15 @@
|
||||
namespace CampusAppWP8.Feed.Link
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Link;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for ClubLinkFeeds
|
||||
/// </summary>
|
||||
public class ClubLinkFeed : XmlFeed<LinkListModel>
|
||||
public class ClubLinkFeed : XmlModel<LinkListModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
@@ -23,8 +24,10 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// Initializes a new instance of the <see cref="ClubLinkFeed" /> class.
|
||||
/// </summary>
|
||||
public ClubLinkFeed()
|
||||
: base(new Uri(Constants.UrlLink_ClubLinks, UriKind.Absolute), Constants.FileLink_ClubLinks)
|
||||
: base(ModelType.FileAndFeed, Constants.FileLink_ClubLinks, Constants.UrlLink_ClubLinks)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -37,9 +40,13 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsModelUpToDate()
|
||||
private bool CheckIsModelUpToDate(LinkListModel model)
|
||||
{
|
||||
DateTime lastModified = this.Model.CreateTime;
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
DateTime lastModified = model.CreateTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
@@ -47,12 +54,11 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsFileUpToDate()
|
||||
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
|
||||
{
|
||||
DateTime lastModified = FileManager.GetFileInfo(FileName).LastWriteTime;
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private
|
||||
|
||||
@@ -11,11 +11,13 @@ namespace CampusAppWP8.Feed.Link
|
||||
using CampusAppWP8.Model.Link;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Model;
|
||||
using System.IO;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for CommonLinkFeeds
|
||||
/// </summary>
|
||||
public class CommonLinkFeed : XmlFeed<LinkListModel>
|
||||
public class CommonLinkFeed : XmlModel<LinkListModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
@@ -23,8 +25,10 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// Initializes a new instance of the <see cref="CommonLinkFeed" /> class.
|
||||
/// </summary>
|
||||
public CommonLinkFeed()
|
||||
: base(new Uri(Constants.UrlLink_CommonLinks, UriKind.Absolute), Constants.FileLink_CommonLinks)
|
||||
: base(ModelType.FileAndFeed, Constants.FileLink_CommonLinks, Constants.UrlLink_CommonLinks)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -37,9 +41,13 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsModelUpToDate()
|
||||
private bool CheckIsModelUpToDate(LinkListModel model)
|
||||
{
|
||||
DateTime lastModified = this.Model.CreateTime;
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
DateTime lastModified = model.CreateTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
@@ -47,9 +55,9 @@ namespace CampusAppWP8.Feed.Link
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsFileUpToDate()
|
||||
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
|
||||
{
|
||||
DateTime lastModified = FileManager.GetFileInfo(FileName).LastWriteTime;
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace CampusAppWP8.Api.News
|
||||
/// </summary>
|
||||
public NewsFeed() : base(URLList.NewsFeedURL, "NewsFeed.xml")
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -37,7 +39,7 @@ namespace CampusAppWP8.Api.News
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsFileUpToDate()
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ namespace CampusAppWP8.Pages.Links
|
||||
this.InitializeFeeds();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
this.loadingFeeds = 2;
|
||||
this.commonLinkFeed.LoadFeed();
|
||||
this.clubLinkFeed.LoadFeed();
|
||||
this.commonLinkFeed.LoadData();
|
||||
this.clubLinkFeed.LoadData();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -95,7 +95,7 @@ namespace CampusAppWP8.Pages.Links
|
||||
private void InitializeCommonLinkFeed()
|
||||
{
|
||||
this.commonLinkFeed = new CommonLinkFeed();
|
||||
this.commonLinkFeed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.CommonLinkFeedIsReady);
|
||||
this.commonLinkFeed.onLoaded += new CommonLinkFeed.OnLoaded(this.CommonLinkFeedIsReady);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -104,7 +104,7 @@ namespace CampusAppWP8.Pages.Links
|
||||
private void InitializeClubLinkFeed()
|
||||
{
|
||||
this.clubLinkFeed = new ClubLinkFeed();
|
||||
this.clubLinkFeed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.ClubLinkFeedIsReady);
|
||||
this.clubLinkFeed.onLoaded += new ClubLinkFeed.OnLoaded(this.ClubLinkFeedIsReady);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18046
|
||||
// Laufzeitversion:4.0.30319.18051
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
@@ -357,6 +357,24 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die stud. Vereine ähnelt.
|
||||
/// </summary>
|
||||
public static string LinkApp_ClubLinks {
|
||||
get {
|
||||
return ResourceManager.GetString("LinkApp_ClubLinks", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die allg. Links ähnelt.
|
||||
/// </summary>
|
||||
public static string LinkApp_CommonLinks {
|
||||
get {
|
||||
return ResourceManager.GetString("LinkApp_CommonLinks", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Links ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -311,4 +311,10 @@
|
||||
<data name="OpenHoursApp_Title" xml:space="preserve">
|
||||
<value>Öffnungszeiten</value>
|
||||
</data>
|
||||
<data name="LinkApp_ClubLinks" xml:space="preserve">
|
||||
<value>stud. Vereine</value>
|
||||
</data>
|
||||
<data name="LinkApp_CommonLinks" xml:space="preserve">
|
||||
<value>allg. Links</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18046
|
||||
// Laufzeitversion:4.0.30319.18051
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
@@ -141,6 +141,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die ähnelt.
|
||||
/// </summary>
|
||||
public static string LinkApp_CommonLinks {
|
||||
get {
|
||||
return ResourceManager.GetString("LinkApp_CommonLinks", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt.
|
||||
/// </summary>
|
||||
@@ -412,7 +421,7 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=clubs&amp;app=2&amp;appversion=1 ähnelt.
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=clubs&app=2&appversion=1 ähnelt.
|
||||
/// </summary>
|
||||
public static string UrlLink_ClubLinks {
|
||||
get {
|
||||
@@ -421,7 +430,7 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=links&amp;app=2&amp;appversion=1 ähnelt.
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=links&app=2&appversion=1 ähnelt.
|
||||
/// </summary>
|
||||
public static string UrlLink_CommonLinks {
|
||||
get {
|
||||
@@ -430,7 +439,7 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&amp;app=2&amp;appversion=1 ähnelt.
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&app=2&appversion=1 ähnelt.
|
||||
/// </summary>
|
||||
public static string UrlStudentCouncil_StudentCouncils {
|
||||
get {
|
||||
|
||||
@@ -241,12 +241,15 @@
|
||||
<value>ToggleContent</value>
|
||||
</data>
|
||||
<data name="UrlLink_ClubLinks" xml:space="preserve">
|
||||
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=clubs&amp;app=2&amp;appversion=1</value>
|
||||
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=clubs&app=2&appversion=1</value>
|
||||
</data>
|
||||
<data name="UrlLink_CommonLinks" xml:space="preserve">
|
||||
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=links&amp;app=2&amp;appversion=1</value>
|
||||
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=links&app=2&appversion=1</value>
|
||||
</data>
|
||||
<data name="UrlStudentCouncil_StudentCouncils" xml:space="preserve">
|
||||
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&amp;app=2&amp;appversion=1</value>
|
||||
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&app=2&appversion=1</value>
|
||||
</data>
|
||||
<data name="LinkApp_CommonLinks" xml:space="preserve">
|
||||
<value />
|
||||
</data>
|
||||
</root>
|
||||
@@ -139,6 +139,6 @@ namespace CampusAppWP8.Utility
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace CampusAppWP8
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Base model io handling class.
|
||||
/// </summary>
|
||||
@@ -267,7 +267,7 @@ namespace CampusAppWP8
|
||||
else
|
||||
{
|
||||
string data = this.file.ReadFile();
|
||||
|
||||
|
||||
if (data != null && !data.Equals(string.Empty))
|
||||
{
|
||||
this.DeserializeModel(Encoding.UTF8.GetBytes(data));
|
||||
@@ -299,7 +299,7 @@ namespace CampusAppWP8
|
||||
|
||||
byte[] data = this.SerializeModel();
|
||||
this.file.WriteFile(data);
|
||||
|
||||
|
||||
if (this.onSaved != null)
|
||||
{
|
||||
this.onSaved();
|
||||
|
||||
Reference in New Issue
Block a user