Merge branch 'release/new_file_system' into develmaster

This commit is contained in:
Christian Fiedler
2013-07-15 17:34:15 +02:00
52 changed files with 2736 additions and 493 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -96,6 +96,7 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Feed\Departments\DepartmentFavoriteFeed.cs" />
<Compile Include="Const.cs" />
<Compile Include="Utility\Lui\Button\EmailButton.cs" />
<Compile Include="Feed\Link\CommonLinkFeed.cs" />
@@ -107,10 +108,9 @@
<Compile Include="Model\Campusmap\MapPinModel.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\Events\RSSChannelModel.cs" />
<Compile Include="Model\Events\RSSViewModel.cs" />
<Compile Include="Model\RSS\RSSChannelModel.cs" />
<Compile Include="Model\RSS\RSSViewModel.cs" />
<Compile Include="Model\Lecture\LectureActivity.cs" />
<Compile Include="Model\Lecture\LectureCourse.cs" />
<Compile Include="Model\Lecture\LectureDate.cs" />
@@ -118,6 +118,7 @@
<Compile Include="Model\Lecture\LectureList.cs" />
<Compile Include="Model\Lecture\LectureModule.cs" />
<Compile Include="Model\Lecture\LecturePageModel.cs" />
<Compile Include="Model\MainModel.cs" />
<Compile Include="Model\Link\LinkModel.cs" />
<Compile Include="Model\Link\LinkListModel.cs" />
<Compile Include="Model\Mensa\MenuModel.cs" />
@@ -127,11 +128,21 @@
<Compile Include="Model\StudentCouncil\StudentCouncilListModel.cs" />
<Compile Include="Model\StudentCouncil\StudentCouncilModel.cs" />
<Compile Include="Model\Utility\UrlParamModel.cs" />
<Compile Include="Model\XmlModel.cs" />
<Compile Include="Pages\Campusmap\CampusMapPage.xaml.cs">
<DependentUpon>CampusMapPage.xaml</DependentUpon>
</Compile>
<Compile Include="Api\Lecture\LectureApi.cs" />
<Compile Include="Feed\Departments\DepartmentFeed.cs" />
<Compile Include="Pages\Departments\DepartmentFavoritePage.xaml.cs">
<DependentUpon>DepartmentFavoritePage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Departments\DepartmentIndexPage.xaml.cs">
<DependentUpon>DepartmentIndexPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Departments\DepartmentInfoPage.xaml.cs">
<DependentUpon>DepartmentInfoPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Departments\DepartmentPage.xaml.cs">
<DependentUpon>DepartmentPage.xaml</DependentUpon>
</Compile>
@@ -171,7 +182,7 @@
<Compile Include="Pages\News\NewsPage.xaml.cs">
<DependentUpon>NewsPage.xaml</DependentUpon>
</Compile>
<Compile Include="Model\Events\RSSModel.cs" />
<Compile Include="Model\RSS\RSSModel.cs" />
<Compile Include="Pages\Openinghours\OpeninghoursPage.xaml.cs">
<DependentUpon>OpeninghoursPage.xaml</DependentUpon>
</Compile>
@@ -195,17 +206,13 @@
<DesignTime>True</DesignTime>
<DependentUpon>Constants.resx</DependentUpon>
</Compile>
<Compile Include="Resources\Icons.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Icons.resx</DependentUpon>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Compile>
<Compile Include="Resources\Icons.Designer.cs" />
<Compile Include="ThemelizedIcons.cs" />
<Compile Include="Utility\Api.cs" />
<Compile Include="Utility\ApiEventHandler.cs" />
<Compile Include="Utility\Feed.cs" />
<Compile Include="Utility\FeedEventHandler.cs" />
<Compile Include="Utility\File.cs" />
<Compile Include="Utility\FileList.cs" />
<Compile Include="Utility\FileManager.cs" />
<Compile Include="Utility\Logger.cs" />
@@ -219,6 +226,7 @@
<Compile Include="Utility\URLList.cs" />
<Compile Include="Utility\XmlApi.cs" />
<Compile Include="Utility\XmlFeed.cs" />
<Compile Include="Utility\XmlFile.cs" />
<Compile Include="Utility\XmlManager.cs" />
</ItemGroup>
<ItemGroup>
@@ -230,6 +238,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Departments\DepartmentFavoritePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Departments\DepartmentIndexPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Departments\DepartmentInfoPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Departments\DepartmentPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -313,16 +333,24 @@
<Content Include="Assets\ApplicationIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Icons\DarkTheme\add_159.png" />
<Content Include="Assets\Icons\DarkTheme\btulogo_159.png" />
<Content Include="Assets\Icons\DarkTheme\campus_159.png" />
<Content Include="Assets\Icons\DarkTheme\delete_159.png" />
<Content Include="Assets\Icons\DarkTheme\favorite_159.png" />
<Content Include="Assets\Icons\DarkTheme\info_159.png" />
<Content Include="Assets\Icons\DarkTheme\phone_159.png" />
<Content Include="Assets\Icons\LightTheme\add_159.png" />
<Content Include="Assets\Icons\LightTheme\btulogo_159.png" />
<Content Include="Assets\Icons\LightTheme\campus_159.png" />
<Content Include="Assets\Icons\DarkTheme\departments_159.png" />
<Content Include="Assets\Icons\LightTheme\delete_159.png" />
<Content Include="Assets\Icons\LightTheme\departments_159.png" />
<Content Include="Assets\Icons\DarkTheme\homework_159.png" />
<Content Include="Assets\Icons\LightTheme\favorite_159.png" />
<Content Include="Assets\Icons\LightTheme\homework_159.png" />
<Content Include="Assets\Icons\DarkTheme\link_159.png" />
<Content Include="Assets\Icons\LightTheme\info_159.png" />
<Content Include="Assets\Icons\LightTheme\link_159.png" />
<Content Include="Assets\Icons\DarkTheme\lectures_159.png" />
<Content Include="Assets\Icons\LightTheme\lectures_159.png" />
@@ -358,7 +386,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="README_FIRST.txt" />
<None Include="Resources\Icon1.ico" />
<Content Include="Toolkit.Content\ApplicationBar.Cancel.png" />
<Content Include="Toolkit.Content\ApplicationBar.Check.png" />
<Content Include="Toolkit.Content\ApplicationBar.Delete.png" />
@@ -375,8 +402,6 @@
<LastGenOutput>Constants.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Icons.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Icons.Designer.cs</LastGenOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>

View File

@@ -0,0 +1,89 @@
//-----------------------------------------------------------------------
// <copyright file="DepartmentFavoriteFeed.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>01.07.2013</sience>
//----------------------------------------------------------------------using System;
namespace CampusAppWP8.Feed.Departments
{
using System;
using System.IO;
using CampusAppWP8.Model;
using CampusAppWP8.Model.Departments;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// Feed object to handle favorite department feeds.
/// </summary>
public class DepartmentFavoriteFeed : XmlModel<DepartmentModel>
{
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="DepartmentFavoriteFeed" /> class.
/// </summary>
public DepartmentFavoriteFeed(bool autoLoad = true)
: base(ModelType.File, Constants.FileDepartment_Favorite_Name, string.Empty)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
if (autoLoad == true)
{
this.LoadData();
}
}
// Constructor
#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>
private bool CheckIsModelUpToDate(DepartmentModel model)
{
bool retValue = true;
if((model == null)
|| (model.Faculties == null)
|| (model.Faculties.Count != 1))
{
retValue = false;
}
return retValue;
}
/// <summary>
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
/// </summary>
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(DepartmentModel model, FileInfo info)
{
bool retValue = false;
if (this.Model == null)
{
retValue = true;
}
else
{
retValue = (model.HasChanged() == false) ? true : false;
}
return retValue;
}
// Protected
#endregion
// Method
#endregion
}
}

View File

@@ -1,37 +1,109 @@
using CampusAppWP8.Model.Departments;
using CampusAppWP8.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CampusAppWP8.Api.Departments
//-----------------------------------------------------------------------
// <copyright file="DepartmentFeed.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Feed.Departments
{
class DepartmentFeed : XmlFeed<DepartmentViewModel>
using System;
using System.IO;
using CampusAppWP8.Model;
using CampusAppWP8.Model.Departments;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// Feed class for the department information.
/// </summary>
public class DepartmentFeed : XmlModel<DepartmentModel>
{
public DepartmentFeed() : base(URLList.DepartmentFeedURL, "DepartmentFeed.xml")
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="DepartmentFeed" /> class.
/// </summary>
public DepartmentFeed(bool autoLoad = true)
: base(ModelType.FileAndFeed, Constants.FileDepartment_Name, Constants.UrlDepartment_Addr)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
if (autoLoad == true)
{
this.LoadData();
}
}
public System.Collections.ObjectModel.ObservableCollection<FacultyModel> _faculties { get; set; }
// Constructor
#endregion
#region Method
#region Protected
/// <summary>
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>
/// 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(DepartmentModel model)
{
return false;
bool retValue = true;
if (model == null)
{
retValue = false;
}
else
{
TimeSpan diff = DateTime.Now.Subtract(model.CreateTime);
if (diff.TotalDays >= 7.0)
{
retValue = false;
}
}
return retValue;
}
/// <summary>
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>
/// 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(DepartmentModel model, FileInfo info)
{
return false;
bool retValue = true;
if (model == null) // at loading
{
if (info.Exists == true)
{
TimeSpan diff = DateTime.Now.Subtract(info.LastWriteTime);
if (diff.TotalDays >= 7.0)
{
retValue = false;
}
}
}
else // at saving
{
if ((info.Exists == false)
|| (info.Length == 0))
{
retValue = false;
}
}
return retValue;
}
// Protedted
#endregion
// Method
#endregion
}
}

View File

