add model

This commit is contained in:
stubbfel
2013-06-10 15:25:35 +02:00
parent 78ff7bf24f
commit c2bfc2b1d3
18 changed files with 349 additions and 23 deletions

View File

@@ -101,6 +101,12 @@
<Compile Include="Model\departments\DepartmentModel.cs" />
<Compile Include="Model\departments\DepartmentViewModel.cs" />
<Compile Include="Model\departments\FacultyModel.cs" />
<Compile Include="Model\Lecture\LectureActivity.cs" />
<Compile Include="Model\Lecture\LectureCourse.cs" />
<Compile Include="Model\Lecture\LectureDate.cs" />
<Compile Include="Model\Lecture\LectureLecturer.cs" />
<Compile Include="Model\Lecture\LectureList.cs" />
<Compile Include="Model\Lecture\LectureModul.cs" />
<Compile Include="Model\Mensa\MenuModel.cs" />
<Compile Include="Model\Mensa\MenuWeekModel.cs" />
<Compile Include="Pages\campusmap\CampusMapPage.xaml.cs">
@@ -109,12 +115,16 @@
<Compile Include="Pages\departments\DepartmentPage.xaml.cs">
<DependentUpon>DepartmentPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\lecture\LecturePage.xaml.cs">
<Compile Include="Pages\Lecture\LectureFeed.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="Feed\Mensa\MensaFeed.cs" />
<Compile Include="Pages\Lecture\Results.xaml.cs">
<DependentUpon>Results.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Mensa\MensaPage.xaml.cs">
<DependentUpon>MensaPage.xaml</DependentUpon>
</Compile>
@@ -165,7 +175,11 @@
<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\Lecture\Results.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>

View File

@@ -27,15 +27,6 @@ namespace CampusAppWP8.Pages.Mensa
{
}
#endregion
#region Proberty
/// <summary>
/// Gets or sets i List of MenuModel
/// </summary>
public ObservableCollection<MenuModel> Menus { get; set; }
#endregion
#region Method

View File

