add models and feed #74

This commit is contained in:
stubbfel
2013-07-02 15:18:40 +02:00
parent 448cfd5118
commit c9b3553d2a
7 changed files with 255 additions and 4 deletions

View File

@@ -99,6 +99,7 @@
<Compile Include="Feed\Link\CommonLinkFeed.cs" />
<Compile Include="Feed\Link\ClubLinkFeed.cs" />
<Compile Include="Feed\Openinghours\OpeninghoursFeed.cs" />
<Compile Include="Feed\StudentCouncil\StudentCouncilFeed.cs" />
<Compile Include="LocalizedStrings.cs" />
<Compile Include="Model\Campusmap\MapModel.cs" />
<Compile Include="Model\Campusmap\MapPinModel.cs" />
@@ -121,6 +122,8 @@
<Compile Include="Model\Mensa\MenuWeekModel.cs" />
<Compile Include="Model\Openinghours\OpeninghoursInstitutionModel.cs" />
<Compile Include="Model\Openinghours\OpeninghoursModel.cs" />
<Compile Include="Model\StudentCouncil\StudentCouncilListModel.cs" />
<Compile Include="Model\StudentCouncil\StudentCouncilModel.cs" />
<Compile Include="Model\Utility\UrlParamModel.cs" />
<Compile Include="Pages\Campusmap\CampusMapPage.xaml.cs">
<DependentUpon>CampusMapPage.xaml</DependentUpon>

View File

@@ -0,0 +1,83 @@
//-----------------------------------------------------------------------
// <copyright file="StudentCouncilFeed.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>02.07.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Feed.StudentCouncil
{
using System;
using CampusAppWP8.Model.StudentCouncil;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// This Class is for StudentCouncilFeed
/// </summary>
public class StudentCouncilFeed : XmlFeed<StudentCouncilListModel>
{
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="StudentCouncilFeed" /> class.
/// </summary>
public StudentCouncilFeed()
: base(new Uri(Constants.UrlStudentCouncil_StudentCouncils, UriKind.Absolute), Constants.FileStudentCouncil_StudentCouncils)
{
}
#endregion
#region Method
#region Protected
/// <summary>
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>.
/// </summary>
/// <returns>true, if model is up-to-date, otherwise false</returns>
protected override bool CheckIsModelUpToDate()
{
DateTime lastModified = this.Model.CreateTime;
return this.CheckIsUpToDate(lastModified);
}
/// <summary>
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
/// </summary>
/// <returns>true, if file is up-to-date, otherwise false</returns>
protected override bool CheckIsFileUpToDate()
{
DateTime lastModified = FileManager.GetFileInfo(FileName).LastWriteTime;
return this.CheckIsUpToDate(lastModified);
}
#endregion
#region Private
/// <summary>
/// Check if the model or file is up-to-date.
/// </summary>
/// <param name="lastModified">Date of the last modification</param>
/// <returns>true, if is up-to-date, otherwise false</returns>
private bool CheckIsUpToDate(DateTime lastModified)
{
DateTime temp = lastModified.AddDays(1);
int diff = temp.CompareTo(DateTime.Now);
if (diff < 0)
{
return false;
}
return true;
}
#endregion
#endregion
}
}

View File

@@ -21,22 +21,22 @@ namespace CampusAppWP8.Model.Link
/// <summary>
/// German version of the link title.
/// </summary>
private string titleDE = string.Empty;
private string titleDE;
/// <summary>
/// English version of the link title.
/// </summary>
private string titleEN = string.Empty;
private string titleEN;
/// <summary>
/// German version of the link.
/// </summary>
private string linkDE = string.Empty;
private string linkDE;
/// <summary>
/// English version of the link.
/// </summary>
private string linkEN = string.Empty;
private string linkEN;
#endregion

View File

@@ -0,0 +1,59 @@
//-----------------------------------------------------------------------
// <copyright file="StudentCouncilListModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>02.07.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.StudentCouncil
{
using System;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
/// <summary>
/// Model for menus in one week
/// </summary>
[XmlRoot("root")]
public class StudentCouncilListModel
{
#region Members
/// <summary>
/// Time when the model was created
/// </summary>
private readonly DateTime createTime;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="StudentCouncilListModel" /> class.
/// </summary>
public StudentCouncilListModel()
{
this.createTime = DateTime.Now;
}
#endregion
#region Proberty
/// <summary>
/// Gets or sets the StudentCouncils
/// </summary>
[XmlArray("data")]
[XmlArrayItem("studentcouncil")]
public ObservableCollection<StudentCouncilModel> StudentCouncils { get; set; }
/// <summary>
/// Gets the creation time of the model
/// </summary>
public DateTime CreateTime
{
get
{
return this.createTime;
}
}
#endregion
}
}

View File

@@ -0,0 +1,82 @@
//-----------------------------------------------------------------------------
// <copyright file="StudentCouncilModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>02.07.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.StudentCouncil
{
using System.Globalization;
using System.Xml.Serialization;
/// <summary>
/// Model for menu
/// </summary>
public class StudentCouncilModel
{
#region Member
/// <summary>
/// German version of the link title.
/// </summary>
private string titleDE = string.Empty;
/// <summary>
/// English version of the link title.
/// </summary>
private string titleEN = string.Empty;
/// <summary>
/// German version of the link.
/// </summary>
private string linkDE = string.Empty;
/// <summary>
/// English version of the link.
/// </summary>
private string linkEN = string.Empty;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="StudentCouncilModel" /> class.
/// </summary>
public StudentCouncilModel()
{
}
#endregion
#region Property
/// <summary>
/// Gets or sets the faculty of the StudentCouncil.
/// </summary>
[XmlAttribute("faculty")]
public string Faculty { get; set; }
/// <summary>
/// Gets or sets the name of the StudentCouncil.
/// </summary>
[XmlAttribute("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the webpage-url of the StudentCouncil.
/// </summary>
[XmlAttribute("url")]
public string Url { get; set; }
/// <summary>
/// Gets or sets the email-address of the StudentCouncil.
/// </summary>
[XmlAttribute("email")]
public string Email { get; set; }
#endregion
}
}

View File

@@ -78,6 +78,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die StudentCouncils.xml ähnelt.
/// </summary>
internal static string FileStudentCouncil_StudentCouncils {
get {
return ResourceManager.GetString("FileStudentCouncil_StudentCouncils", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die LectureModel ähnelt.
/// </summary>
@@ -303,6 +312,15 @@ 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.
/// </summary>
internal static string UrlStudentCouncil_StudentCouncils {
get {
return ResourceManager.GetString("UrlStudentCouncil_StudentCouncils", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die https://webmail.tu-cottbus.de ähnelt.
/// </summary>

View File

@@ -204,4 +204,10 @@
<data name="PathLinks_LinkPage" xml:space="preserve">
<value>/Pages/Links/LinkPage.xaml</value>
</data>
<data name="FileStudentCouncil_StudentCouncils" xml:space="preserve">
<value>StudentCouncils.xml</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>
</data>
</root>