@@ -1,25 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CampusAppWP8.Model.events_news;
using CampusAppWP8.Utility;
//-----------------------------------------------------------------------
// <copyright file="EventFeed.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Api.Events
{
using CampusAppWP8.Model.RSS;
using CampusAppWP8.Utility;
/// <summary>
/// Event Feed.
/// </summary>
public class EventFeed : XmlFeed<RSSViewModel>
{
/// <summary>
/// Default constructor.
/// Initializes a new instance of the <see cref="EventFeed" /> class.
/// </summary>
public EventFeed() : base(URLList.EventsFeedURL, "EventFeed.xml")
{
}
/// <summary>
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>
/// </summary>

View File

@@ -1,21 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CampusAppWP8.Model.events_news;
using CampusAppWP8.Utility;
//-----------------------------------------------------------------------------
// <copyright file="NewsFeed.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Api.News
{
using CampusAppWP8.Model.RSS;
using CampusAppWP8.Utility;
/// <summary>
/// News Feed.
/// </summary>
public class NewsFeed : XmlFeed<RSSViewModel>
{
/// <summary>
/// Default constructor.
/// Initializes a new instance of the <see cref="NewsFeed" /> class.
/// </summary>
public NewsFeed() : base(URLList.NewsFeedURL, "NewsFeed.xml")
{

View File

@@ -1,88 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
//-----------------------------------------------------------------------
// <copyright file="ChairModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Departments
{
using System.Globalization;
using System.Xml.Serialization;
/// <summary>
/// Class to hold information about a professorship chair.
/// </summary>
public class ChairModel : BaseModel
public class ChairModel
{
private string name_de; // german name of the chair
private string url; // link-url to the chair homepage
private string name_en; // english name of the chair
/// <summary>
/// German name of the chair.
/// </summary>
private string nameDE = string.Empty;
/// <summary>
/// Default Constructor. Set every class variable to default value.
/// Link to the chair page.
/// </summary>
private string url = string.Empty;
/// <summary>
/// English name of the chair.
/// </summary>
private string nameEN = string.Empty;
/// <summary>
/// Initializes a new instance of the <see cref="ChairModel" /> class.
/// </summary>
public ChairModel()
{
this.name_de = String.Empty;
this.name_en = String.Empty;
this.url = String.Empty;
}
/// <summary>
/// Constructor. Set the german and english name.
/// Initializes a new instance of the <see cref="ChairModel" /> class.
/// </summary>
/// <param name="name">Name of the professorship chair.</param>
/// <param name="name">name of the chair</param>
public ChairModel(string name)
{
this.name_de = name;
this.name_en = name;
this.url = String.Empty;
this.nameDE = name;
this.nameEN = name;
}
/// <summary>
/// Set or return the german name of the chair.
/// Gets or sets the german name of the chair.
/// </summary>
[XmlAttribute("name_de")]
public string Name_DE
public string NameDE
{
get { return this.name_de; }
get
{
return this.nameDE;
}
set
{
if (value != this.name_de)
if (value != this.nameDE)
{
this.name_de = value;
NotifyPropertyChanged("chair");
this.nameDE = value;
}
}
}
/// <summary>
/// Set or return the english name of the chair.
/// Gets or sets the english name of the chair.
/// </summary>
[XmlAttribute("name_en")]
public string Name_EN
public string NameEN
{
get { return this.name_en; }
get
{
return this.nameEN;
}
set
{
if (value != this.name_en)
if (value != this.nameEN)
{
this.name_en = value;
NotifyPropertyChanged("chair");
this.nameEN = value;
}
}
}
/// <summary>
/// Set or return the url of the chair homepage.
/// Gets or sets the url of the chair homepage.
/// </summary>
[XmlAttribute("url")]
public string Url
{
get { return this.url; }
get
{
return this.url;
}
set
{
if (value != this.url)
{
this.url = value;
NotifyPropertyChanged("chair");
}
}
}
/// <summary>
/// Gets the localized name of the chair.
/// </summary>
public string Name
{
get
{
if (CultureInfo.CurrentUICulture.Name.StartsWith("de"))
{
return this.NameDE;
}
else
{
return this.NameEN;
}
}
}

View File

@@ -1,86 +1,91 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Xml.Serialization;
//-----------------------------------------------------------------------
// <copyright file="DepartmentModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Departments
{
public class DepartmentModel : BaseModel
{
[XmlElement("chair")]
public ObservableCollection<ChairModel> _chairs { get; set; }
private string _name = "d_mod";
private Visibility visible;
using System;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
/// <summary>
/// View model for department page.
/// </summary>
[XmlRoot("root")]
public class DepartmentModel
{
/// <summary>
/// Object to store the time when the instance was created.
/// </summary>
private DateTime createTime;
/// <summary>
/// List of faculties.
/// </summary>
private ObservableCollection<FacultyModel> faculties;
/// <summary>
/// Initializes a new instance of the <see cref="DepartmentModel" /> class.
/// </summary>
public DepartmentModel()
{
this.visible = Visibility.Collapsed;
this.Chairs = new ObservableCollection<ChairModel>();
//this.LoadData();
this.Faculties = new ObservableCollection<FacultyModel>();
this.createTime = DateTime.Now;
}
public DepartmentModel(string name)
{
this.visible = Visibility.Collapsed;
_name = name;
this.Chairs = new ObservableCollection<ChairModel>();
//this.LoadData();
}
public void LoadData()
{
this.Chairs.Add(new ChairModel("LS 1"));
this.Chairs.Add(new ChairModel("LS 2"));
this.Chairs.Add(new ChairModel("LS 3"));
this.Chairs.Add(new ChairModel("LS 4"));
}
public ObservableCollection<ChairModel> Chairs
/// <summary>
/// Gets or sets the faculty list.
/// </summary>
[XmlArray("professorships")]
[XmlArrayItem("faculty")]
public ObservableCollection<FacultyModel> Faculties
{
get
{
return _chairs;
return this.faculties;
}
set
{
if (value != _chairs)
if (value != this.faculties)
{
_chairs = value;
NotifyPropertyChanged("department");
this.faculties = value;
}
}
}
public string Name
/// <summary>
/// Gets the creation time.
/// </summary>
public DateTime CreateTime
{
get
{
return _name;
}
set
{
if (value != _name)
{
_name = value;
NotifyPropertyChanged("chair");
}
return this.createTime;
}
}
public Visibility Visible
/// <summary>
/// Check if the content of the faculty lists hast changed since the
/// last call of this function.
/// </summary>
/// <returns>true, if changes happend since last request, otherwise false</returns>
public bool HasChanged()
{
get { return this.visible; }
set
bool retValue = false;
foreach (FacultyModel temp in this.Faculties)
{
if (value != this.visible)
if ((temp.HasChanged() == true) && (retValue == false))
{
this.visible = value;
retValue = true;
}
}
return retValue;
}
}
}

View File

@@ -1,39 +0,0 @@
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.Departments
{
[XmlRoot("root")]
public class DepartmentViewModel : BaseViewModel
{
[XmlArray("professorships")]
[XmlArrayItem("faculty")]
public ObservableCollection<FacultyModel> _faculties { get; set; }
public DepartmentViewModel()
{
this.Faculties = new ObservableCollection<FacultyModel>();
}
public ObservableCollection<FacultyModel> Faculties
{
get
{
return _faculties;
}
set
{
if (value != _faculties)
{
_faculties = value;
NotifyPropertyChanged("foodDays");
}
}
}
}
}

View File

@@ -1,62 +1,238 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using CampusAppWP8.Resources;
//-----------------------------------------------------------------------
// <copyright file="FacultyModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Departments
{
public class FacultyModel : BaseModel
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using CampusAppWP8.Resources;
/// <summary>
/// Model for holding the faculty information.
/// </summary>
public class FacultyModel
{
[XmlElement("chair")]
public ObservableCollection<ChairModel> chairs { get; set; }
//public ObservableCollection<DepartmentModel> _faculties { get; set; }
private string name = "t_fak";
/// <summary>
/// Object to hold the information of the chair containing to this
/// faculty.
/// </summary>
private ObservableCollection<ChairModel> chairs;
/// <summary>
/// Name of the faculty.
/// </summary>
private string name = string.Empty;
/// <summary>
/// For checking of change.
/// </summary>
private bool hasChanged = false;
/// <summary>
/// Initializes a new instance of the <see cref="FacultyModel" /> class.
/// </summary>
public FacultyModel()
{
//this.Faculties = new ObservableCollection<DepartmentModel>();
this.chairs = new ObservableCollection<ChairModel>();
}
/// <summary>
/// Initializes a new instance of the <see cref="FacultyModel" /> class.
/// </summary>
/// <param name="name">name of the faculty</param>
public FacultyModel(string name)
{
this.name = name;
//this.Faculties = new ObservableCollection<DepartmentModel>();
this.chairs = new ObservableCollection<ChairModel>();
}
/// <summary>
/// Gets or sets the list of the chairs containing to this faculty.
/// </summary>
[XmlElement("chair")]
public ObservableCollection<ChairModel> Chairs
{
get { return this.chairs; }
get
{
return this.chairs;
}
set
{
if (value != this.chairs)
{
this.chairs = value;
NotifyPropertyChanged("faculty");
}
}
}
[XmlAttribute("id")]
/// <summary>
/// Gets the name of the faculty.
/// </summary>
public string Name
{
get
{
return AppResources.Faculty + " " + this.name;
}
}
/// <summary>
/// Gets or sets the id of the faculty.
/// </summary>
[XmlAttribute("id")]
public string Id
{
get
{
return this.name;
}
set
{
if (value != this.name)
this.name = value;
}
}
/// <summary>
/// Remove a chair model from the lost.
/// </summary>
/// <param name="chairName">name of the chair</param>
/// <returns>true, if succeeded</returns>
public bool RemoveChair(string chairName)
{
bool retValue = false;
ChairModel tempChair = null;
foreach (ChairModel temp in this.Chairs)
{
if (temp.Name.Equals(chairName) == true)
{
this.name = value;
NotifyPropertyChanged("faculty");
tempChair = temp;
}
}
if (tempChair != null)
{
retValue = this.Chairs.Remove(tempChair);
this.hasChanged = true;
}
return retValue;
}
/// <summary>
/// Add a chair to the list, if it does not already exist.
/// </summary>
/// <param name="chairModel">chair model to add</param>
/// <returns>true, is succeeded</returns>
public bool AddChair(ChairModel chairModel)
{
bool retValue = false;
if ((chairModel != null)
&& (this.Chairs.Contains(chairModel) == false))
{
bool isIn = false;
foreach (ChairModel temp in this.Chairs)
{
if ((temp.NameDE.Equals(chairModel.NameDE) == true)
|| (temp.NameEN.Equals(chairModel.NameEN) == true))
{
isIn = true;
}
}
if (isIn == false)
{
this.Chairs.Add(chairModel);
this.hasChanged = true;
retValue = true;
}
}
return retValue;
}
/// <summary>
/// Create a chair model and add it to the list, if it does not already
/// exist.
/// </summary>
/// <param name="nameDE">german name of the chair</param>
/// <param name="nameEN">english name of the chair</param>
/// <param name="url">url of the chair home page</param>
/// <returns>true, if succeeded</returns>
public bool AddChair(string nameDE, string nameEN, string url)
{
bool retValue = false;
bool isIn = false;
foreach (ChairModel temp in this.Chairs)
{
if ((temp.NameDE.Equals(nameDE) == true)
|| (temp.NameEN.Equals(nameEN) == true))
{
isIn = true;
}
}
if (isIn == false)
{
ChairModel newModel = new ChairModel();
newModel.NameDE = nameDE;
newModel.NameEN = nameEN;
newModel.Url = url;
this.Chairs.Add(newModel);
this.hasChanged = true;
retValue = true;
}
return retValue;
}
/// <summary>
/// Return the chair model of the chair with the specified name.
/// </summary>
/// <param name="name">name of the chair</param>
/// <returns>chair model, if succeeded, otherwise null</returns>
public ChairModel GetChairModel(string name)
{
ChairModel retValue = null;
foreach (ChairModel temp in this.Chairs)
{
if (temp.Name.Equals(name) == true)
{
retValue = temp;
}
}
return retValue;
}
/// <summary>
/// Return true if there were changes in the chair list, otherwise false.
/// </summary>
/// <param name="reset">when true, the hasChanged flag will be reseted</param>
/// <returns>true, when changed, otherwise false</returns>
public bool HasChanged(bool reset = true)
{
bool retValue = this.hasChanged;
if (reset == true)
{
this.hasChanged = false;
}
return retValue;
}
}
}

View File

@@ -1,47 +0,0 @@
using CampusAppWP8.Model;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
namespace CampusAppWP8.Model.events_news
{
/// <summary>
/// ViewModel of the rss feed, containing the feed/channel object.
/// </summary>
[XmlRoot("root")]
public class RSSViewModel : BaseViewModel
{
/// <summary>
/// channel list for the rss feeds.
/// </summary>
[XmlArray("rss")]
[XmlArrayItem("channel")]
public ObservableCollection<RSSChannelModel> channel { get; set; }
/// <summary>
/// Default constructor.
/// </summary>
public RSSViewModel()
{
this.channel = new ObservableCollection<RSSChannelModel>();
}
/// <summary>
/// Set/Get the channel list.
/// </summary>
public ObservableCollection<RSSChannelModel> Channel
{
get
{
return this.channel;
}
set
{
if (value != this.channel)
{
this.channel = value;
NotifyPropertyChanged("channel");
}
}
}
}
}

View File

@@ -15,13 +15,10 @@
OrientationChanged="PhoneApplicationPage_OrientationChanged"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.Resources>
<viewModel:DepartmentViewModel x:Key="DepartmentViewModel" x:Name="DepartmentView" />
</phone:PhoneApplicationPage.Resources>
<!-- LayoutRoot -->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.DataContext>
<viewModel:DepartmentViewModel />
<viewModel:DepartmentModel />
</Grid.DataContext>
<!-- Pivot -->
<phone:Pivot x:Name="DepartmentPivot" Title="{Binding Path=LocalizedResources.DepartmentApp_Title, Source={StaticResource LocalizedStrings}}" ItemsSource="{Binding Faculties}">
@@ -33,30 +30,50 @@
</phone:Pivot.HeaderTemplate>
<phone:Pivot.ItemTemplate>
<DataTemplate>
<!-- TEMPORARILY REMOVED, will be abck in soon
<phone:LongListSelector ItemsSource="{Binding Faculties}">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel>
<Button x:Name="DepartmentBtn" Content="{Binding Name}" Background="Gray" BorderBrush="Gray" Foreground="Black" Click="DepartmentBtn_Click"/>
<phone:LongListSelector Tag="{Binding Name}" Visibility="{Binding Visible}" ItemsSource="{Binding Chairs}">
-->
<ListBox ItemsSource="{Binding Chairs}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock x:Name="ChairTB" Tag="{Binding Url}" Text="{Binding Name_DE}" MouseLeftButtonDown="ChairTB_Click" Margin="12,6,12,6" Padding="0,0,0,0" HorizontalAlignment="Stretch" TextWrapping="Wrap" FontSize="24"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--
<ListBox ItemsSource="{Binding Chairs}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<!--chair button-->
<Button Tag="{Binding Url}" Click="ChairTB_Click" HorizontalContentAlignment="Left">
<TextBlock Text="{Binding Name}" HorizontalAlignment="Stretch" TextWrapping="Wrap" FontSize="24"/>
</Button>
<StackPanel Visibility="Collapsed">
<!--add to favorite button-->
<Button BorderBrush="Transparent" Tag="{Binding Name}" Click="AddBtn_Click" HorizontalContentAlignment="Left">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Grid.Row="0" Height="32" Width="32" Source="{Binding Path=ThemelizedIcon.Add, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=LocalizedResources.Add, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"/>
</Grid>
</Button>
<!--info button-->
<Button x:Name="InfoBtn" BorderBrush="Transparent" Tag="{Binding Url}" Click="InfoBtn_Click" HorizontalContentAlignment="Left">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Grid.Row="0" Height="32" Width="32" Source="{Binding Path=ThemelizedIcon.Info, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=LocalizedResources.Info, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"/>
</Grid>
</Button>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
-->
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DataTemplate>
</phone:Pivot.ItemTemplate>
</phone:Pivot>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -1,130 +1,149 @@
using CampusAppWP8.Api.Departments;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
//-----------------------------------------------------------------------
// <copyright file="DepartmentPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Departments
{
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
/// <summary>
/// Pivot page with list of the chairs of the facultis.
/// Pivot page with list of the chairs of the faculties.
/// </summary>
public partial class DepartmentPage : PhoneApplicationPage
{
/// <summary>
/// Stores the last visible department panel.
/// For checking, if the source of the list is already set.
/// </summary>
private UIElement lastVisibleUIElem = null;
private bool isSourceSet = false;
/// <summary>
/// department/chair feed object, storing the model and data.
/// Last clicked button object.
/// </summary>
private DepartmentFeed feed { get; set; }
private FrameworkElement lastClickedBtn = null;
/// <summary>
/// Default constructor.
/// Initializes a new instance of the <see cref="DepartmentPage" /> class.
/// </summary>
public DepartmentPage()
{
InitializeComponent();
// init feed object
this.feed = new DepartmentFeed();
this.InitializeComponent();
}
/// <summary>
/// On naviagtion to this page.
/// Init the feed loading.
/// On navigation to this page.
/// Initialize the feed loading.
/// </summary>
/// <param name="e">event args</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(SetupDepartmentPivot);
this.feed.LoadFeed();
}
if (this.isSourceSet == false)
{
this.DepartmentPivot.ItemsSource = DepartmentIndexPage.GetFeed().GetModel().Faculties;
this.isSourceSet = true;
}
/// <summary>
/// Called after the feeds are loaded.
/// Set the pivotitem source of this page.
/// </summary>
private void SetupDepartmentPivot()
{
DepartmentPivot.ItemsSource = feed.Model._faculties;
string pivotIndex = string.Empty;
// Navigate to the selected pivotitem
if (NavigationContext.QueryString.TryGetValue("pivotindex", out pivotIndex))
{
int pivotIndexInt = int.Parse(pivotIndex) - 1;
// if the index is in the range of the array
if ((pivotIndexInt >= 0) && (pivotIndexInt < DepartmentIndexPage.GetFeed().GetModel().Faculties.Count()))
{
DepartmentPivot.SelectedIndex = pivotIndexInt;
}
else
{
MessageBox.Show("ERROR: pivotIndex out of range!!!");
}
}
}
/// <summary>
/// On orientation changed.
/// </summary>
/// <param name="sender">unused</param>
/// <param name="e">unused</param>
/// <param name="sender">sender object</param>
/// <param name="e">event args</param>
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
}
/// <summary>
/// Called at clicking on the department headline buttons.
/// Collapses all visible department panels and open (set to visible)
/// the clicked department list.
/// On clicking a chair TextBlock.
/// Open the browser with the url of the chair.
/// </summary>
/// <param name="sender">clicked department button</param>
/// <param name="e">unused</param>
private void DepartmentBtn_Click(object sender, RoutedEventArgs e)
/// <param name="sender">clicked chair TextBlock</param>
/// <param name="e">event args</param>
private void ChairTB_Click(object sender, RoutedEventArgs e)
{
// if the sender was a button
if(sender is Button)
FrameworkElement tempBtn = sender as FrameworkElement;
StackPanel tempParent = null;
if (this.lastClickedBtn != tempBtn)
{
Button btn = sender as Button;
// if the parent is a stackpanel
if(btn.Parent is StackPanel)
if (this.lastClickedBtn != null)
{
StackPanel pan = (StackPanel)btn.Parent;
// if there is a child after the clicked button in the parent panel
if ((pan.Children.Count() > 1) && (pan.Children[1] != null))
{
// if the clicked department wasn't the one clicked before
if (pan.Children[1] != this.lastVisibleUIElem)
{
// collapse the last visible chair list
if (this.lastVisibleUIElem != null)
this.lastVisibleUIElem.Visibility = Visibility.Collapsed;
// open the choosen chair list
pan.Children[1].Visibility = Visibility.Visible;
this.lastVisibleUIElem = pan.Children[1];
}
}
tempParent = this.lastClickedBtn.Parent as StackPanel;
tempParent.Children[1].Visibility = Visibility.Collapsed;
}
tempParent = tempBtn.Parent as StackPanel;
tempParent.Children[1].Visibility = Visibility.Visible;
this.lastClickedBtn = tempBtn;
}
else
{
tempParent = this.lastClickedBtn.Parent as StackPanel;
tempParent.Children[1].Visibility = Visibility.Collapsed;
this.lastClickedBtn = null;
}
}
/// <summary>
/// On clicking a chair textbolock.
/// Open the browser with the url of the chair.
/// On clicking on a add button.
/// Add the chair to the favorite list.
/// </summary>
/// <param name="sender">clicked chair textblock</param>
/// <param name="e"></param>
private void ChairTB_Click(object sender, RoutedEventArgs e)
/// <param name="sender">clicked button</param>
/// <param name="e">event args</param>
private void AddBtn_Click(object sender, RoutedEventArgs e)
{
if (sender is FrameworkElement)
{
FrameworkElement btn = sender as FrameworkElement;
Button btn = this.lastClickedBtn as Button;
TextBlock btnText = btn.Content as TextBlock;
// if the chair has a url in the tag element
if ((btn.Tag != null) && ((btn.Tag as string).Length > 0))
{
// open browser with the url
WebBrowserTask task = new WebBrowserTask();
task.Uri = new Uri(btn.Tag.ToString(), UriKind.Absolute);
task.Show();
}
Model.Departments.ChairModel tempModel = DepartmentIndexPage.GetFeed().GetModel().Faculties[this.DepartmentPivot.SelectedIndex].GetChairModel(btnText.Text);
if (tempModel != null)
{
DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].AddChair(tempModel);
}
}
/// <summary>
/// On clicking on a info button.
/// Open the info page to this chair.
/// </summary>
/// <param name="sender">clicked button</param>
/// <param name="e">event args</param>
private void InfoBtn_Click(object sender, RoutedEventArgs e)
{
FrameworkElement infoBtn = sender as FrameworkElement;
string chairName = ((this.lastClickedBtn as Button).Content as TextBlock).Text.ToString();
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentInfoPage + "?url=" + infoBtn.Tag.ToString() + "&name=" + chairName, UriKind.Relative));
}
}
}

View File

@@ -19,9 +19,9 @@ namespace CampusAppWP8.Pages.Events
public partial class EventIndexPage : PhoneApplicationPage
{
/// <summary>
/// Gets or sets Event Feed object, which contains the RSS models and data.
/// Event Feed object, which contains the RSS models and data.
/// </summary>
public static EventFeed eventFeed { get; set; }
private static EventFeed eventFeed;
/// <summary>
/// Initializes a new instance of the <see cref="EventIndexPage" /> class.
@@ -32,6 +32,17 @@ namespace CampusAppWP8.Pages.Events
EventIndexPage.eventFeed = new EventFeed();
}
/// <summary>
/// Gets the eventFeed object.
/// </summary>
public static EventFeed GetEventFeed
{
get
{
return EventIndexPage.eventFeed;
}
}
/// <summary>
/// On navigation to this page, creates a FeedEventHandler and load the RSS feed data.
/// </summary>
@@ -43,8 +54,8 @@ namespace CampusAppWP8.Pages.Events
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))
|| (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);
@@ -53,7 +64,8 @@ namespace CampusAppWP8.Pages.Events
}
/// <summary>
/// Is called after the RSS feeds are loaded into the newsFeed model.
/// 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.
/// </summary>
@@ -61,13 +73,5 @@ namespace CampusAppWP8.Pages.Events
{
this.EventList.ItemsSource = EventIndexPage.eventFeed.Model.Channel[0].Item;
}
/// <summary>
/// Gets the eventFeed object.
/// </summary>
public static EventFeed GetEventFeed
{
get { return EventIndexPage.eventFeed; }
}
}
}

