add doc to model,feed
This commit is contained in:
@@ -37,6 +37,8 @@
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -95,38 +97,38 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LocalizedStrings.cs" />
|
||||
<Compile Include="model\departments\ChairModel.cs" />
|
||||
<Compile Include="model\departments\DepartmentModel.cs" />
|
||||
<Compile Include="model\departments\DepartmentViewModel.cs" />
|
||||
<Compile Include="model\departments\FacultyModel.cs" />
|
||||
<Compile Include="model\mensa\MenuModel.cs" />
|
||||
<Compile Include="model\mensa\MenuWeekModel.cs" />
|
||||
<Compile Include="pages\campusmap\CampusMapPage.xaml.cs">
|
||||
<Compile Include="Model\departments\ChairModel.cs" />
|
||||
<Compile Include="Model\departments\DepartmentModel.cs" />
|
||||
<Compile Include="Model\departments\DepartmentViewModel.cs" />
|
||||
<Compile Include="Model\departments\FacultyModel.cs" />
|
||||
<Compile Include="Model\Mensa\MenuModel.cs" />
|
||||
<Compile Include="Model\Mensa\MenuWeekModel.cs" />
|
||||
<Compile Include="Pages\campusmap\CampusMapPage.xaml.cs">
|
||||
<DependentUpon>CampusMapPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pages\departments\DepartmentPage.xaml.cs">
|
||||
<Compile Include="Pages\departments\DepartmentPage.xaml.cs">
|
||||
<DependentUpon>DepartmentPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pages\lecture\LecturePage.xaml.cs">
|
||||
<Compile Include="Pages\lecture\LecturePage.xaml.cs">
|
||||
<DependentUpon>LecturePage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="model\BaseModel.cs" />
|
||||
<Compile Include="model\BaseViewModel.cs" />
|
||||
<Compile Include="pages\mensa\MensaFeed.cs" />
|
||||
<Compile Include="pages\mensa\MensaPage.xaml.cs">
|
||||
<Compile Include="Model\BaseModel.cs" />
|
||||
<Compile Include="Model\BaseViewModel.cs" />
|
||||
<Compile Include="Feed\Mensa\MensaFeed.cs" />
|
||||
<Compile Include="Pages\Mensa\MensaPage.xaml.cs">
|
||||
<DependentUpon>MensaPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pages\news\NewsPage.xaml.cs">
|
||||
<Compile Include="Pages\news\NewsPage.xaml.cs">
|
||||
<DependentUpon>NewsPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pages\news\RSSItem.cs" />
|
||||
<Compile Include="pages\news\RSSNewsTemplate.xaml.cs">
|
||||
<Compile Include="Pages\news\RSSItem.cs" />
|
||||
<Compile Include="Pages\news\RSSNewsTemplate.xaml.cs">
|
||||
<DependentUpon>RSSNewsTemplate.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pages\StartPage.xaml.cs">
|
||||
<Compile Include="Pages\StartPage.xaml.cs">
|
||||
<DependentUpon>StartPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pages\webmail\WebmailPage.xaml.cs">
|
||||
<Compile Include="Pages\webmail\WebmailPage.xaml.cs">
|
||||
<DependentUpon>WebmailPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -153,35 +155,35 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="pages\campusmap\CampusMapPage.xaml">
|
||||
<Page Include="Pages\campusmap\CampusMapPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="pages\departments\DepartmentPage.xaml">
|
||||
<Page Include="Pages\departments\DepartmentPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="pages\lecture\LecturePage.xaml">
|
||||
<Page Include="Pages\lecture\LecturePage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="pages\mensa\MensaPage.xaml">
|
||||
<Page Include="Pages\Mensa\MensaPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="pages\news\NewsPage.xaml">
|
||||
<Page Include="Pages\news\NewsPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="pages\news\RSSNewsTemplate.xaml">
|
||||
<Page Include="Pages\news\RSSNewsTemplate.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="pages\StartPage.xaml">
|
||||
<Page Include="Pages\StartPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="pages\webmail\WebmailPage.xaml">
|
||||
<Page Include="Pages\webmail\WebmailPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
106
CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs
Normal file
106
CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MensaFeed.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>03.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Mensa
|
||||
{
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using CampusAppWP8.Model.Mensa;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for MesaFeeds
|
||||
/// </summary>
|
||||
public class MensaFeed : XmlFeed<MenuWeekModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MensaFeed" /> class.
|
||||
/// </summary>
|
||||
public MensaFeed()
|
||||
: base(URLList.MensaFeedURL, FileList.MensaXmlFile)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Proberty
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets i List of MenuModel
|
||||
/// </summary>
|
||||
public ObservableCollection<MenuModel> Menus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region Protected
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsModelUpToDate()-Method <see cref="Feed"/>
|
||||
/// </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="Feed"/>
|
||||
/// </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>
|
||||
/// Method calculate this day of the week, which its gets new menus
|
||||
/// </summary>
|
||||
/// <returns>Date of NewMenuWeekDay</returns>
|
||||
private DateTime CalcNewMenuWeekDay()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
while (now.DayOfWeek != DayOfWeek.Monday)
|
||||
{
|
||||
now = now.Subtract(new TimeSpan(1, 0, 0, 0));
|
||||
}
|
||||
|
||||
DateTime monday = new DateTime(now.Year, now.Month, now.Day);
|
||||
return monday;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the last modification was later as the NewMenuWeekDay
|
||||
/// </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)
|
||||
{
|
||||
int diff = lastModified.CompareTo(this.CalcNewMenuWeekDay());
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CampusAppWP8.model
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="BaseModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>03.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
/// <summary>
|
||||
/// This Class provide a basic model
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// not necessary, maybe delete => deprecated
|
||||
/// </remarks>
|
||||
public class BaseModel : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary>
|
||||
/// The PropertyChangedEvent
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void NotifyPropertyChanged(String propertyName)
|
||||
|
||||
/// <summary>
|
||||
/// Method fire PropertyChangedEvents
|
||||
/// </summary>
|
||||
/// <param name="propertyName">name of the property</param>
|
||||
public void NotifyPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
PropertyChangedEventHandler handler = this.PropertyChanged;
|
||||
if (null != handler)
|
||||
{
|
||||
handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CampusAppWP8.model
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="BaseViewModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>03.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model
|
||||
{
|
||||
public class BaseViewModel: INotifyPropertyChanged
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
/// <summary>
|
||||
/// This Class provide a basic ViewModel
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// not necessary, maybe delete => deprecated
|
||||
/// </remarks>
|
||||
public class BaseViewModel : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary>
|
||||
/// The PropertyChangedEvent
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void NotifyPropertyChanged(String propertyName)
|
||||
|
||||
/// <summary>
|
||||
/// Method fire PropertyChangedEvents
|
||||
/// </summary>
|
||||
/// <param name="propertyName">name of the property</param>
|
||||
public void NotifyPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
PropertyChangedEventHandler handler = this.PropertyChanged;
|
||||
if (null != handler)
|
||||
{
|
||||
handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CampusAppWP8.model.departments
|
||||
namespace CampusAppWP8.Model.departments
|
||||
{
|
||||
public class ChairModel : BaseModel
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CampusAppWP8.model.departments
|
||||
namespace CampusAppWP8.Model.departments
|
||||
{
|
||||
public class DepartmentModel : BaseModel
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CampusAppWP8.model.departments
|
||||
namespace CampusAppWP8.Model.departments
|
||||
{
|
||||
public class DepartmentViewModel : BaseViewModel
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CampusAppWP8.model.departments
|
||||
namespace CampusAppWP8.Model.departments
|
||||
{
|
||||
public class FacultyModel : BaseModel
|
||||
{
|
||||
|
||||
@@ -1,117 +1,193 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
namespace CampusAppWP8.model.mensa
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MenuModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>03.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Mensa
|
||||
{
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Model for menu
|
||||
/// </summary>
|
||||
public class MenuModel
|
||||
{
|
||||
private string _bio = AppResources.MensaApp_NotToday;
|
||||
private string _dinner1 = AppResources.MensaApp_NotToday;
|
||||
private string _dinner2 = AppResources.MensaApp_NotToday;
|
||||
private string _dinner3 = AppResources.MensaApp_NotToday;
|
||||
private string _dinner4 = AppResources.MensaApp_NotToday;
|
||||
private string _action = AppResources.MensaApp_NotToday;
|
||||
#region Member
|
||||
|
||||
/// <summary>
|
||||
/// Name for bio dinner
|
||||
/// </summary>
|
||||
private string bio = AppResources.MensaApp_NotToday;
|
||||
|
||||
/// <summary>
|
||||
/// Name for 1. dinner
|
||||
/// </summary>
|
||||
private string dinner1 = AppResources.MensaApp_NotToday;
|
||||
|
||||
/// <summary>
|
||||
/// Name for 2. dinner
|
||||
/// </summary>
|
||||
private string dinner2 = AppResources.MensaApp_NotToday;
|
||||
|
||||
/// <summary>
|
||||
/// Name for 3. dinner
|
||||
/// </summary>
|
||||
private string dinner3 = AppResources.MensaApp_NotToday;
|
||||
|
||||
/// <summary>
|
||||
/// Name for 4. dinner
|
||||
/// </summary>
|
||||
private string dinner4 = AppResources.MensaApp_NotToday;
|
||||
|
||||
/// <summary>
|
||||
/// Name for action dinner
|
||||
/// </summary>
|
||||
private string action = AppResources.MensaApp_NotToday;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MenuModel" /> class.
|
||||
/// </summary>
|
||||
public MenuModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WeekDay
|
||||
/// </summary>
|
||||
[XmlElement("Wochentag")]
|
||||
public string Day { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner 1
|
||||
/// </summary>
|
||||
[XmlElement("Essen1")]
|
||||
public string Dinner1
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dinner1;
|
||||
return this.dinner1;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
setValue(value, ref _dinner1);
|
||||
this.SetValue(value, ref this.dinner1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner 2
|
||||
/// </summary>
|
||||
[XmlElement("Essen2")]
|
||||
public string Dinner2
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dinner2;
|
||||
return this.dinner2;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
setValue(value, ref _dinner2);
|
||||
this.SetValue(value, ref this.dinner2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner 3
|
||||
/// </summary>
|
||||
[XmlElement("Essen3")]
|
||||
public string Dinner3
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dinner3;
|
||||
return this.dinner3;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
setValue(value, ref _dinner3);
|
||||
this.SetValue(value, ref this.dinner3);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner 4
|
||||
/// </summary>
|
||||
[XmlElement("Essen4")]
|
||||
public string Dinner4
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dinner4;
|
||||
return this.dinner4;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
setValue(value, ref _dinner4);
|
||||
this.SetValue(value, ref this.dinner4);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner bio
|
||||
/// </summary>
|
||||
[XmlElement("Bio")]
|
||||
public string Bio
|
||||
{
|
||||
get
|
||||
{
|
||||
return _bio;
|
||||
return this.bio;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
setValue(value, ref _bio);
|
||||
this.SetValue(value, ref this.bio);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner action
|
||||
/// </summary>
|
||||
[XmlElement("Aktionstag")]
|
||||
public string Action
|
||||
{
|
||||
get
|
||||
{
|
||||
return _action;
|
||||
return this.action;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
setValue(value, ref _action);
|
||||
this.SetValue(value, ref this.action);
|
||||
}
|
||||
}
|
||||
|
||||
private void setValue(string value, ref string property)
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
/// <summary>
|
||||
/// Methods sets the property
|
||||
/// </summary>
|
||||
/// <remarks> maybe move to base class</remarks>
|
||||
/// <param name="value">new property value</param>
|
||||
/// <param name="property">name of the property</param>
|
||||
private void SetValue(string value, ref string property)
|
||||
{
|
||||
if (value != null && !String.Empty.Equals(value) && !value.Equals(property))
|
||||
if (value != null && !string.Empty.Equals(value) && !value.Equals(property))
|
||||
{
|
||||
property = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace CampusAppWP8.model.mensa
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MenuWeekModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>03.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Mensa
|
||||
{
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Model for menus in one week
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class MenuWeekModel
|
||||
{
|
||||
[XmlArray("BTU")]
|
||||
[XmlArrayItem("Tagesmenu")]
|
||||
public ObservableCollection<MenuModel> menus { get; set; }
|
||||
|
||||
private readonly DateTime _createTime;
|
||||
|
||||
public DateTime CreateTime { get { return _createTime; } }
|
||||
/// <summary>
|
||||
/// Time when the model was created
|
||||
/// </summary>
|
||||
private readonly DateTime createTime;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MenuWeekModel" /> class.
|
||||
/// </summary>
|
||||
public MenuWeekModel()
|
||||
{
|
||||
_createTime = DateTime.Now;
|
||||
this.createTime = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the menus for the week
|
||||
/// </summary>
|
||||
[XmlArray("BTU")]
|
||||
[XmlArrayItem("Tagesmenu")]
|
||||
public ObservableCollection<MenuModel> Menus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the creation time of the model
|
||||
/// </summary>
|
||||
public DateTime CreateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.createTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.pages.StartPage"
|
||||
x:Class="CampusAppWP8.Pages.StartPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
|
||||
@@ -9,7 +9,7 @@ using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using Windows.UI.Input;
|
||||
|
||||
namespace CampusAppWP8.pages
|
||||
namespace CampusAppWP8.Pages
|
||||
{
|
||||
public partial class StartPage : PhoneApplicationPage
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:Location="clr-namespace:System.Device.Location;assembly=System.Device"
|
||||
x:Class="CampusAppWP8.pages.campusmap.CampusMapPage"
|
||||
x:Class="CampusAppWP8.Pages.campusmap.CampusMapPage"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
namespace CampusAppWP8.pages.campusmap
|
||||
namespace CampusAppWP8.Pages.campusmap
|
||||
{
|
||||
public partial class CampusMapPage : PhoneApplicationPage
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.pages.departments.DepartmentPage"
|
||||
x:Class="CampusAppWP8.Pages.departments.DepartmentPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
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.departments"
|
||||
xmlns:viewModel="clr-namespace:CampusAppWP8.Model.departments"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
namespace CampusAppWP8.pages.departments
|
||||
namespace CampusAppWP8.Pages.departments
|
||||
{
|
||||
public partial class DepartmentPage : PhoneApplicationPage
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.pages.lecture.Lecture"
|
||||
x:Class="CampusAppWP8.Pages.lecture.Lecture"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
namespace CampusAppWP8.pages.lecture
|
||||
namespace CampusAppWP8.Pages.lecture
|
||||
{
|
||||
public partial class Lecture : PhoneApplicationPage
|
||||
{
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
using CampusAppWP8.model.mensa;
|
||||
using CampusAppWP8.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using Windows.Storage;
|
||||
using Windows.Storage.FileProperties;
|
||||
|
||||
namespace CampusAppWP8.pages.mensa
|
||||
{
|
||||
public class MensaFeed : XmlFeed<MenuWeekModel>
|
||||
{
|
||||
|
||||
public MensaFeed()
|
||||
: base(URLList.MensaFeedURL, FileList.MensaXmlFile)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool CheckIsModelUpToDate()
|
||||
{
|
||||
DateTime lastModified = Model.CreateTime;
|
||||
return checkIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
protected override bool CheckIsFileUpToDate()
|
||||
{
|
||||
DateTime lastModified = FileManager.GetFileInfo(FileName).LastWriteTime;
|
||||
return checkIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
|
||||
public ObservableCollection<MenuModel> menus { get; set; }
|
||||
|
||||
private DateTime calcNewMenuWeekDay()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
while (now.DayOfWeek != DayOfWeek.Monday)
|
||||
{
|
||||
now = now.Subtract(new TimeSpan(1, 0, 0, 0));
|
||||
}
|
||||
DateTime monday = new DateTime(now.Year, now.Month, now.Day);
|
||||
return monday;
|
||||
}
|
||||
|
||||
private bool checkIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
int diff = lastModified.CompareTo(calcNewMenuWeekDay());
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.pages.mensa.MensaPage"
|
||||
x:Class="CampusAppWP8.Pages.Mensa.MensaPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
@@ -11,7 +11,6 @@
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
|
||||
OrientationChanged="PhoneApplicationPage_OrientationChanged"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
|
||||
@@ -1,62 +1,106 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using CampusAppWP8.Utility;
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.model.mensa;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace CampusAppWP8.pages.mensa
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MensaPage.xaml.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>03.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Mensa
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the MensaPage
|
||||
/// </summary>
|
||||
public partial class MensaPage : PhoneApplicationPage
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// the feed of the mensa
|
||||
/// </summary>
|
||||
private MensaFeed feed;
|
||||
|
||||
/// <summary>
|
||||
/// Index representing the weekday of today
|
||||
/// 0 - Monday(Default)
|
||||
/// 1 - Tuesday
|
||||
/// 2 - Wednesday
|
||||
/// 3 - Thursday
|
||||
/// 4 - Friday
|
||||
/// </summary>
|
||||
private int selectedIndex;
|
||||
|
||||
#endregion
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MensaPage" /> class.
|
||||
/// </summary>
|
||||
public MensaPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeFeed();
|
||||
this.InitializeComponent();
|
||||
this.InitializeFeed();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region protected
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedTo method
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
if (feed == null)
|
||||
if (this.feed == null)
|
||||
{
|
||||
InitializeFeed();
|
||||
this.InitializeFeed();
|
||||
}
|
||||
feed.LoadFeed();
|
||||
|
||||
this.feed.LoadFeed();
|
||||
}
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Method initialize the Feed
|
||||
/// </summary>
|
||||
private void InitializeFeed()
|
||||
{
|
||||
feed = new MensaFeed();
|
||||
feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(feedIsReady);
|
||||
calcSelectedIndex();
|
||||
this.feed = new MensaFeed();
|
||||
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady);
|
||||
this.CalcSelectedIndex();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Method will be execute if the feed is ready
|
||||
/// </summary>
|
||||
private void FeedIsReady()
|
||||
{
|
||||
this.SetupMensaPivot();
|
||||
}
|
||||
|
||||
private void feedIsReady()
|
||||
/// <summary>
|
||||
/// Method set ItemSource and SelectedIndex for the pivot
|
||||
/// </summary>
|
||||
private void SetupMensaPivot()
|
||||
{
|
||||
setupMensaPivot();
|
||||
this.MensaPivot.ItemsSource = this.feed.Model.Menus;
|
||||
this.MensaPivot.SelectedIndex = this.selectedIndex;
|
||||
}
|
||||
|
||||
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
private void setupMensaPivot()
|
||||
{
|
||||
MensaPivot.ItemsSource = feed.Model.menus;
|
||||
MensaPivot.SelectedIndex = selectedIndex;
|
||||
}
|
||||
private void calcSelectedIndex()
|
||||
/// <summary>
|
||||
/// Method calculate which pivot has to be selected
|
||||
/// </summary>
|
||||
private void CalcSelectedIndex()
|
||||
{
|
||||
DayOfWeek today = DateTime.Now.DayOfWeek;
|
||||
int todayIndex;
|
||||
@@ -81,7 +125,11 @@ namespace CampusAppWP8.pages.mensa
|
||||
todayIndex = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
this.selectedIndex = todayIndex;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.pages.news.NewsPage"
|
||||
x:Class="CampusAppWP8.Pages.news.NewsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
|
||||
@@ -11,7 +11,7 @@ using System.Xml.Linq;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
|
||||
namespace CampusAppWP8.pages.news
|
||||
namespace CampusAppWP8.Pages.news
|
||||
{
|
||||
public partial class NewsPage : PhoneApplicationPage
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CampusAppWP8.pages.news
|
||||
namespace CampusAppWP8.Pages.news
|
||||
{
|
||||
class RSSItem
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<UserControl
|
||||
x:Class="CampusAppWP8.pages.news.RSSNewsTemplate"
|
||||
x:Class="CampusAppWP8.Pages.news.RSSNewsTemplate"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
|
||||
@@ -10,7 +10,7 @@ using Microsoft.Phone.Shell;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
namespace CampusAppWP8.pages.news
|
||||
namespace CampusAppWP8.Pages.news
|
||||
{
|
||||
public partial class RSSNewsTemplate : UserControl
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.pages.webmail.Webmail"
|
||||
x:Class="CampusAppWP8.Pages.webmail.Webmail"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
|
||||
@@ -9,7 +9,7 @@ using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CampusAppWP8.pages.webmail
|
||||
namespace CampusAppWP8.Pages.webmail
|
||||
{
|
||||
public partial class Webmail : PhoneApplicationPage
|
||||
{
|
||||
|
||||
@@ -8,13 +8,7 @@
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Storage;
|
||||
|
||||
/// <summary>
|
||||
/// This a abstract Class for reading, store and deserialization Feeds from the Web.
|
||||
|
||||
@@ -7,14 +7,8 @@
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// This class handle the events of a feed <see cref="CampusAppWP8.Utility.Feed"/>
|
||||
/// This class handle the events of a feed <see cref="Feed{T}"/>
|
||||
/// </summary>
|
||||
public class FeedEventHandler
|
||||
{
|
||||
|
||||
@@ -24,6 +24,6 @@ namespace CampusAppWP8.Utility
|
||||
/// <summary>
|
||||
/// Name of the file for the feed of the mensa
|
||||
/// </summary>
|
||||
private static readonly string MensaXmlFile = "MesaFeed.xml";
|
||||
public static readonly string MensaXmlFile = "MesaFeed.xml";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,15 +8,9 @@
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.IsolatedStorage;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Storage;
|
||||
using Windows.Storage.FileProperties;
|
||||
using Windows.Storage.Streams;
|
||||
|
||||
/// <summary>
|
||||
/// This a static Class, which provide some method for files
|
||||
@@ -33,7 +27,7 @@ namespace CampusAppWP8.Utility
|
||||
#endregion
|
||||
|
||||
#region public
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Method write a content to an file
|
||||
/// </summary>
|
||||
@@ -56,7 +50,7 @@ namespace CampusAppWP8.Utility
|
||||
{
|
||||
string content = null;
|
||||
|
||||
if (ExistsFile(fileName))
|
||||
if (!ExistsFile(fileName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// This Class creates logs for the app
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Class contain some default url of feeds
|
||||
|
||||
@@ -6,12 +6,8 @@
|
||||
// <sience>03.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
Reference in New Issue
Block a user