@@ -0,0 +1,49 @@
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.Lecture
{
public class LectureActivity
{
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="LectureList" /> class.
/// </summary>
public LectureActivity()
{
}
#endregion
#region Proberty
[XmlElement("art")]
public string Type{ get; set; }
[XmlElement("semester")]
public int Semester { get; set; }
[XmlElement("sws")]
public string SWS { get; set; }
[XmlElement("modul")]
public LectureModul Modul { get; set; }
[XmlElement("lehrperson")]
public ObservableCollection<LectureLecturer> Lecturer { get; set; }
[XmlElement("studiengang")]
public ObservableCollection<LectureCourse> Course { get; set; }
[XmlElement("termin")]
public ObservableCollection<LectureDate> Dates { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
namespace CampusAppWP8.Model.Lecture
{
public class LectureCourse
{
public LectureCourse()
{
}
[XmlElement("bezeichnung")]
public string Title {get;set;}
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
namespace CampusAppWP8.Model.Lecture
{
public class LectureDate
{
public LectureDate()
{
}
[XmlElement("wochentag")]
public string WeekDay { get; set; }
[XmlElement("von")]
public string From { get; set; }
[XmlElement("bis")]
public string To { get; set; }
[XmlElement("rhythmus")]
public string Interval { get; set; }
[XmlElement("raum")]
public string Room { get; set; }
[XmlElement("anfangsdatum")]
public string StarDate { get; set; }
[XmlElement("enddatum")]
public string EndDate { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
namespace CampusAppWP8.Model.Lecture
{
public class LectureLecturer
{
public LectureLecturer()
{
}
[XmlElement("vorname")]
public string FirstName { get; set; }
[XmlElement("name")]
public string LastName { get; set; }
[XmlElement("titel")]
public string Title { get; set; }
[XmlAttribute("zustaendigkeit")]
public string Responsibility { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
//-----------------------------------------------------------------------
// <copyright file="LectureList.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>10.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Lecture
{
using System.Collections.ObjectModel;
using System.Xml.Serialization;
[XmlRoot("lsf_auszug")]
public class LectureList
{
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="LectureList" /> class.
/// </summary>
public LectureList()
{
}
#endregion
#region Proberty
[XmlArray("veranstaltungsliste")]
[XmlArrayItem("veranstaltung")]
public ObservableCollection<LectureActivity> Activity { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,69 @@
//-----------------------------------------------------------------------
// <copyright file="LectureModul.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>10.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Lecture
{
using System;
using System.Xml.Serialization;
public class LectureModul
{
#region Members
private int number;
private Uri url;
#endregion
#region Constructor
public LectureModul()
{
}
#endregion
#region Property
[XmlElement("titel")]
public string Title {get; set;}
[XmlElement("nummer")]
public int Number{
get
{
return this.number;
}
set
{
if (value != this.number)
{
this.number = value;
this.createUrl();
}
}
}
public Uri Url{
get
{
return url;
}
}
#endregion
#region Methods
private void createUrl()
{
this.url = new Uri("https://www.tu-cottbus.de/modul/" + number.ToString());
}
#endregion
}
}

View File

@@ -0,0 +1,37 @@
using CampusAppWP8.Model.Lecture;
using CampusAppWP8.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CampusAppWP8.Pages.Lecture
{
public class LectureFeed : XmlFeed<LectureList>
{
public LectureFeed()
: base(new Uri("http://www.zv.tu-cottbus.de/LSFveranst/LSF4?Semester=20112&Abschluss=82&Studiengang=079&Von=1&Bis=2"), "Lecture.xml")
{
this.validRootName = "lsf_auszug";
}
/// <summary>
/// Method implement CheckIsModelUpToDate()-Method <see cref="Feed"/>
/// </summary>
/// <returns>true, if model is up-to-date, otherwise false</returns>
protected override bool CheckIsModelUpToDate()
{
return false;
}
/// <summary>
/// Method implement CheckIsFileUpToDate()-Method <see cref="Feed"/>
/// </summary>
/// <returns>true, if file is up-to-date, otherwise false</returns>
protected override bool CheckIsFileUpToDate()
{
return true;
}
}
}

View File

@@ -100,7 +100,7 @@
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="5">
<Button>
<Button Name="SearchButton">
<Image Source="/Toolkit.Content/ApplicationBar.Select.png" Width="100">
</Image>
</Button>

View File

@@ -7,6 +7,8 @@ using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Pages.Lecture;
using CampusAppWP8.Utility;
namespace CampusAppWP8.Pages.lecture
{
@@ -15,6 +17,8 @@ namespace CampusAppWP8.Pages.lecture
public Lecture()
{
InitializeComponent();
LectureFeed test = new LectureFeed();
test.LoadFeed();
}
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)

View File

@@ -0,0 +1,34 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.Lecture.Results"
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"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Title, Source={StaticResource LocalizedStrings}}"/>
</StackPanel>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
</Grid>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,20 @@
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;
namespace CampusAppWP8.Pages.Lecture
{
public partial class Results : PhoneApplicationPage
{
public Results()
{
InitializeComponent();
}
}
}

View File

@@ -13,7 +13,7 @@
<Capability Name="ID_CAP_ISV_CAMERA" />
</Capabilities>
<Tasks>
<DefaultTask Name="_default" NavigationPage="pages/mensa/MensaPage.xaml" />
<DefaultTask Name="_default" NavigationPage="pages/Lecture/LecturePage.xaml" />
</Tasks>
<Tokens>
<PrimaryToken TokenID="CampusAppWP8Token" TaskName="_default">

View File

@@ -169,7 +169,7 @@ namespace CampusAppWP8.Resources {
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Vorlesung ähnelt.
/// Sucht eine lokalisierte Zeichenfolge, die Vorlesungen ähnelt.
/// </summary>
public static string LectureApp_Title {
get {

View File

@@ -153,7 +153,7 @@
<value>Hausaufgaben</value>
</data>
<data name="LectureApp_Title" xml:space="preserve">
<value>Vorlesung</value>
<value>Vorlesungen</value>
</data>
<data name="LinkApp_Title" xml:space="preserve">
<value>Links</value>

View File

@@ -8,16 +8,12 @@
namespace CampusAppWP8.Utility
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// Class realize the access of restful RestAPI
/// </summary>
public class RestApi
public abstract class RestApi
{
#region Members

View File

@@ -18,6 +18,8 @@ namespace CampusAppWP8.Utility
/// <typeparam name="T">Type for model of the feed</typeparam>
public abstract class XmlFeed<T> : Feed<T>
{
protected string validRootName = Constants.XMLRootElementName;
#region Constructor
/// <summary>
@@ -48,10 +50,9 @@ namespace CampusAppWP8.Utility
{
XmlSerializer serializer = new XmlSerializer(typeof(T));
XDocument document = XDocument.Parse(feedString);
string validRootName = Constants.XMLRootElementName;
if (!document.Root.Name.Equals(validRootName))
if (!document.Root.Name.ToString().Equals(validRootName))
{
XElement content = document.Root;
XElement content = document.Root;
document = new XDocument();
document.Add(new XElement(validRootName, content));
}