View File

@@ -6,7 +6,7 @@
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.events_news"
xmlns:viewModel="clr-namespace:CampusAppWP8.Model.RSS"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"

View File

@@ -14,8 +14,7 @@ namespace CampusAppWP8.Pages.Events
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
/// <summary>
/// EventPage, where every event fees has his own PivotItem.
/// </summary>
@@ -51,7 +50,7 @@ namespace CampusAppWP8.Pages.Events
&& (EventIndexPage.GetEventFeed.Model.Channel != null)
&& (EventIndexPage.GetEventFeed.Model.Channel.Count() >= 1))
{
this.EventPivot.ItemsSource = EventIndexPage.GetEventFeed.Model.Channel[0].item;
this.EventPivot.ItemsSource = EventIndexPage.GetEventFeed.Model.Channel[0].Item;
this.isSourceSet = true;
}
}
@@ -64,7 +63,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;
}

View File

@@ -19,9 +19,9 @@ namespace CampusAppWP8.Pages.News
public partial class NewsIndexPage : PhoneApplicationPage
{
/// <summary>
/// Gets or sets News Feed object, which contains the RSS models and data.
/// News Feed object, which contains the RSS models and data.
/// </summary>
public static NewsFeed newsFeed { get; set; }
private static NewsFeed newsFeed;
/// <summary>
/// Initializes a new instance of the <see cref="NewsIndexPage" /> class.
@@ -32,6 +32,17 @@ namespace CampusAppWP8.Pages.News
NewsIndexPage.newsFeed = new NewsFeed();
}
/// <summary>
/// Gets the newsFeed object.
/// </summary>
public static NewsFeed GetNewsFeed
{
get
{
return NewsIndexPage.newsFeed;
}
}
/// <summary>
/// On navigation to this page, creates a FeedEventHandler and load the RSS feed data.
/// </summary>
@@ -43,8 +54,8 @@ namespace CampusAppWP8.Pages.News
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))
|| (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);
@@ -61,13 +72,5 @@ namespace CampusAppWP8.Pages.News
{
this.NewsList.ItemsSource = NewsIndexPage.newsFeed.Model.Channel[0].Item;
}
/// <summary>
/// Gets the newsFeed object.
/// </summary>
public static NewsFeed GetNewsFeed
{
get { return NewsIndexPage.newsFeed; }
}
}
}

View File

@@ -6,7 +6,7 @@
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.events_news"
xmlns:viewModel="clr-namespace:CampusAppWP8.Model.RSS"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"

View File

@@ -14,7 +14,6 @@ namespace CampusAppWP8.Pages.News
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
/// <summary>
/// EventPage, where every news fees has his own PivotItem.
@@ -52,7 +51,7 @@ namespace CampusAppWP8.Pages.News
&& (NewsIndexPage.GetNewsFeed.Model.Channel.Count() >= 1)
&& (this.NewsPivot.Items.Count() == 0))
{
this.NewsPivot.ItemsSource = NewsIndexPage.GetNewsFeed.Model.Channel[0].item;
this.NewsPivot.ItemsSource = NewsIndexPage.GetNewsFeed.Model.Channel[0].Item;
this.isSourceSet = true;
}
}
@@ -65,7 +64,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;
}

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
@@ -60,6 +60,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Hinzufügen ähnelt.
/// </summary>
public static string Add {
get {
return ResourceManager.GetString("Add", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Hinzufügen ähnelt.
/// </summary>
@@ -132,6 +141,33 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Löschen ähnelt.
/// </summary>
public static string Delete {
get {
return ResourceManager.GetString("Delete", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Löschung ist fehlgeschlagen ähnelt.
/// </summary>
public static string DeleteFailed {
get {
return ResourceManager.GetString("DeleteFailed", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Löschung war erfolgreich ähnelt.
/// </summary>
public static string DeleteSucceeded {
get {
return ResourceManager.GetString("DeleteSucceeded", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Lehrstühle ähnelt.
/// </summary>
@@ -159,6 +195,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Favoriten ähnelt.
/// </summary>
public static string Favorites {
get {
return ResourceManager.GetString("Favorites", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
/// </summary>
@@ -186,6 +231,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Details ähnelt.
/// </summary>
public static string Info {
get {
return ResourceManager.GetString("Info", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt.
/// </summary>
@@ -303,24 +357,6 @@ 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>

View File

@@ -287,11 +287,23 @@
<data name="Time_Day_Sunday" xml:space="preserve">
<value>Sonntag</value>
</data>
<data name="LinkApp_ClubLinks" xml:space="preserve">
<value>stud. Vereine</value>
<data name="Add" xml:space="preserve">
<value>Hinzufügen</value>
</data>
<data name="LinkApp_CommonLinks" xml:space="preserve">
<value>allg. Links</value>
<data name="Favorites" xml:space="preserve">
<value>Favoriten</value>
</data>
<data name="Info" xml:space="preserve">
<value>Details</value>
</data>
<data name="Delete" xml:space="preserve">
<value>Löschen</value>
</data>
<data name="DeleteFailed" xml:space="preserve">
<value>Löschung ist fehlgeschlagen</value>
</data>
<data name="DeleteSucceeded" xml:space="preserve">
<value>Löschung war erfolgreich</value>
</data>
<data name="HomeworkApp_Title" xml:space="preserve">
<value>Hausaufgaben</value>

View File

@@ -60,6 +60,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
/// </summary>
public static string FileDepartment_Favorite_Name {
get {
return ResourceManager.GetString("FileDepartment_Favorite_Name", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFeed.xml ähnelt.
/// </summary>
public static string FileDepartment_Name {
get {
return ResourceManager.GetString("FileDepartment_Name", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die ClubLinks.xml ähnelt.
/// </summary>
@@ -87,6 +105,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die ähnelt.
/// </summary>
public static string IsolatedStorage_DepartmentFavoriteModel {
get {
return ResourceManager.GetString("IsolatedStorage_DepartmentFavoriteModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die LectureModel ähnelt.
/// </summary>
@@ -195,6 +222,42 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Departments/DepartmentFavoritePage.xaml ähnelt.
/// </summary>
public static string PathDepartment_DepartmentFavoritePage {
get {
return ResourceManager.GetString("PathDepartment_DepartmentFavoritePage", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Departments/DepartmentIndexPage.xaml ähnelt.
/// </summary>
public static string PathDepartment_DepartmentIndexPage {
get {
return ResourceManager.GetString("PathDepartment_DepartmentIndexPage", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Departments/DepartmentInfoPage.xaml ähnelt.
/// </summary>
public static string PathDepartment_DepartmentInfoPage {
get {
return ResourceManager.GetString("PathDepartment_DepartmentInfoPage", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Departments/DepartmentPage.xaml ähnelt.
/// </summary>
public static string PathDepartment_DepartmentPage {
get {
return ResourceManager.GetString("PathDepartment_DepartmentPage", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Events/EventPage.xaml ähnelt.
/// </summary>
@@ -286,7 +349,7 @@ namespace CampusAppWP8.Resources {
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /pages/news/NewsPage.xaml ähnelt.
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/News/NewsPage.xaml ähnelt.
/// </summary>
public static string PathNews_NewsPage {
get {
@@ -321,6 +384,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/professorships.xml ähnelt.
/// </summary>
public static string UrlDepartment_Addr {
get {
return ResourceManager.GetString("UrlDepartment_Addr", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://www.zv.tu-cottbus.de/LSFveranst/LSF4 ähnelt.
/// </summary>
@@ -340,7 +412,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&amp;amp;app=2&amp;amp;appversion=1 ähnelt.
/// </summary>
public static string UrlLink_ClubLinks {
get {
@@ -349,7 +421,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&amp;amp;app=2&amp;amp;appversion=1 ähnelt.
/// </summary>
public static string UrlLink_CommonLinks {
get {
@@ -358,7 +430,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&amp;amp;app=2&amp;amp;appversion=1 ähnelt.
/// </summary>
public static string UrlStudentCouncil_StudentCouncils {
get {

View File

@@ -189,26 +189,50 @@
<data name="PathOpeninghours_OpeninghoursPage" xml:space="preserve">
<value>/Pages/Openinghours/OpeninghoursPage.xaml</value>
</data>
<data name="IsolatedStorage_DepartmentFavoriteModel" xml:space="preserve">
<value />
</data>
<data name="FileDepartment_Favorite_Name" xml:space="preserve">
<value>DepartmentFavoriteFeed.xml</value>
</data>
<data name="FileDepartment_Name" xml:space="preserve">
<value>DepartmentFeed.xml</value>
</data>
<data name="PathDepartment_DepartmentIndexPage" xml:space="preserve">
<value>/Pages/Departments/DepartmentIndexPage.xaml</value>
</data>
<data name="UrlDepartment_Addr" xml:space="preserve">
<value>http://www.tu-cottbus.de/campusapp-data/professorships.xml</value>
</data>
<data name="PathDepartment_DepartmentFavoritePage" xml:space="preserve">
<value>/Pages/Departments/DepartmentFavoritePage.xaml</value>
</data>
<data name="PathDepartment_DepartmentInfoPage" xml:space="preserve">
<value>/Pages/Departments/DepartmentInfoPage.xaml</value>
</data>
<data name="PathDepartment_DepartmentPage" xml:space="preserve">
<value>/Pages/Departments/DepartmentPage.xaml</value>
</data>
<data name="FileLink_ClubLinks" xml:space="preserve">
<value>ClubLinks.xml</value>
</data>
<data name="FileLink_CommonLinks" xml:space="preserve">
<value>CommonLinks.xml</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>
<data name="FileStudentCouncil_StudentCouncils" xml:space="preserve">
<value>StudentCouncils.xml</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>
<data name="ParamPivotIndex" xml:space="preserve">
<value>pivotindex</value>
</data>
<data name="PathEvent_EventPage" xml:space="preserve">
<value>/Pages/Events/EventPage.xaml</value>
</data>
<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 name="PathNews_NewsPage" xml:space="preserve">
<value>/Pages/News/NewsPage.xaml</value>
</data>
<data name="PathStudentCouncil_StudentCouncilPage" xml:space="preserve">
<value>/Pages/StudentCouncil/StudentCouncilPage.xaml</value>
@@ -216,13 +240,13 @@
<data name="ToggleContent" xml:space="preserve">
<value>ToggleContent</value>
</data>
<data name="ParamPivotIndex" xml:space="preserve">
<value>pivotindex</value>
<data name="UrlLink_ClubLinks" xml:space="preserve">
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=clubs&amp;amp;app=2&amp;amp;appversion=1</value>
</data>
<data name="PathNews_NewsPage" xml:space="preserve">
<value>/pages/news/NewsPage.xaml</value>
<data name="UrlLink_CommonLinks" xml:space="preserve">
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=links&amp;amp;app=2&amp;amp;appversion=1</value>
</data>
<data name="PathEvent_EventPage" xml:space="preserve">
<value>/Pages/Events/EventPage.xaml</value>
<data name="UrlStudentCouncil_StudentCouncils" xml:space="preserve">
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&amp;amp;app=2&amp;amp;appversion=1</value>
</data>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

View File

@@ -1,42 +1,40 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.18046
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
//-----------------------------------------------------------------------
// <copyright file="Icons.Designer.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>28.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Resources
{
using System;
using System.Windows;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// Icons uri string.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Icons
{
/// <summary>
/// Resource manager object.
/// </summary>
private static global::System.Resources.ResourceManager resourceMan;
/// <summary>
/// Culture information object.
/// </summary>
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
/// <summary>
/// Initializes a new instance of the <see cref="Icons" /> class.
/// </summary>
internal Icons()
{
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// Gets the resource manager.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager
@@ -45,18 +43,16 @@ namespace CampusAppWP8.Resources
{
if (object.ReferenceEquals(resourceMan, null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CampusAppWP8.Resources.Icons",
typeof(Icons).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CampusAppWP8.Resources.Icons", typeof(Icons).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// Gets or sets the culture information.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture
@@ -65,6 +61,7 @@ typeof(Icons).Assembly);
{
return resourceCulture;
}
set
{
resourceCulture = value;
@@ -72,30 +69,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Returns the full filename of the icon, depending on the current theme.
/// </summary>
/// <param name="_key">Tagname</param>
/// <returns>Filename</returns>
private static string Themerize(string _key)
{
string retValue = string.Empty;
if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible)
{
retValue = "/Assets/Icons/DarkTheme/";
}
else
{
retValue = "/Assets/Icons/LightTheme/";
}
retValue += ResourceManager.GetString(_key, resourceCulture);
return retValue;
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die campus_159.png ähnelt.
/// Gets the uri string of the campus icon.
/// </summary>
public static string Campus
{
@@ -106,7 +80,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die departments_159.png ähnelt.
/// Gets the uri string of the departments icon.
/// </summary>
public static string Departments
{
@@ -117,7 +91,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die homework_159.png ähnelt.
/// Gets the uri string of the homework icon.
/// </summary>
public static string Homework
{
@@ -128,7 +102,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die lectures_159.png ähnelt.
/// Gets the uri string of the lectures icon.
/// </summary>
public static string Lectures
{
@@ -139,7 +113,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die link_159.png ähnelt.
/// Gets the uri string of the link icon.
/// </summary>
public static string Link
{
@@ -150,7 +124,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die mensa_159.png ähnelt.
/// Gets the uri string of the mensa icon.
/// </summary>
public static string Mensa
{
@@ -161,7 +135,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die news_159.png ähnelt.
/// Gets the uri string of the news icon.
/// </summary>
public static string News
{
@@ -172,7 +146,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die openhours_159.png ähnelt.
/// Gets the uri string of the opening hours icon.
/// </summary>
public static string Openhours
{
@@ -183,7 +157,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die schedule_159.png ähnelt.
/// Gets the uri string of the schedule icon.
/// </summary>
public static string Schedule
{
@@ -194,7 +168,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die search_159.png ähnelt.
/// Gets the uri string of the search icon.
/// </summary>
public static string Search
{
@@ -205,7 +179,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die student_council_159.png ähnelt.
/// Gets the uri string of the student council icon.
/// </summary>
public static string StudentCouncil
{
@@ -216,7 +190,7 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die webmail_159.png ähnelt.
/// Gets the uri string of the web mail icon.
/// </summary>
public static string WebMail
{
@@ -227,7 +201,51 @@ typeof(Icons).Assembly);
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die phone_159.png ähnelt.
/// Gets the uri string of the favorite icon.
/// </summary>
public static string Favorite
{
get
{
return Themerize("Favorite");
}
}
/// <summary>
/// Gets the uri string of the delete icon.
/// </summary>
public static string Delete
{
get
{
return Themerize("Delete");
}
}
/// <summary>
/// Gets the uri string of the info icon.
/// </summary>
public static string Info
{
get
{
return Themerize("Info");
}
}
/// <summary>
/// Gets the uri string of the add icon.
/// </summary>
public static string Add
{
get
{
return Themerize("Add");
}
}
/// <summary>
/// Gets the uri string of the phone icon.
/// </summary>
public static string Phone
{
@@ -236,5 +254,28 @@ typeof(Icons).Assembly);
return Themerize("Phone");
}
}
/// <summary>
/// Return the theme depending string of a icon.
/// </summary>
/// <param name="key">icon name</param>
/// <returns>uri string of the icon</returns>
private static string Themerize(string key)
{
string retValue = string.Empty;
if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible)
{
retValue = "/Assets/Icons/DarkTheme/";
}
else
{
retValue = "/Assets/Icons/LiehgtTheme/";
}
retValue += ResourceManager.GetString(key, resourceCulture);
return retValue;
}
}
}

View File

@@ -117,15 +117,27 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Add" xml:space="preserve">
<value>add_159.png</value>
</data>
<data name="Campus" xml:space="preserve">
<value>campus_159.png</value>
</data>
<data name="Delete" xml:space="preserve">
<value>delete_159.png</value>
</data>
<data name="Departments" xml:space="preserve">
<value>departments_159.png</value>
</data>
<data name="Favorite" xml:space="preserve">
<value>favorite_159.png</value>
</data>
<data name="Homework" xml:space="preserve">
<value>homework_159.png</value>
</data>
<data name="Info" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="Lectures" xml:space="preserve">
<value>lectures_159.png</value>
</data>

View File

@@ -15,7 +15,7 @@ namespace CampusAppWP8.Utility
/// <summary>
/// Class realize the access of restful HttpRequest
/// </summary>
public abstract class HttpRequest
public class HttpRequest
{
#region Members

View File

@@ -7,6 +7,7 @@
//----------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
using System.IO;
using System.Xml.Linq;
using System.Xml.Serialization;
@@ -36,5 +37,39 @@ namespace CampusAppWP8.Utility
T model = (T)serializer.Deserialize(document.CreateReader());
return model;
}
/// <summary>
/// Method serializes a model to a string.
/// </summary>
/// <typeparam name="T">type of the model</typeparam>
/// <param name="model">model object</param>
/// <returns>serialized string</returns>
public static string SerializationToString<T>(T model)
{
string retValue = string.Empty;
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add("", "");
XmlSerializer serializer = new XmlSerializer(typeof(T));
TextWriter writer = new StringWriter();
serializer.Serialize(writer, model, ns);
retValue = writer.ToString();
if (retValue.StartsWith("<?xml") == true)
{
int endTag = retValue.IndexOf("?>");
retValue = retValue.Substring(endTag + 2);
if (retValue.StartsWith("\r\n") == true)
{
retValue = retValue.Substring(2);
}
}
return retValue;
}
}
}

View File

@@ -0,0 +1,424 @@
//-----------------------------------------------------------------------------
// <copyright file="MainModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.07.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8
{
using System;
using System.IO;
using System.Net;
using System.Text;
using CampusAppWP8.Utility;
/// <summary>
/// Base model io handling class.
/// </summary>
/// <typeparam name="T">model type</typeparam>
public abstract class MainModel<T> : IDisposable
{
/// <summary>
/// Model io type.
/// </summary>
private ModelType modelType;
/// <summary>
/// Model object.
/// </summary>
private T model = default(T);
/// <summary>
/// File object.
/// </summary>
private CampusAppWP8.Utility.File file = null;
/// <summary>
/// Web object.
/// </summary>
private HttpRequest api = null;
/// <summary>
/// Filename of saved data.
/// </summary>
private string fileName = string.Empty;
/// <summary>
/// Url of the feed data.
/// </summary>
private Uri httpApiUri = null;
/// <summary>
/// Initializes a new instance of the <see cref="MainModel{T}" /> class.
/// </summary>
/// <param name="modelType">Model IO type</param>
/// <param name="fileName">name of the file</param>
/// <param name="url">url of the feed</param>
public MainModel(ModelType modelType, string fileName, string url)
{
this.modelType = modelType;
if ((url != null) && (url.Equals(string.Empty) == false))
{
this.httpApiUri = new Uri(url, UriKind.Absolute);
}
this.fileName = fileName;
if ((this.IsFile() == true)
&& (fileName.Equals(string.Empty) == false))
{
this.InitFile(CampusAppWP8.Utility.File.IOTypeRead.ReadSync, CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync);
}
if ((this.IsHttpApi() == true)
&& (url.Equals(string.Empty) == false))
{
this.InitHttpApi();
}
}
/// <summary>
/// Finalizes an instance of the <see cref="MainModel{T}" /> class.
/// </summary>
~MainModel()
{
this.SaveData();
}
/// <summary>
/// Delegate of the OnLoading callback function.
/// </summary>
public delegate void OnLoading();
/// <summary>
/// Delegate of the OnLoaded callback function.
/// </summary>
public delegate void OnLoaded();
/// <summary>
/// Delegate of the OnSaving callback function.
/// </summary>
public delegate void OnSaving();
/// <summary>
/// Delegate of the OnSaved callback function.
/// </summary>
public delegate void OnSaved();
/// <summary>
/// Delegate of the IsModelUpToDate callback function.
/// </summary>
/// <param name="model">data model</param>
/// <returns>true, model is up to date</returns>
public delegate bool IsModelUpToDate(T model);
/// <summary>
/// Delegate of the IsFileUpToDate callback function.
/// </summary>
/// <param name="model">data model</param>
/// <param name="fileInfo">info of the file</param>
/// <returns>true, is file is up to date</returns>
public delegate bool IsFileUpToDate(T model, FileInfo fileInfo);
/// <summary>
/// Callback pointer, called before loading.
/// </summary>
public event OnLoading onLoading = null;
/// <summary>
/// Callback pointer, called after loading.
/// </summary>
public event OnLoaded onLoaded = null;
/// <summary>
/// Callback pointer, called before saving.
/// </summary>
public event OnSaving onSaving = null;
/// <summary>
/// Callback pointer, called after saving.
/// </summary>
public event OnSaved onSaved = null;
/// <summary>
/// Callback pointer, for checking if file is up to date.
/// </summary>
public event IsFileUpToDate isFileUpToDate = null;
/// <summary>
/// Callback pointer, for checking if model is up to date.
/// </summary>
public event IsModelUpToDate isModelUpToDate = null;
/// <summary>
/// Specifies the I/O type of the model.
/// </summary>
public enum ModelType
{
/// <summary>
/// Invalid/unset state.
/// </summary>
INVALID = 0,
/// <summary>
/// File only (01).
/// </summary>
File = 1,
/// <summary>
/// Feed only (10).
/// </summary>
Feed = 2,
/// <summary>
/// File and feed (11).
/// </summary>
FileAndFeed = 3
}
/// <summary>
/// Gets or sets the Model.
/// </summary>
public T Model
{
get
{
return this.model;
}
set
{
this.model = value;
}
}
/// <summary>
/// Called before finalizing. Can maybe be removed.
/// </summary>
public void Dispose()
{
this.SaveData();
}
/// <summary>
/// Forces a update from web.
/// </summary>
public void ForceWebUpdate()
{
if (this.api != null)
{
if (this.onLoading != null)
{
this.onLoading();
}
this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete);
}
}
/// <summary>
/// Load the data if necessary, from web or from file, regarding if
/// the file data is up to date.
/// </summary>
public void LoadData()
{
bool loadFromFile = true;
if (this.onLoading != null)
{
this.onLoading();
}
if (((this.isModelUpToDate == null)
|| (this.isModelUpToDate(this.model) == false))
&& ((this.file != null) || this.api != null))
{
if (this.file != null)
{
if ((this.file.Exist() == false)
|| (this.file.GetFileInfo().Length == 0))
{
loadFromFile = false;
}
if (((this.isFileUpToDate != null) && (this.isFileUpToDate(this.model, this.file.GetFileInfo()) == false))
|| (this.isFileUpToDate == null))
{
loadFromFile = false;
}
}
else
{
loadFromFile = false;
}
if (this.api == null)
{
loadFromFile = true;
}
if (loadFromFile == false)
{
this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete);
}
else
{
string data = this.file.ReadFile();
if (data != null && !data.Equals(string.Empty))
{
this.DeserializeModel(Encoding.UTF8.GetBytes(data));
}
}
}
if (loadFromFile == true)
{
if (this.onLoaded != null)
{
this.onLoaded();
}
}
}
/// <summary>
/// Save the model data if necessary.
/// </summary>
public void SaveData()
{
if ((this.file != null)
&& ((this.isFileUpToDate == null) || (this.isFileUpToDate(this.model, this.file.GetFileInfo()) == false)))
{
if (this.onSaving != null)
{
this.onSaving();
}
byte[] data = this.SerializeModel();
this.file.WriteFile(data);
if (this.onSaved != null)
{
this.onSaved();
}
}
}
/// <summary>
/// Return the model io type.
/// </summary>
/// <returns>model io type</returns>
public ModelType GetModelType()
{
return this.modelType;
}
/// <summary>
/// Return the model.
/// </summary>
/// <returns>model object</returns>
public T GetModel()
{
return this.model;
}
/// <summary>
/// Abstract declaration of the model deserialize function.
/// </summary>
/// <param name="modelData">model data as byte array</param>
/// <returns>true, is succeeded</returns>
protected abstract bool DeserializeModel(byte[] modelData);
/// <summary>
/// Abstract declaration of the model serialize function.
/// </summary>
/// <returns>model data as byte array</returns>
protected abstract byte[] SerializeModel();
/// <summary>
/// Check if the model io type is file.
/// </summary>
/// <returns>true, if the model io type has file.</returns>
protected bool IsFile()
{
bool retValue = false;
if ((this.modelType & ModelType.File) != 0)
{
retValue = true;
}
return retValue;
}
/// <summary>
/// Check if the model io type is feed.
/// </summary>
/// <returns>true if the model io type has feed.</returns>
protected bool IsHttpApi()
{
bool retValue = false;
if ((this.modelType & ModelType.Feed) != 0)
{
retValue = true;
}
return retValue;
}
/// <summary>
/// Initializes the file object.
/// </summary>
/// <param name="readType">read io type (Default: sync)</param>
/// <param name="writeType">write io type (Default: async)</param>
private void InitFile(CampusAppWP8.Utility.File.IOTypeRead readType = CampusAppWP8.Utility.File.IOTypeRead.ReadSync, CampusAppWP8.Utility.File.IOTypeWrite writeType = CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync)
{
if ((this.IsFile() == true)
&& (this.file == null))
{
this.file = new CampusAppWP8.Utility.File(this.fileName, readType, writeType);
}
}
/// <summary>
/// Initializes the web object.
/// </summary>
private void InitHttpApi()
{
if ((this.IsHttpApi() == true)
&& (this.api == null))
{
this.api = new HttpRequest();
}
}
/// <summary>
/// Is called after the loading from web is complete.
/// </summary>
/// <param name="sender">sending object</param>
/// <param name="e">event args</param>
private void OnLoadDataComplete(object sender, DownloadStringCompletedEventArgs e)
{
Exception downloadError = e.Error;
if (downloadError != null)
{
return;
}
string downloadResult = e.Result;
if (downloadResult != null && !downloadResult.Equals(string.Empty))
{
this.DeserializeModel(Encoding.UTF8.GetBytes(downloadResult));
}
if (this.onLoaded != null)
{
this.onLoaded();
}
}
}
}

View File

@@ -0,0 +1,56 @@
//-----------------------------------------------------------------------------
// <copyright file="RSSChannelModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.RSS
{
using System.Collections.ObjectModel;
using System.Xml.Serialization;
/// <summary>
/// Channel Model, which contains the RSS feed item list.
/// </summary>
public class RSSChannelModel
{
/// <summary>
/// RSS feed information item list.
/// </summary>
[XmlElement("item")]
private ObservableCollection<RSSModel> item;
/// <summary>
/// Initializes a new instance of the <see cref="RSSChannelModel" /> class.
/// </summary>
public RSSChannelModel()
{
this.item = new ObservableCollection<RSSModel>();
}
/// <summary>
/// Gets or sets the RSS feed item list.
/// </summary>
public ObservableCollection<RSSModel> Item
{
get
{
return this.item;
}
set
{
if (value != this.item)
{
this.item = value;
int i = 0;
foreach (RSSModel rssItem in this.item)
{
rssItem.Index = i++;
}
}
}
}
}
}

View File

@@ -0,0 +1,240 @@
//-----------------------------------------------------------------------------
// <copyright file="RSSModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.RSS
{
using System;
using System.Text;
using System.Xml.Serialization;
/// <summary>
/// Contains the RSS feed information.
/// </summary>
public class RSSModel
{
/// <summary>
/// Gets or sets the ListIndex
/// </summary>
public int Index { get; set; }
/// <summary>
/// Title of the fees
/// </summary>
private string title;
/// <summary>
/// Description text of the feed.
/// </summary>
private string text;
/// <summary>
/// Timestamp (publication date) of the event or news.
/// </summary>
private DateTime timestamp;
/// <summary>
/// Url of the feed.
/// </summary>
private string link;
/// <summary>
/// Gets or sets the title of the feed.
/// </summary>
[XmlElement("title")]
public string Title
{
get
{
return this.title;
}
set
{
if (this.title != value)
{
this.title = value;
}
}
}
/// <summary>
/// Gets or sets the text of the feed.
/// </summary>
[XmlElement("description")]
public string Text
{
get
{
return this.text;
}
set
{
if (this.text != this.HTMLUnicodeToString(value))
{
this.text = this.HTMLUnicodeToString(value);
}
}
}
/// <summary>
/// Gets or sets the timestamp of the feed as string.
/// </summary>
[XmlElement("pubDate")]
public string Timestamp
{
get
{
return this.timestamp.ToString("R");
}
set
{
if (this.timestamp != DateTime.Parse(value))
{
this.timestamp = DateTime.Parse(value);
}
}
}
/// <summary>
/// Gets or sets the timestamp of the feed as DateTime object.
/// </summary>
public DateTime DTTimestamp
{
get
{
return this.timestamp;
}
set
{
this.timestamp = value;
}
}
/// <summary>
/// Gets the date of the timestamp as string.
/// example: Mon, 25.06.2013.
/// </summary>
public string Date
{
get
{
return string.Format("{0:ddd, dd.MM.yyyy}", this.timestamp);
}
}
/// <summary>
/// Gets the time of the timestamp as string.
/// example: 12:56 Uhr.
/// </summary>
public string Time
{
get
{
return string.Format("{0:h:mm} Uhr", this.timestamp);
}
}
/// <summary>
/// Gets or sets the link/url of the feed.
/// </summary>
[XmlElement("link")]
public string Link
{
get
{
return this.link;
}
set
{
if (this.link != value)
{
this.link = value;
}
}
}
/// <summary>
/// Comparing function for DateTime timestamps.
/// (currently unused)
/// </summary>
/// <param name="item1">first item</param>
/// <param name="item2">second item</param>
/// <returns>-1 if item2 is older then item1, otherwise 0</returns>
public static int CompareTimeStamp(RSSModel item1, RSSModel item2)
{
if (item1.DTTimestamp > item2.DTTimestamp)
{
return -1;
}
else
{
return 0;
}
}
/// <summary>
/// Remove or transform html-unicode specific tags into ASCII.
/// </summary>
/// <param name="htmluni">html string</param>
/// <returns>ASCII string</returns>
private string HTMLUnicodeToString(string htmluni)
{
StringBuilder retValue = new StringBuilder();
for (int i = 0; i < htmluni.Length; i++)
{
switch (htmluni[i])
{
// beginning tag of the unicode
case '&':
int startOff = i + 2;
//// sear closing tag of the unicode
int endOff = htmluni.IndexOf(';', startOff);
//// get and parse value inbetween
string sub = htmluni.Substring(startOff, endOff - startOff);
int charVal = int.Parse(sub);
switch (charVal)
{
// if the unicode value is 128 (€)
case 128:
retValue.Append('€');
break;
default:
retValue.Append((char)charVal);
break;
}
// set the current index to the end of the unicode tag
i = endOff;
break;
case '<':
// ignoring <..> html tags
i = htmluni.IndexOf('>', i);
break;
case '\t':
// removing tabs
break;
default:
// adding other characters to the return string
retValue.Append(htmluni[i]);
break;
}
}
return retValue.ToString();
}
}
}

View File

@@ -0,0 +1,53 @@
//-----------------------------------------------------------------------------
// <copyright file="RSSViewModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.RSS
{
using System.Collections.ObjectModel;
using System.Xml.Serialization;
/// <summary>
/// ViewModel of the RSS feed, containing the feed/channel object.
/// </summary>
[XmlRoot("root")]
public class RSSViewModel
{
/// <summary>
/// Channel list for the RSS feeds.
/// </summary>
[XmlArray("rss")]
[XmlArrayItem("channel")]
private ObservableCollection<RSSChannelModel> channel;
/// <summary>
/// Initializes a new instance of the <see cref="RSSViewModel" /> class.
/// </summary>
public RSSViewModel()
{
this.channel = new ObservableCollection<RSSChannelModel>();
}
/// <summary>
/// Gets or sets the channel list.
/// </summary>
public ObservableCollection<RSSChannelModel> Channel
{
get
{
return this.channel;
}
set
{
if (value != this.channel)
{
this.channel = value;
}
}
}
}
}

View File

@@ -0,0 +1,71 @@
//-----------------------------------------------------------------------------
// <copyright file="XmlModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.07.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model
{
using System.Text;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// Xml model io handler class.
/// </summary>
/// <typeparam name="T">model type</typeparam>
public class XmlModel<T> : MainModel<T>
{
/// <summary>
/// Initializes a new instance of the <see cref="XmlModel{T}" /> class.
/// </summary>
/// <param name="modelType">model io type</param>
/// <param name="fileName">filename of the data file</param>
/// <param name="url">url of the feed data</param>
public XmlModel(ModelType modelType, string fileName, string url)
: base(modelType, fileName, url)
{
}
/// <summary>
/// Create the model from a xml byte array.
/// </summary>
/// <param name="modelData">model data</param>
/// <returns>true, if succeeded</returns>
protected override bool DeserializeModel(byte[] modelData)
{
bool retValue = true;
string data = Encoding.UTF8.GetString(modelData, 0, modelData.Length);
T tempModel = XmlManager.DeserializationToModel<T>(data, Constants.XMLRootElementName);
if (tempModel != null)
{
this.Model = tempModel;
}
else
{
retValue = false;
}
return retValue;
}
/// <summary>
/// Serializes the model to a byte array.
/// </summary>
/// <returns>model data</returns>
protected override byte[] SerializeModel()
{
byte[] retValue = null;
if (this.Model != null)
{
retValue = Encoding.UTF8.GetBytes(XmlManager.SerializationToString<T>(this.Model));
}
return retValue;
}
}
}

View File

@@ -70,5 +70,11 @@ namespace CampusAppWP8.Pages
HomeworkAppButtonText.Text = AppResources.HomeworkApp_Title2;
}
}
private void OpenDepartmentApp(object sender, RoutedEventArgs e)
{
Uri url = new Uri(Constants.PathDepartment_DepartmentIndexPage, UriKind.Relative);
NavigationService.Navigate(url);
}
}
}

View File

@@ -0,0 +1,74 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.Departments.DepartmentFavoritePage"
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.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="{Binding Path=LocalizedResources.Favorites, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<ListBox x:Name="ContentPanel" ItemsSource="{Binding Chairs}" Grid.Row="1" Margin="12,0,12,0">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<!--chair main button-->
<Button Tag="{Binding Url}" Click="ChairTB_Click" HorizontalContentAlignment="Left">
<TextBlock Text="{Binding Name}" HorizontalAlignment="Stretch" TextWrapping="Wrap" FontSize="24"/>
</Button>
<StackPanel Visibility="Collapsed">
<!--delete button-->
<Button BorderBrush="Transparent" Tag="{Binding Name}" Click="DeleteBtn_Click" HorizontalContentAlignment="Left">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Grid.Row="0" Height="32" Width="32" Source="{Binding Path=ThemelizedIcon.Delete, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=LocalizedResources.Delete, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"/>
</Grid>
</Button>
<!--info button-->
<Button x:Name="InfoBtn" BorderBrush="Transparent" Tag="{Binding Url}" Click="InfoBtn_Click" HorizontalContentAlignment="Left">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Grid.Row="0" Height="32" Width="32" Source="{Binding Path=ThemelizedIcon.Info, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=LocalizedResources.Info, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"/>
</Grid>
</Button>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,112 @@
//-----------------------------------------------------------------------
// <copyright file="DepartmentFavoritePage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>01.07.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Departments
{
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
/// <summary>
/// Page to visualize the favorite department list.
/// </summary>
public partial class DepartmentFavoritePage : PhoneApplicationPage
{
/// <summary>
/// Object to store the last clicked chair button.
/// </summary>
private FrameworkElement lastClickedBtn = null;
/// <summary>
/// Initializes a new instance of the <see cref="DepartmentFavoritePage" /> class.
/// </summary>
public DepartmentFavoritePage()
{
this.InitializeComponent();
}
/// <summary>
/// On navigation to this page.
/// Initialize the list source.
/// </summary>
/// <param name="e">event args</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
this.ContentPanel.ItemsSource = DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].Chairs;
}
/// <summary>
/// On clicking on a chair button.
/// Open or close the chair details.
/// </summary>
/// <param name="sender">clicked button</param>
/// <param name="e">event args</param>
private void ChairTB_Click(object sender, RoutedEventArgs e)
{
FrameworkElement tempBtn = sender as FrameworkElement;
StackPanel tempParent = null;
if (tempBtn == this.lastClickedBtn)
{
tempParent = this.lastClickedBtn.Parent as StackPanel;
tempParent.Children[1].Visibility = Visibility.Collapsed;
this.lastClickedBtn = null;
}
else
{
if (this.lastClickedBtn != null)
{
tempParent = this.lastClickedBtn.Parent as StackPanel;
tempParent.Children[1].Visibility = Visibility.Collapsed;
}
tempParent = tempBtn.Parent as StackPanel;
tempParent.Children[1].Visibility = Visibility.Visible;
this.lastClickedBtn = tempBtn;
}
}
/// <summary>
/// On clicking on a delete button.
/// Removes the chair from the favorite list.
/// </summary>
/// <param name="sender">clicked button</param>
/// <param name="e">event args</param>
private void DeleteBtn_Click(object sender, RoutedEventArgs e)
{
Button btn = this.lastClickedBtn as Button;
TextBlock btnText = btn.Content as TextBlock;
if (DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].RemoveChair(btnText.Text) == true)
{
MessageBox.Show(AppResources.DeleteSucceeded);
}
else
{
MessageBox.Show(AppResources.DeleteFailed);
}
}
/// <summary>
/// On clicking on a info button.
/// Open a department info page.
/// </summary>
/// <param name="sender">clicked button</param>
/// <param name="e">event args</param>
private void InfoBtn_Click(object sender, RoutedEventArgs e)
{
FrameworkElement infoBtn = sender as FrameworkElement;
string chairName = ((this.lastClickedBtn as Button).Content as TextBlock).Text.ToString();
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentInfoPage + "?url=" + infoBtn.Tag.ToString() + "&name=" + chairName, UriKind.Relative));
}
}
}

View File

@@ -0,0 +1,77 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.Departments.DepartmentIndexPage"
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="PortraitOrLandscape" 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="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.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="{Binding Path=LocalizedResources.DepartmentApp_Title, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<ListBox x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<!--favorite button-->
<Button x:Name="Favorite" Click="FavoriteBtn_Click" HorizontalContentAlignment="Left">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Width="32" Height="32" Grid.Row="0" Grid.Column="0" Source="{Binding Path=ThemelizedIcon.Favorite, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=LocalizedResources.Favorites, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"/>
</Grid>
</Button>
</ListBox>
<!--faculty button list-->
<ListBox x:Name="FacultyList" Grid.Row="2" Margin="12,0,12,0">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<!--faculty button-->
<Button Tag="{Binding Id}" Click="FacultyBtn_Click" HorizontalContentAlignment="Left">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Width="32" Height="32" Grid.Row="0" Grid.Column="0" Source="{Binding Path=ThemelizedIcon.Departments, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Name}" VerticalAlignment="Center"/>
</Grid>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,160 @@
//-----------------------------------------------------------------------
// <copyright file="DepartmentIndexPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Departments
{
using System;
using System.Linq;
using System.Windows;
using System.Windows.Navigation;
using CampusAppWP8.Feed.Departments;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
/// <summary>
/// Page with a list of the faculties.
/// </summary>
public partial class DepartmentIndexPage : PhoneApplicationPage
{
/// <summary>
/// Department/chair feed object, storing the model and data.
/// </summary>
private static DepartmentFeed feed = null;
/// <summary>
/// Department feed object for storing the favorite list.
/// </summary>
private static DepartmentFavoriteFeed favorite = null;
/// <summary>
/// Initializes a new instance of the <see cref="DepartmentIndexPage" /> class.
/// </summary>
public DepartmentIndexPage()
{
this.InitializeComponent();
//// init feed objects
if (DepartmentIndexPage.feed == null)
{
DepartmentIndexPage.feed = new DepartmentFeed(false);
}
DepartmentIndexPage.feed.onLoaded += new DepartmentFeed.OnLoaded(this.SetupFacultyList);
DepartmentIndexPage.feed.LoadData();
if (DepartmentIndexPage.favorite == null)
{
DepartmentIndexPage.favorite = new DepartmentFavoriteFeed(false);
}
DepartmentIndexPage.favorite.onLoaded += new DepartmentFavoriteFeed.OnLoaded(this.CheckFavoriteFeed);
DepartmentIndexPage.favorite.LoadData();
}
/// <summary>
/// Return the feed object of the departments.
/// </summary>
/// <returns>feed object</returns>
public static DepartmentFeed GetFeed()
{
return DepartmentIndexPage.feed; // DepartmentIndexPage.feed;
}
/// <summary>
/// Return the feed object of the favorite departments.
/// </summary>
/// <returns>feed object</returns>
public static DepartmentFavoriteFeed GetFavoriteFeed()
{
return DepartmentIndexPage.favorite; // DepartmentIndexPage.favorite;
}
/// <summary>
/// On navigation to this page.
/// Initialize the feed loading.
/// </summary>
/// <param name="e">event args</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (NavigationMode.Back != e.NavigationMode)
{
}
}
/// <summary>
/// On navigation from this page.
/// Store the favorite list.
/// </summary>
/// <param name="e">event args</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (NavigationMode.Back == e.NavigationMode)
{
DepartmentIndexPage.favorite.SaveData();
}
base.OnNavigatedFrom(e);
}
/// <summary>
/// On orientation changed.
/// </summary>
/// <param name="sender">sender object</param>
/// <param name="e">event args</param>
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
}
/// <summary>
/// Setup the faculty list.
/// </summary>
private void SetupFacultyList()
{
this.FacultyList.ItemsSource = DepartmentIndexPage.feed.GetModel().Faculties;
}
/// <summary>
/// Checks if the favorite feed is valid.
/// </summary>
private void CheckFavoriteFeed()
{
if (DepartmentIndexPage.favorite.GetModel() == null)
{
DepartmentIndexPage.favorite.Model = new Model.Departments.DepartmentModel();
}
if (DepartmentIndexPage.favorite.GetModel().Faculties.Count() == 0)
{
DepartmentIndexPage.favorite.Model.Faculties.Add(new Model.Departments.FacultyModel("favorites"));
}
}
/// <summary>
/// On clicking on the favorite button.
/// </summary>
/// <param name="sender">clicked button</param>
/// <param name="e">event args</param>
private void FavoriteBtn_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentFavoritePage, UriKind.Relative));
}
/// <summary>
/// On clicking on a faculty button.
/// </summary>
/// <param name="sender">clicked button</param>
/// <param name="e">event args</param>
private void FacultyBtn_Click(object sender, RoutedEventArgs e)
{
FrameworkElement tempElem = sender as FrameworkElement;
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentPage + "?pivotindex=" + tempElem.Tag, UriKind.Relative));
}
}
}

View File

@@ -0,0 +1,36 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.Departments.DepartmentInfoPage"
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="PortraitOrLandscape" Orientation="Portrait"
OrientationChanged="PhoneApplicationPage_OrientationChanged"
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>
<!--title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.DepartmentApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageHeadline" Text="Seitenname" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontSize="36" TextWrapping="Wrap"/>
</StackPanel>
<!--webbrowser-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<phone:WebBrowser x:Name="WebBrowser" Grid.Row="0" IsScriptEnabled="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</Grid>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,56 @@
//-----------------------------------------------------------------------
// <copyright file="DepartmentInfoPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>01.07.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Departments
{
using System;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
/// <summary>
/// Info page of a chair.
/// </summary>
public partial class DepartmentInfoPage : PhoneApplicationPage
{
/// <summary>
/// Initializes a new instance of the <see cref="DepartmentInfoPage" /> class.
/// </summary>
public DepartmentInfoPage()
{
this.InitializeComponent();
}
/// <summary>
/// On navigation to this page.
/// Initialize the page headline text.
/// </summary>
/// <param name="e">event args</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string url = string.Empty;
string chairName = string.Empty;
if (NavigationContext.QueryString.TryGetValue("url", out url)
&& NavigationContext.QueryString.TryGetValue("name", out chairName))
{
this.PageHeadline.Text = chairName;
this.WebBrowser.Navigate(new Uri(url, UriKind.Absolute));
}
}
/// <summary>
/// On orientation changed.
/// </summary>
/// <param name="sender">sender object</param>
/// <param name="e">event args</param>
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
}
}
}

View File

@@ -43,7 +43,10 @@ namespace CampusAppWP8.Utility
/// </summary>
public void FireFeedReadyevent()
{
this.FeedIsReadyEvent();
if (this.FeedIsReadyEvent != null)
{
this.FeedIsReadyEvent();
}
}
#endregion

View File

@@ -0,0 +1,231 @@
//-----------------------------------------------------------------------------
// <copyright file="File.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>03.05.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
using System;
using System.IO;
using Windows.Storage;
/// <summary>
/// File class.
/// </summary>
public class File
{
/// <summary>
/// Folder object.
/// </summary>
private static readonly IStorageFolder LocalFolder = ApplicationData.Current.LocalFolder;
/// <summary>
/// File name.
/// </summary>
private string filename = string.Empty;
/// <summary>
/// Read type.
/// </summary>
private IOTypeRead readType;
/// <summary>
/// Write type.
/// </summary>
private IOTypeWrite writeType;
/// <summary>
/// Initializes a new instance of the <see cref="File" /> class.
/// </summary>
/// <param name="filename">file name</param>
/// <param name="read">read type</param>
/// <param name="write">write type</param>
public File(string filename, IOTypeRead read, IOTypeWrite write)
{
this.filename = filename;
this.readType = (read == IOTypeRead.INVALID) ? IOTypeRead.ReadAsync : read;
this.writeType = write;
}
/// <summary>
/// IO read type ENUM.
/// </summary>
public enum IOTypeRead
{
/// <summary>
/// Invalid/unset state.
/// </summary>
INVALID = 0,
/// <summary>
/// Sync read.
/// </summary>
ReadSync = 1,
/// <summary>
/// Async read.
/// </summary>
ReadAsync = 2
}
/// <summary>
/// IO write type ENUM.
/// </summary>
public enum IOTypeWrite
{
/// <summary>
/// Invalid/unset state.
/// </summary>
INVALID = 0,
/// <summary>
/// Sync write.
/// </summary>
WriteSync = 1,
/// <summary>
/// Async write.
/// </summary>
WriteAsync = 2,
/// <summary>
/// Read only, no writing.
/// </summary>
ReadOnly = 3
}
/// <summary>
/// Read data from file to a string.
/// </summary>
/// <param name="ioType">read type</param>
/// <returns>data string</returns>
public string ReadFile(IOTypeRead ioType = IOTypeRead.INVALID)
{
string retValue = null;
if (this.Exist() == true)
{
IOTypeRead tempType = ioType;
if (tempType == IOTypeRead.INVALID)
{
tempType = this.readType;
}
if (tempType == IOTypeRead.ReadAsync)
{
// retValue = this.ReadAsync();
retValue = this.ReadSync();
}
else if (tempType == IOTypeRead.ReadSync)
{
retValue = this.ReadSync();
}
}
return retValue;
}
/// <summary>
/// Write bytes to the file.
/// </summary>
/// <param name="data">data byte array</param>
/// <param name="ioType">write type</param>
public void WriteFile(byte[] data, IOTypeWrite ioType = IOTypeWrite.INVALID)
{
IOTypeWrite tempType = ioType;
if (tempType == IOTypeWrite.INVALID)
{
tempType = this.writeType;
}
if (tempType == IOTypeWrite.WriteAsync)
{
this.WriteAsync(data);
}
else if (tempType == IOTypeWrite.WriteSync)
{
// this.WriteSync(data);
this.WriteAsync(data);
}
}
/// <summary>
/// Return a info object of the file.
/// </summary>
/// <returns>info of the file</returns>
public FileInfo GetFileInfo()
{
FileInfo info = new FileInfo(File.LocalFolder.Path + "\\" + this.filename);
return info;
}
/// <summary>
/// Check if a file is existing.
/// </summary>
/// <returns>true, if file exists, otherwise false</returns>
public bool Exist()
{
return this.GetFileInfo().Exists;
}
/// <summary>
/// Read data synchronous from file.
/// </summary>
/// <returns>data string</returns>
private string ReadSync()
{
string retValue = null;
using (Stream fileStream = File.LocalFolder.OpenStreamForReadAsync(this.filename).Result)
{
using (StreamReader streamReader = new StreamReader(fileStream))
{
retValue = streamReader.ReadToEnd();
}
}
return retValue;
}
/// <summary>
/// Read data asynchronous from file.
/// </summary>
/// <returns>data string</returns>
private string ReadAsync()
{
string retValue = string.Empty;
return retValue;
}
/// <summary>
/// Write data synchronous to file.
/// </summary>
/// <param name="data">data array</param>
/// <returns>true, if succeeded</returns>
private bool WriteSync(byte[] data)
{
bool retValue = true;
return retValue;
}
/// <summary>
/// Write data asynchronous to file.
/// </summary>
/// <param name="data">data array</param>
private async void WriteAsync(byte[] data)
{
var file = await File.LocalFolder.CreateFileAsync(this.filename, CreationCollisionOption.ReplaceExisting);
using (var s = await file.OpenStreamForWriteAsync())
{
await s.WriteAsync(data, 0, data.Length);
}
}
}
}

View File

@@ -24,5 +24,15 @@ namespace CampusAppWP8.Utility
/// Opening hours feed file name.
/// </summary>
public static readonly string OpeninghoursXmlFile = "OpeninghoursFeed.xml";
/// <summary>
/// Department feed file name.
/// </summary>
public static readonly string DepartmentXmlFile = "DepartmentFeed.xml";
/// <summary>
/// Department favorite feed file name.
/// </summary>
public static readonly string DepartmentFavoriteXmlFile = "DepartmentFavoriteFeed.xml";
}
}

View File

@@ -105,7 +105,8 @@ namespace CampusAppWP8.Utility
using (Stream stream = await storageFile.OpenStreamForWriteAsync())
{
byte[] contentByte = Encoding.UTF8.GetBytes(content);
await stream.WriteAsync(contentByte, 0, contentByte.Length);
//await stream.WriteAsync(contentByte, 0, contentByte.Length);
stream.Write(contentByte, 0, contentByte.Length);
}
}

View File

@@ -0,0 +1,38 @@
//-----------------------------------------------------------------------------
// <copyright file="XmlFile.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>05.07.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
using CampusAppWP8.Resources;
public class XmlFile<T> : File
{
public XmlFile(string filename) : base(filename, IOTypeRead.ReadAsync, IOTypeWrite.WriteSync)
{
}
public bool LoadModel(T model)
{
bool retValue = true;
string data = this.ReadFile();
if ((data == null)
|| (data.Equals(string.Empty) == true))
{
retValue = false;
}
else
{
model = XmlManager.DeserializationToModel<T>(data, Constants.XMLRootElementName);
}
return retValue;
}
}
}