diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/add_159.png b/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/add_159.png
new file mode 100644
index 00000000..056c5667
Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/add_159.png differ
diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/delete_159.png b/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/delete_159.png
new file mode 100644
index 00000000..bbcb20e5
Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/delete_159.png differ
diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/favorite_159.png b/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/favorite_159.png
new file mode 100644
index 00000000..44fd7dc7
Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/favorite_159.png differ
diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/info_159.png b/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/info_159.png
new file mode 100644
index 00000000..94231862
Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/info_159.png differ
diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/add_159.png b/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/add_159.png
new file mode 100644
index 00000000..0fb90eb3
Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/add_159.png differ
diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/delete_159.png b/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/delete_159.png
new file mode 100644
index 00000000..dbd61253
Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/delete_159.png differ
diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/favorite_159.png b/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/favorite_159.png
new file mode 100644
index 00000000..6b90fc4c
Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/favorite_159.png differ
diff --git a/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/info_159.png b/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/info_159.png
new file mode 100644
index 00000000..1ad39f71
Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/info_159.png differ
diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index 33549925..6f3bad02 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -96,6 +96,7 @@
App.xaml
+
@@ -107,10 +108,9 @@
-
-
-
+
+
@@ -118,6 +118,7 @@
+
@@ -127,11 +128,21 @@
+
CampusMapPage.xaml
+
+ DepartmentFavoritePage.xaml
+
+
+ DepartmentIndexPage.xaml
+
+
+ DepartmentInfoPage.xaml
+
DepartmentPage.xaml
@@ -171,7 +182,7 @@
NewsPage.xaml
-
+
OpeninghoursPage.xaml
@@ -195,17 +206,13 @@
True
Constants.resx
-
- True
- True
- Icons.resx
- PreserveNewest
-
+
+
@@ -219,6 +226,7 @@
+
@@ -230,6 +238,18 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -313,16 +333,24 @@
PreserveNewest
+
+
+
+
+
+
+
+
@@ -358,7 +386,6 @@
PreserveNewest
-
@@ -375,8 +402,6 @@
Constants.Designer.cs
- PublicResXFileCodeGenerator
- Icons.Designer.cs
PreserveNewest
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs
new file mode 100644
index 00000000..5c8b4eab
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs
@@ -0,0 +1,89 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 01.07.2013
+//----------------------------------------------------------------------using System;
+namespace CampusAppWP8.Feed.Departments
+{
+ using System;
+ using System.IO;
+ using CampusAppWP8.Model;
+ using CampusAppWP8.Model.Departments;
+ using CampusAppWP8.Resources;
+ using CampusAppWP8.Utility;
+
+ ///
+ /// Feed object to handle favorite department feeds.
+ ///
+ public class DepartmentFavoriteFeed : XmlModel
+ {
+ #region Constructor
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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
+
+ ///
+ /// Method implement CheckIsModelUpToDate()-Method .
+ ///
+ /// true, if model is up-to-date, otherwise false
+ private bool CheckIsModelUpToDate(DepartmentModel model)
+ {
+ bool retValue = true;
+
+ if((model == null)
+ || (model.Faculties == null)
+ || (model.Faculties.Count != 1))
+ {
+ retValue = false;
+ }
+
+ return retValue;
+ }
+
+ ///
+ /// Method implement CheckIsFileUpToDate()-Method .
+ ///
+ /// true, if file is up-to-date, otherwise false
+ 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
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs
index bc1b6175..d8b46d93 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs
@@ -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
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Feed.Departments
{
- class DepartmentFeed : XmlFeed
+ using System;
+ using System.IO;
+ using CampusAppWP8.Model;
+ using CampusAppWP8.Model.Departments;
+ using CampusAppWP8.Resources;
+ using CampusAppWP8.Utility;
+
+ ///
+ /// Feed class for the department information.
+ ///
+ public class DepartmentFeed : XmlModel
{
- public DepartmentFeed() : base(URLList.DepartmentFeedURL, "DepartmentFeed.xml")
+ #region Constructor
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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 _faculties { get; set; }
+
+ // Constructor
+ #endregion
+
+ #region Method
+
+ #region Protected
///
- /// Method implement CheckIsModelUpToDate()-Method
+ /// Method implement CheckIsModelUpToDate()-Method .
///
/// true, if model is up-to-date, otherwise false
- 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;
}
///
- /// Method implement CheckIsFileUpToDate()-Method
+ /// Method implement CheckIsFileUpToDate()-Method .
///
/// true, if file is up-to-date, otherwise false
- 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
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs
index 0fc6ae6a..696d0ad8 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs
@@ -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;
-
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//----------------------------------------------------------------------
namespace CampusAppWP8.Api.Events
{
+ using CampusAppWP8.Model.RSS;
+ using CampusAppWP8.Utility;
+
///
/// Event Feed.
///
public class EventFeed : XmlFeed
{
///
- /// Default constructor.
+ /// Initializes a new instance of the class.
///
public EventFeed() : base(URLList.EventsFeedURL, "EventFeed.xml")
{
}
+
///
/// Method implement CheckIsModelUpToDate()-Method
///
diff --git a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs
index 6cd2e40d..b67c93d9 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs
@@ -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;
-
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//-----------------------------------------------------------------------------
namespace CampusAppWP8.Api.News
{
+ using CampusAppWP8.Model.RSS;
+ using CampusAppWP8.Utility;
+
///
/// News Feed.
///
public class NewsFeed : XmlFeed
{
///
- /// Default constructor.
+ /// Initializes a new instance of the class.
///
public NewsFeed() : base(URLList.NewsFeedURL, "NewsFeed.xml")
{
diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/ChairModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/ChairModel.cs
index c98aadc2..2cbaecea 100644
--- a/CampusAppWP8/CampusAppWP8/Model/Departments/ChairModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/Departments/ChairModel.cs
@@ -1,88 +1,126 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Xml.Serialization;
-
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Departments
{
+ using System.Globalization;
+ using System.Xml.Serialization;
+
///
/// Class to hold information about a professorship chair.
///
- 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
+ ///
+ /// German name of the chair.
+ ///
+ private string nameDE = string.Empty;
///
- /// Default Constructor. Set every class variable to default value.
+ /// Link to the chair page.
+ ///
+ private string url = string.Empty;
+
+ ///
+ /// English name of the chair.
+ ///
+ private string nameEN = string.Empty;
+
+ ///
+ /// Initializes a new instance of the class.
///
public ChairModel()
{
- this.name_de = String.Empty;
- this.name_en = String.Empty;
- this.url = String.Empty;
}
///
- /// Constructor. Set the german and english name.
+ /// Initializes a new instance of the class.
///
- /// Name of the professorship chair.
+ /// name of the chair
public ChairModel(string name)
{
- this.name_de = name;
- this.name_en = name;
- this.url = String.Empty;
+ this.nameDE = name;
+ this.nameEN = name;
}
///
- /// Set or return the german name of the chair.
+ /// Gets or sets the german name of the chair.
///
[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;
}
}
}
///
- /// Set or return the english name of the chair.
+ /// Gets or sets the english name of the chair.
///
[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;
}
}
}
///
- /// Set or return the url of the chair homepage.
+ /// Gets or sets the url of the chair homepage.
///
[XmlAttribute("url")]
public string Url
{
- get { return this.url; }
+ get
+ {
+ return this.url;
+ }
+
set
{
if (value != this.url)
{
this.url = value;
- NotifyPropertyChanged("chair");
+ }
+ }
+ }
+
+ ///
+ /// Gets the localized name of the chair.
+ ///
+ public string Name
+ {
+ get
+ {
+ if (CultureInfo.CurrentUICulture.Name.StartsWith("de"))
+ {
+ return this.NameDE;
+ }
+ else
+ {
+ return this.NameEN;
}
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentModel.cs
index ab547308..5b7db58d 100644
--- a/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentModel.cs
@@ -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;
-
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Departments
{
- public class DepartmentModel : BaseModel
- {
- [XmlElement("chair")]
- public ObservableCollection _chairs { get; set; }
-
- private string _name = "d_mod";
- private Visibility visible;
+ using System;
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+ ///
+ /// View model for department page.
+ ///
+ [XmlRoot("root")]
+ public class DepartmentModel
+ {
+ ///
+ /// Object to store the time when the instance was created.
+ ///
+ private DateTime createTime;
+
+ ///
+ /// List of faculties.
+ ///
+ private ObservableCollection faculties;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
public DepartmentModel()
{
- this.visible = Visibility.Collapsed;
- this.Chairs = new ObservableCollection();
- //this.LoadData();
+ this.Faculties = new ObservableCollection();
+ this.createTime = DateTime.Now;
}
- public DepartmentModel(string name)
- {
- this.visible = Visibility.Collapsed;
- _name = name;
- this.Chairs = new ObservableCollection();
- //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 Chairs
+ ///
+ /// Gets or sets the faculty list.
+ ///
+ [XmlArray("professorships")]
+ [XmlArrayItem("faculty")]
+ public ObservableCollection 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
+ ///
+ /// Gets the creation time.
+ ///
+ public DateTime CreateTime
{
get
{
- return _name;
- }
- set
- {
- if (value != _name)
- {
- _name = value;
- NotifyPropertyChanged("chair");
- }
+ return this.createTime;
}
}
- public Visibility Visible
+ ///
+ /// Check if the content of the faculty lists hast changed since the
+ /// last call of this function.
+ ///
+ /// true, if changes happend since last request, otherwise false
+ 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;
}
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentViewModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentViewModel.cs
deleted file mode 100644
index 5b57d3c6..00000000
--- a/CampusAppWP8/CampusAppWP8/Model/Departments/DepartmentViewModel.cs
+++ /dev/null
@@ -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 _faculties { get; set; }
-
- public DepartmentViewModel()
- {
- this.Faculties = new ObservableCollection();
- }
-
- public ObservableCollection Faculties
- {
- get
- {
- return _faculties;
- }
- set
- {
- if (value != _faculties)
- {
- _faculties = value;
- NotifyPropertyChanged("foodDays");
- }
- }
- }
- }
-}
diff --git a/CampusAppWP8/CampusAppWP8/Model/Departments/FacultyModel.cs b/CampusAppWP8/CampusAppWP8/Model/Departments/FacultyModel.cs
index 3ceea2a8..1c3419ef 100644
--- a/CampusAppWP8/CampusAppWP8/Model/Departments/FacultyModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/Departments/FacultyModel.cs
@@ -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;
-
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Departments
{
- public class FacultyModel : BaseModel
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+ using CampusAppWP8.Resources;
+
+ ///
+ /// Model for holding the faculty information.
+ ///
+ public class FacultyModel
{
- [XmlElement("chair")]
- public ObservableCollection chairs { get; set; }
- //public ObservableCollection _faculties { get; set; }
-
- private string name = "t_fak";
+ ///
+ /// Object to hold the information of the chair containing to this
+ /// faculty.
+ ///
+ private ObservableCollection chairs;
+ ///
+ /// Name of the faculty.
+ ///
+ private string name = string.Empty;
+
+ ///
+ /// For checking of change.
+ ///
+ private bool hasChanged = false;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
public FacultyModel()
{
- //this.Faculties = new ObservableCollection();
this.chairs = new ObservableCollection();
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// name of the faculty
public FacultyModel(string name)
{
this.name = name;
- //this.Faculties = new ObservableCollection();
this.chairs = new ObservableCollection();
}
+ ///
+ /// Gets or sets the list of the chairs containing to this faculty.
+ ///
+ [XmlElement("chair")]
public ObservableCollection Chairs
{
- get { return this.chairs; }
+ get
+ {
+ return this.chairs;
+ }
+
set
{
if (value != this.chairs)
{
this.chairs = value;
- NotifyPropertyChanged("faculty");
}
}
}
- [XmlAttribute("id")]
+ ///
+ /// Gets the name of the faculty.
+ ///
public string Name
{
get
{
return AppResources.Faculty + " " + this.name;
}
+ }
+
+ ///
+ /// Gets or sets the id of the faculty.
+ ///
+ [XmlAttribute("id")]
+ public string Id
+ {
+ get
+ {
+ return this.name;
+ }
+
set
{
- if (value != this.name)
+ this.name = value;
+ }
+ }
+
+ ///
+ /// Remove a chair model from the lost.
+ ///
+ /// name of the chair
+ /// true, if succeeded
+ 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;
+ }
+
+ ///
+ /// Add a chair to the list, if it does not already exist.
+ ///
+ /// chair model to add
+ /// true, is succeeded
+ 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;
+ }
+
+ ///
+ /// Create a chair model and add it to the list, if it does not already
+ /// exist.
+ ///
+ /// german name of the chair
+ /// english name of the chair
+ /// url of the chair home page
+ /// true, if succeeded
+ 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;
+ }
+
+ ///
+ /// Return the chair model of the chair with the specified name.
+ ///
+ /// name of the chair
+ /// chair model, if succeeded, otherwise null
+ public ChairModel GetChairModel(string name)
+ {
+ ChairModel retValue = null;
+
+ foreach (ChairModel temp in this.Chairs)
+ {
+ if (temp.Name.Equals(name) == true)
+ {
+ retValue = temp;
+ }
+ }
+
+ return retValue;
+ }
+
+ ///
+ /// Return true if there were changes in the chair list, otherwise false.
+ ///
+ /// when true, the hasChanged flag will be reseted
+ /// true, when changed, otherwise false
+ public bool HasChanged(bool reset = true)
+ {
+ bool retValue = this.hasChanged;
+
+ if (reset == true)
+ {
+ this.hasChanged = false;
+ }
+
+ return retValue;
}
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Model/Events/RSSViewModel.cs b/CampusAppWP8/CampusAppWP8/Model/Events/RSSViewModel.cs
deleted file mode 100644
index a9625df9..00000000
--- a/CampusAppWP8/CampusAppWP8/Model/Events/RSSViewModel.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using CampusAppWP8.Model;
-using System.Collections.ObjectModel;
-using System.Xml.Serialization;
-
-namespace CampusAppWP8.Model.events_news
-{
- ///
- /// ViewModel of the rss feed, containing the feed/channel object.
- ///
- [XmlRoot("root")]
- public class RSSViewModel : BaseViewModel
- {
- ///
- /// channel list for the rss feeds.
- ///
- [XmlArray("rss")]
- [XmlArrayItem("channel")]
- public ObservableCollection channel { get; set; }
-
- ///
- /// Default constructor.
- ///
- public RSSViewModel()
- {
- this.channel = new ObservableCollection();
- }
-
- ///
- /// Set/Get the channel list.
- ///
- public ObservableCollection Channel
- {
- get
- {
- return this.channel;
- }
- set
- {
- if (value != this.channel)
- {
- this.channel = value;
- NotifyPropertyChanged("channel");
- }
- }
- }
- }
-}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml
index 3049f3c9..775f1c5d 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml
@@ -15,13 +15,10 @@
OrientationChanged="PhoneApplicationPage_OrientationChanged"
shell:SystemTray.IsVisible="True">
-
-
-
-
+
@@ -33,30 +30,50 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
- -->
+
+
+
+
-
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs
index a3441909..17af2974 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Departments/DepartmentPage.xaml.cs
@@ -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;
-
-
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//----------------------------------------------------------------------
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;
+
///
- /// Pivot page with list of the chairs of the facultis.
+ /// Pivot page with list of the chairs of the faculties.
///
public partial class DepartmentPage : PhoneApplicationPage
{
///
- /// Stores the last visible department panel.
+ /// For checking, if the source of the list is already set.
///
- private UIElement lastVisibleUIElem = null;
+ private bool isSourceSet = false;
+
///
- /// department/chair feed object, storing the model and data.
+ /// Last clicked button object.
///
- private DepartmentFeed feed { get; set; }
-
+ private FrameworkElement lastClickedBtn = null;
+
///
- /// Default constructor.
+ /// Initializes a new instance of the class.
///
public DepartmentPage()
{
- InitializeComponent();
- // init feed object
- this.feed = new DepartmentFeed();
+ this.InitializeComponent();
}
///
- /// On naviagtion to this page.
- /// Init the feed loading.
+ /// On navigation to this page.
+ /// Initialize the feed loading.
///
/// event args
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;
+ }
- ///
- /// Called after the feeds are loaded.
- /// Set the pivotitem source of this page.
- ///
- 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!!!");
+ }
+ }
}
///
/// On orientation changed.
///
- /// unused
- /// unused
+ /// sender object
+ /// event args
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
}
///
- /// 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.
///
- /// clicked department button
- /// unused
- private void DepartmentBtn_Click(object sender, RoutedEventArgs e)
+ /// clicked chair TextBlock
+ /// event args
+ 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;
}
}
///
- /// 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.
///
- /// clicked chair textblock
- ///
- private void ChairTB_Click(object sender, RoutedEventArgs e)
+ /// clicked button
+ /// event args
+ 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);
}
}
+
+ ///
+ /// On clicking on a info button.
+ /// Open the info page to this chair.
+ ///
+ /// clicked button
+ /// event args
+ 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));
+ }
}
}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs
index 086eda84..b6115544 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs
@@ -19,9 +19,9 @@ namespace CampusAppWP8.Pages.Events
public partial class EventIndexPage : PhoneApplicationPage
{
///
- /// Gets or sets Event Feed object, which contains the RSS models and data.
+ /// Event Feed object, which contains the RSS models and data.
///
- public static EventFeed eventFeed { get; set; }
+ private static EventFeed eventFeed;
///
/// Initializes a new instance of the class.
@@ -32,6 +32,17 @@ namespace CampusAppWP8.Pages.Events
EventIndexPage.eventFeed = new EventFeed();
}
+ ///
+ /// Gets the eventFeed object.
+ ///
+ public static EventFeed GetEventFeed
+ {
+ get
+ {
+ return EventIndexPage.eventFeed;
+ }
+ }
+
///
/// On navigation to this page, creates a FeedEventHandler and load the RSS feed data.
///
@@ -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
}
///
- /// 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.
///
@@ -61,13 +73,5 @@ namespace CampusAppWP8.Pages.Events
{
this.EventList.ItemsSource = EventIndexPage.eventFeed.Model.Channel[0].Item;
}
-
- ///
- /// Gets the eventFeed object.
- ///
- public static EventFeed GetEventFeed
- {
- get { return EventIndexPage.eventFeed; }
- }
}
}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml
index 7ff46edf..b4ab9f42 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml
@@ -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}"
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
index 2520c3b7..751f69b6 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs
@@ -14,8 +14,7 @@ namespace CampusAppWP8.Pages.Events
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
- using Microsoft.Phone.Tasks;
-
+
///
/// EventPage, where every event fees has his own PivotItem.
///
@@ -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;
}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs
index a00668fc..7dfdc7f7 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsIndexPage.xaml.cs
@@ -19,9 +19,9 @@ namespace CampusAppWP8.Pages.News
public partial class NewsIndexPage : PhoneApplicationPage
{
///
- /// Gets or sets News Feed object, which contains the RSS models and data.
+ /// News Feed object, which contains the RSS models and data.
///
- public static NewsFeed newsFeed { get; set; }
+ private static NewsFeed newsFeed;
///
/// Initializes a new instance of the class.
@@ -32,6 +32,17 @@ namespace CampusAppWP8.Pages.News
NewsIndexPage.newsFeed = new NewsFeed();
}
+ ///
+ /// Gets the newsFeed object.
+ ///
+ public static NewsFeed GetNewsFeed
+ {
+ get
+ {
+ return NewsIndexPage.newsFeed;
+ }
+ }
+
///
/// On navigation to this page, creates a FeedEventHandler and load the RSS feed data.
///
@@ -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;
}
-
- ///
- /// Gets the newsFeed object.
- ///
- public static NewsFeed GetNewsFeed
- {
- get { return NewsIndexPage.newsFeed; }
- }
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml
index 5fe92308..0b898115 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml
@@ -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}"
diff --git a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs
index 6b13789f..10071b16 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/News/NewsPage.xaml.cs
@@ -14,7 +14,6 @@ namespace CampusAppWP8.Pages.News
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
- using Microsoft.Phone.Tasks;
///
/// 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;
}
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index d7c1c526..722c4e59 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// 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 {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Hinzufügen ähnelt.
+ ///
+ public static string Add {
+ get {
+ return ResourceManager.GetString("Add", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Hinzufügen ähnelt.
///
@@ -132,6 +141,33 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Löschen ähnelt.
+ ///
+ public static string Delete {
+ get {
+ return ResourceManager.GetString("Delete", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Löschung ist fehlgeschlagen ähnelt.
+ ///
+ public static string DeleteFailed {
+ get {
+ return ResourceManager.GetString("DeleteFailed", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Löschung war erfolgreich ähnelt.
+ ///
+ public static string DeleteSucceeded {
+ get {
+ return ResourceManager.GetString("DeleteSucceeded", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Lehrstühle ähnelt.
///
@@ -159,6 +195,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Favoriten ähnelt.
+ ///
+ public static string Favorites {
+ get {
+ return ResourceManager.GetString("Favorites", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
///
@@ -186,6 +231,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Details ähnelt.
+ ///
+ public static string Info {
+ get {
+ return ResourceManager.GetString("Info", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt.
///
@@ -303,24 +357,6 @@ namespace CampusAppWP8.Resources {
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die stud. Vereine ähnelt.
- ///
- public static string LinkApp_ClubLinks {
- get {
- return ResourceManager.GetString("LinkApp_ClubLinks", resourceCulture);
- }
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die allg. Links ähnelt.
- ///
- public static string LinkApp_CommonLinks {
- get {
- return ResourceManager.GetString("LinkApp_CommonLinks", resourceCulture);
- }
- }
-
///
/// Sucht eine lokalisierte Zeichenfolge, die Links ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
index eb67220a..88f17191 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -287,11 +287,23 @@
Sonntag
-
- stud. Vereine
+
+ Hinzufügen
-
- allg. Links
+
+ Favoriten
+
+
+ Details
+
+
+ Löschen
+
+
+ Löschung ist fehlgeschlagen
+
+
+ Löschung war erfolgreich
Hausaufgaben
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
index 68429a31..e0e40f5b 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
@@ -60,6 +60,24 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
+ ///
+ public static string FileDepartment_Favorite_Name {
+ get {
+ return ResourceManager.GetString("FileDepartment_Favorite_Name", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die DepartmentFeed.xml ähnelt.
+ ///
+ public static string FileDepartment_Name {
+ get {
+ return ResourceManager.GetString("FileDepartment_Name", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die ClubLinks.xml ähnelt.
///
@@ -87,6 +105,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die ähnelt.
+ ///
+ public static string IsolatedStorage_DepartmentFavoriteModel {
+ get {
+ return ResourceManager.GetString("IsolatedStorage_DepartmentFavoriteModel", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die LectureModel ähnelt.
///
@@ -195,6 +222,42 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Departments/DepartmentFavoritePage.xaml ähnelt.
+ ///
+ public static string PathDepartment_DepartmentFavoritePage {
+ get {
+ return ResourceManager.GetString("PathDepartment_DepartmentFavoritePage", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Departments/DepartmentIndexPage.xaml ähnelt.
+ ///
+ public static string PathDepartment_DepartmentIndexPage {
+ get {
+ return ResourceManager.GetString("PathDepartment_DepartmentIndexPage", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Departments/DepartmentInfoPage.xaml ähnelt.
+ ///
+ public static string PathDepartment_DepartmentInfoPage {
+ get {
+ return ResourceManager.GetString("PathDepartment_DepartmentInfoPage", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Departments/DepartmentPage.xaml ähnelt.
+ ///
+ public static string PathDepartment_DepartmentPage {
+ get {
+ return ResourceManager.GetString("PathDepartment_DepartmentPage", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Events/EventPage.xaml ähnelt.
///
@@ -286,7 +349,7 @@ namespace CampusAppWP8.Resources {
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die /pages/news/NewsPage.xaml ähnelt.
+ /// Sucht eine lokalisierte Zeichenfolge, die /Pages/News/NewsPage.xaml ähnelt.
///
public static string PathNews_NewsPage {
get {
@@ -321,6 +384,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/professorships.xml ähnelt.
+ ///
+ public static string UrlDepartment_Addr {
+ get {
+ return ResourceManager.GetString("UrlDepartment_Addr", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die http://www.zv.tu-cottbus.de/LSFveranst/LSF4 ähnelt.
///
@@ -340,7 +412,7 @@ namespace CampusAppWP8.Resources {
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=clubs&app=2&appversion=1 ähnelt.
+ /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=clubs&app=2&appversion=1 ähnelt.
///
public static string UrlLink_ClubLinks {
get {
@@ -349,7 +421,7 @@ namespace CampusAppWP8.Resources {
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=links&app=2&appversion=1 ähnelt.
+ /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=links&app=2&appversion=1 ähnelt.
///
public static string UrlLink_CommonLinks {
get {
@@ -358,7 +430,7 @@ namespace CampusAppWP8.Resources {
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&app=2&appversion=1 ähnelt.
+ /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&app=2&appversion=1 ähnelt.
///
public static string UrlStudentCouncil_StudentCouncils {
get {
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index 8609e1be..f459442d 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -189,26 +189,50 @@
/Pages/Openinghours/OpeninghoursPage.xaml
+
+
+
+
+ DepartmentFavoriteFeed.xml
+
+
+ DepartmentFeed.xml
+
+
+ /Pages/Departments/DepartmentIndexPage.xaml
+
+
+ http://www.tu-cottbus.de/campusapp-data/professorships.xml
+
+
+ /Pages/Departments/DepartmentFavoritePage.xaml
+
+
+ /Pages/Departments/DepartmentInfoPage.xaml
+
+
+ /Pages/Departments/DepartmentPage.xaml
+
ClubLinks.xml
CommonLinks.xml
-
- http://www.tu-cottbus.de/campusapp-data/getdata.php?db=clubs&app=2&appversion=1
+
+ StudentCouncils.xml
-
- http://www.tu-cottbus.de/campusapp-data/getdata.php?db=links&app=2&appversion=1
+
+ pivotindex
+
+
+ /Pages/Events/EventPage.xaml
/Pages/Links/LinkPage.xaml
-
- StudentCouncils.xml
-
-
- http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&app=2&appversion=1
+
+ /Pages/News/NewsPage.xaml
/Pages/StudentCouncil/StudentCouncilPage.xaml
@@ -216,13 +240,13 @@
ToggleContent
-
- pivotindex
+
+ http://www.tu-cottbus.de/campusapp-data/getdata.php?db=clubs&app=2&appversion=1
-
- /pages/news/NewsPage.xaml
+
+ http://www.tu-cottbus.de/campusapp-data/getdata.php?db=links&app=2&appversion=1
-
- /Pages/Events/EventPage.xaml
+
+ http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&app=2&appversion=1
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icon1.ico b/CampusAppWP8/CampusAppWP8/Resources/Icon1.ico
deleted file mode 100644
index e0e8a722..00000000
Binary files a/CampusAppWP8/CampusAppWP8/Resources/Icon1.ico and /dev/null differ
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icons.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Icons.Designer.cs
index a50f46eb..57e08d75 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Icons.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Icons.Designer.cs
@@ -1,42 +1,40 @@
-//------------------------------------------------------------------------------
-//
-// 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.
-//
-//------------------------------------------------------------------------------
-
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 28.06.2013
+//----------------------------------------------------------------------
namespace CampusAppWP8.Resources
{
using System;
using System.Windows;
///
- /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
+ /// Icons uri string.
///
- // 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
{
-
+ ///
+ /// Resource manager object.
+ ///
private static global::System.Resources.ResourceManager resourceMan;
+ ///
+ /// Culture information object.
+ ///
private static global::System.Globalization.CultureInfo resourceCulture;
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ ///
+ /// Initializes a new instance of the class.
+ ///
internal Icons()
{
}
///
- /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
+ /// Gets the resource manager.
///
[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;
}
}
///
- /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
- /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
+ /// Gets or sets the culture information.
///
[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);
}
///
- /// Returns the full filename of the icon, depending on the current theme.
- ///
- /// Tagname
- /// Filename
- 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;
- }
-
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die campus_159.png ähnelt.
+ /// Gets the uri string of the campus icon.
///
public static string Campus
{
@@ -106,7 +80,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die departments_159.png ähnelt.
+ /// Gets the uri string of the departments icon.
///
public static string Departments
{
@@ -117,7 +91,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die homework_159.png ähnelt.
+ /// Gets the uri string of the homework icon.
///
public static string Homework
{
@@ -128,7 +102,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die lectures_159.png ähnelt.
+ /// Gets the uri string of the lectures icon.
///
public static string Lectures
{
@@ -139,7 +113,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die link_159.png ähnelt.
+ /// Gets the uri string of the link icon.
///
public static string Link
{
@@ -150,7 +124,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die mensa_159.png ähnelt.
+ /// Gets the uri string of the mensa icon.
///
public static string Mensa
{
@@ -161,7 +135,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die news_159.png ähnelt.
+ /// Gets the uri string of the news icon.
///
public static string News
{
@@ -172,7 +146,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die openhours_159.png ähnelt.
+ /// Gets the uri string of the opening hours icon.
///
public static string Openhours
{
@@ -183,7 +157,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die schedule_159.png ähnelt.
+ /// Gets the uri string of the schedule icon.
///
public static string Schedule
{
@@ -194,7 +168,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die search_159.png ähnelt.
+ /// Gets the uri string of the search icon.
///
public static string Search
{
@@ -205,7 +179,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die student_council_159.png ähnelt.
+ /// Gets the uri string of the student council icon.
///
public static string StudentCouncil
{
@@ -216,7 +190,7 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die webmail_159.png ähnelt.
+ /// Gets the uri string of the web mail icon.
///
public static string WebMail
{
@@ -227,7 +201,51 @@ typeof(Icons).Assembly);
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die phone_159.png ähnelt.
+ /// Gets the uri string of the favorite icon.
+ ///
+ public static string Favorite
+ {
+ get
+ {
+ return Themerize("Favorite");
+ }
+ }
+
+ ///
+ /// Gets the uri string of the delete icon.
+ ///
+ public static string Delete
+ {
+ get
+ {
+ return Themerize("Delete");
+ }
+ }
+
+ ///
+ /// Gets the uri string of the info icon.
+ ///
+ public static string Info
+ {
+ get
+ {
+ return Themerize("Info");
+ }
+ }
+
+ ///
+ /// Gets the uri string of the add icon.
+ ///
+ public static string Add
+ {
+ get
+ {
+ return Themerize("Add");
+ }
+ }
+
+ ///
+ /// Gets the uri string of the phone icon.
///
public static string Phone
{
@@ -236,5 +254,28 @@ typeof(Icons).Assembly);
return Themerize("Phone");
}
}
+
+ ///
+ /// Return the theme depending string of a icon.
+ ///
+ /// icon name
+ /// uri string of the icon
+ 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;
+ }
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icons.resx b/CampusAppWP8/CampusAppWP8/Resources/Icons.resx
index 919f1551..0b64716b 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Icons.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Icons.resx
@@ -117,15 +117,27 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ add_159.png
+
campus_159.png
+
+ delete_159.png
+
departments_159.png
+
+ favorite_159.png
+
homework_159.png
+
+ info_159.png
+
lectures_159.png
diff --git a/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs b/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs
index 1ba0ed8d..ebb30a38 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/HttpRequest.cs
@@ -15,7 +15,7 @@ namespace CampusAppWP8.Utility
///
/// Class realize the access of restful HttpRequest
///
- public abstract class HttpRequest
+ public class HttpRequest
{
#region Members
diff --git a/CampusAppWP8/CampusAppWP8/Utility/XmlManager.cs b/CampusAppWP8/CampusAppWP8/Utility/XmlManager.cs
index abdb4647..2a559743 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/XmlManager.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/XmlManager.cs
@@ -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;
}
+
+ ///
+ /// Method serializes a model to a string.
+ ///
+ /// type of the model
+ /// model object
+ /// serialized string
+ public static string SerializationToString(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("");
+ retValue = retValue.Substring(endTag + 2);
+
+ if (retValue.StartsWith("\r\n") == true)
+ {
+ retValue = retValue.Substring(2);
+ }
+ }
+
+ return retValue;
+ }
}
}
diff --git a/CampusAppWP8/CampusAppWP8/model/MainModel.cs b/CampusAppWP8/CampusAppWP8/model/MainModel.cs
new file mode 100644
index 00000000..b1a415a9
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/model/MainModel.cs
@@ -0,0 +1,424 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 05.07.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8
+{
+ using System;
+ using System.IO;
+ using System.Net;
+ using System.Text;
+ using CampusAppWP8.Utility;
+
+ ///
+ /// Base model io handling class.
+ ///
+ /// model type
+ public abstract class MainModel : IDisposable
+ {
+ ///
+ /// Model io type.
+ ///
+ private ModelType modelType;
+
+ ///
+ /// Model object.
+ ///
+ private T model = default(T);
+
+ ///
+ /// File object.
+ ///
+ private CampusAppWP8.Utility.File file = null;
+
+ ///
+ /// Web object.
+ ///
+ private HttpRequest api = null;
+
+ ///
+ /// Filename of saved data.
+ ///
+ private string fileName = string.Empty;
+
+ ///
+ /// Url of the feed data.
+ ///
+ private Uri httpApiUri = null;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Model IO type
+ /// name of the file
+ /// url of the feed
+ 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();
+ }
+ }
+
+ ///
+ /// Finalizes an instance of the class.
+ ///
+ ~MainModel()
+ {
+ this.SaveData();
+ }
+
+ ///
+ /// Delegate of the OnLoading callback function.
+ ///
+ public delegate void OnLoading();
+
+ ///
+ /// Delegate of the OnLoaded callback function.
+ ///
+ public delegate void OnLoaded();
+
+ ///
+ /// Delegate of the OnSaving callback function.
+ ///
+ public delegate void OnSaving();
+
+ ///
+ /// Delegate of the OnSaved callback function.
+ ///
+ public delegate void OnSaved();
+
+ ///
+ /// Delegate of the IsModelUpToDate callback function.
+ ///
+ /// data model
+ /// true, model is up to date
+ public delegate bool IsModelUpToDate(T model);
+
+ ///
+ /// Delegate of the IsFileUpToDate callback function.
+ ///
+ /// data model
+ /// info of the file
+ /// true, is file is up to date
+ public delegate bool IsFileUpToDate(T model, FileInfo fileInfo);
+
+ ///
+ /// Callback pointer, called before loading.
+ ///
+ public event OnLoading onLoading = null;
+
+ ///
+ /// Callback pointer, called after loading.
+ ///
+ public event OnLoaded onLoaded = null;
+
+ ///
+ /// Callback pointer, called before saving.
+ ///
+ public event OnSaving onSaving = null;
+
+ ///
+ /// Callback pointer, called after saving.
+ ///
+ public event OnSaved onSaved = null;
+
+ ///
+ /// Callback pointer, for checking if file is up to date.
+ ///
+ public event IsFileUpToDate isFileUpToDate = null;
+
+ ///
+ /// Callback pointer, for checking if model is up to date.
+ ///
+ public event IsModelUpToDate isModelUpToDate = null;
+
+ ///
+ /// Specifies the I/O type of the model.
+ ///
+ public enum ModelType
+ {
+ ///
+ /// Invalid/unset state.
+ ///
+ INVALID = 0,
+
+ ///
+ /// File only (01).
+ ///
+ File = 1,
+
+ ///
+ /// Feed only (10).
+ ///
+ Feed = 2,
+
+ ///
+ /// File and feed (11).
+ ///
+ FileAndFeed = 3
+ }
+
+ ///
+ /// Gets or sets the Model.
+ ///
+ public T Model
+ {
+ get
+ {
+ return this.model;
+ }
+
+ set
+ {
+ this.model = value;
+ }
+ }
+
+ ///
+ /// Called before finalizing. Can maybe be removed.
+ ///
+ public void Dispose()
+ {
+ this.SaveData();
+ }
+
+ ///
+ /// Forces a update from web.
+ ///
+ public void ForceWebUpdate()
+ {
+ if (this.api != null)
+ {
+ if (this.onLoading != null)
+ {
+ this.onLoading();
+ }
+
+ this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete);
+ }
+
+ }
+
+ ///
+ /// Load the data if necessary, from web or from file, regarding if
+ /// the file data is up to date.
+ ///
+ 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();
+ }
+ }
+ }
+
+ ///
+ /// Save the model data if necessary.
+ ///
+ 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();
+ }
+ }
+ }
+
+ ///
+ /// Return the model io type.
+ ///
+ /// model io type
+ public ModelType GetModelType()
+ {
+ return this.modelType;
+ }
+
+ ///
+ /// Return the model.
+ ///
+ /// model object
+ public T GetModel()
+ {
+ return this.model;
+ }
+
+ ///
+ /// Abstract declaration of the model deserialize function.
+ ///
+ /// model data as byte array
+ /// true, is succeeded
+ protected abstract bool DeserializeModel(byte[] modelData);
+
+ ///
+ /// Abstract declaration of the model serialize function.
+ ///
+ /// model data as byte array
+ protected abstract byte[] SerializeModel();
+
+ ///
+ /// Check if the model io type is file.
+ ///
+ /// true, if the model io type has file.
+ protected bool IsFile()
+ {
+ bool retValue = false;
+
+ if ((this.modelType & ModelType.File) != 0)
+ {
+ retValue = true;
+ }
+
+ return retValue;
+ }
+
+ ///
+ /// Check if the model io type is feed.
+ ///
+ /// true if the model io type has feed.
+ protected bool IsHttpApi()
+ {
+ bool retValue = false;
+
+ if ((this.modelType & ModelType.Feed) != 0)
+ {
+ retValue = true;
+ }
+
+ return retValue;
+ }
+
+ ///
+ /// Initializes the file object.
+ ///
+ /// read io type (Default: sync)
+ /// write io type (Default: async)
+ 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);
+ }
+ }
+
+ ///
+ /// Initializes the web object.
+ ///
+ private void InitHttpApi()
+ {
+ if ((this.IsHttpApi() == true)
+ && (this.api == null))
+ {
+ this.api = new HttpRequest();
+ }
+ }
+
+ ///
+ /// Is called after the loading from web is complete.
+ ///
+ /// sending object
+ /// event args
+ 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();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/model/RSS/RSSChannelModel.cs b/CampusAppWP8/CampusAppWP8/model/RSS/RSSChannelModel.cs
new file mode 100644
index 00000000..f09c964b
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/model/RSS/RSSChannelModel.cs
@@ -0,0 +1,56 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8.Model.RSS
+{
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+
+ ///
+ /// Channel Model, which contains the RSS feed item list.
+ ///
+ public class RSSChannelModel
+ {
+ ///
+ /// RSS feed information item list.
+ ///
+ [XmlElement("item")]
+ private ObservableCollection item;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public RSSChannelModel()
+ {
+ this.item = new ObservableCollection();
+ }
+
+ ///
+ /// Gets or sets the RSS feed item list.
+ ///
+ public ObservableCollection 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++;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/model/RSS/RSSModel.cs b/CampusAppWP8/CampusAppWP8/model/RSS/RSSModel.cs
new file mode 100644
index 00000000..a361ecce
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/model/RSS/RSSModel.cs
@@ -0,0 +1,240 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8.Model.RSS
+{
+ using System;
+ using System.Text;
+ using System.Xml.Serialization;
+
+ ///
+ /// Contains the RSS feed information.
+ ///
+ public class RSSModel
+ {
+ ///
+ /// Gets or sets the ListIndex
+ ///
+ public int Index { get; set; }
+
+ ///
+ /// Title of the fees
+ ///
+ private string title;
+
+ ///
+ /// Description text of the feed.
+ ///
+ private string text;
+
+ ///
+ /// Timestamp (publication date) of the event or news.
+ ///
+ private DateTime timestamp;
+
+ ///
+ /// Url of the feed.
+ ///
+ private string link;
+
+ ///
+ /// Gets or sets the title of the feed.
+ ///
+ [XmlElement("title")]
+ public string Title
+ {
+ get
+ {
+ return this.title;
+ }
+
+ set
+ {
+ if (this.title != value)
+ {
+ this.title = value;
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the text of the feed.
+ ///
+ [XmlElement("description")]
+ public string Text
+ {
+ get
+ {
+ return this.text;
+ }
+
+ set
+ {
+ if (this.text != this.HTMLUnicodeToString(value))
+ {
+ this.text = this.HTMLUnicodeToString(value);
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the timestamp of the feed as string.
+ ///
+ [XmlElement("pubDate")]
+ public string Timestamp
+ {
+ get
+ {
+ return this.timestamp.ToString("R");
+ }
+
+ set
+ {
+ if (this.timestamp != DateTime.Parse(value))
+ {
+ this.timestamp = DateTime.Parse(value);
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the timestamp of the feed as DateTime object.
+ ///
+ public DateTime DTTimestamp
+ {
+ get
+ {
+ return this.timestamp;
+ }
+
+ set
+ {
+ this.timestamp = value;
+ }
+ }
+
+ ///
+ /// Gets the date of the timestamp as string.
+ /// example: Mon, 25.06.2013.
+ ///
+ public string Date
+ {
+ get
+ {
+ return string.Format("{0:ddd, dd.MM.yyyy}", this.timestamp);
+ }
+ }
+
+ ///
+ /// Gets the time of the timestamp as string.
+ /// example: 12:56 Uhr.
+ ///
+ public string Time
+ {
+ get
+ {
+ return string.Format("{0:h:mm} Uhr", this.timestamp);
+ }
+ }
+
+ ///
+ /// Gets or sets the link/url of the feed.
+ ///
+ [XmlElement("link")]
+ public string Link
+ {
+ get
+ {
+ return this.link;
+ }
+
+ set
+ {
+ if (this.link != value)
+ {
+ this.link = value;
+ }
+ }
+ }
+
+ ///
+ /// Comparing function for DateTime timestamps.
+ /// (currently unused)
+ ///
+ /// first item
+ /// second item
+ /// -1 if item2 is older then item1, otherwise 0
+ public static int CompareTimeStamp(RSSModel item1, RSSModel item2)
+ {
+ if (item1.DTTimestamp > item2.DTTimestamp)
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ ///
+ /// Remove or transform html-unicode specific tags into ASCII.
+ ///
+ /// html string
+ /// ASCII string
+ 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();
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/model/RSS/RSSViewModel.cs b/CampusAppWP8/CampusAppWP8/model/RSS/RSSViewModel.cs
new file mode 100644
index 00000000..f182f1a8
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/model/RSS/RSSViewModel.cs
@@ -0,0 +1,53 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8.Model.RSS
+{
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+
+ ///
+ /// ViewModel of the RSS feed, containing the feed/channel object.
+ ///
+ [XmlRoot("root")]
+ public class RSSViewModel
+ {
+ ///
+ /// Channel list for the RSS feeds.
+ ///
+ [XmlArray("rss")]
+ [XmlArrayItem("channel")]
+ private ObservableCollection channel;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public RSSViewModel()
+ {
+ this.channel = new ObservableCollection();
+ }
+
+ ///
+ /// Gets or sets the channel list.
+ ///
+ public ObservableCollection Channel
+ {
+ get
+ {
+ return this.channel;
+ }
+
+ set
+ {
+ if (value != this.channel)
+ {
+ this.channel = value;
+ }
+ }
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/model/XmlModel.cs b/CampusAppWP8/CampusAppWP8/model/XmlModel.cs
new file mode 100644
index 00000000..4baedf31
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/model/XmlModel.cs
@@ -0,0 +1,71 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 05.07.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8.Model
+{
+ using System.Text;
+ using CampusAppWP8.Resources;
+ using CampusAppWP8.Utility;
+
+ ///
+ /// Xml model io handler class.
+ ///
+ /// model type
+ public class XmlModel : MainModel
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// model io type
+ /// filename of the data file
+ /// url of the feed data
+ public XmlModel(ModelType modelType, string fileName, string url)
+ : base(modelType, fileName, url)
+ {
+ }
+
+ ///
+ /// Create the model from a xml byte array.
+ ///
+ /// model data
+ /// true, if succeeded
+ protected override bool DeserializeModel(byte[] modelData)
+ {
+ bool retValue = true;
+
+ string data = Encoding.UTF8.GetString(modelData, 0, modelData.Length);
+
+ T tempModel = XmlManager.DeserializationToModel(data, Constants.XMLRootElementName);
+ if (tempModel != null)
+ {
+ this.Model = tempModel;
+ }
+ else
+ {
+ retValue = false;
+ }
+
+ return retValue;
+ }
+
+ ///
+ /// Serializes the model to a byte array.
+ ///
+ /// model data
+ protected override byte[] SerializeModel()
+ {
+ byte[] retValue = null;
+
+ if (this.Model != null)
+ {
+ retValue = Encoding.UTF8.GetBytes(XmlManager.SerializationToString(this.Model));
+ }
+
+ return retValue;
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs
index 2f286a93..01e98248 100644
--- a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs
@@ -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);
+ }
}
}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentFavoritePage.xaml b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentFavoritePage.xaml
new file mode 100644
index 00000000..fb8dd7df
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentFavoritePage.xaml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentFavoritePage.xaml.cs b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentFavoritePage.xaml.cs
new file mode 100644
index 00000000..2647fdf7
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentFavoritePage.xaml.cs
@@ -0,0 +1,112 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 01.07.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Pages.Departments
+{
+ using System;
+ using System.Windows;
+ using System.Windows.Controls;
+ using System.Windows.Navigation;
+ using CampusAppWP8.Resources;
+ using Microsoft.Phone.Controls;
+
+ ///
+ /// Page to visualize the favorite department list.
+ ///
+ public partial class DepartmentFavoritePage : PhoneApplicationPage
+ {
+ ///
+ /// Object to store the last clicked chair button.
+ ///
+ private FrameworkElement lastClickedBtn = null;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public DepartmentFavoritePage()
+ {
+ this.InitializeComponent();
+ }
+
+ ///
+ /// On navigation to this page.
+ /// Initialize the list source.
+ ///
+ /// event args
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ this.ContentPanel.ItemsSource = DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].Chairs;
+ }
+
+ ///
+ /// On clicking on a chair button.
+ /// Open or close the chair details.
+ ///
+ /// clicked button
+ /// event args
+ 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;
+ }
+ }
+
+ ///
+ /// On clicking on a delete button.
+ /// Removes the chair from the favorite list.
+ ///
+ /// clicked button
+ /// event args
+ 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);
+ }
+ }
+
+ ///
+ /// On clicking on a info button.
+ /// Open a department info page.
+ ///
+ /// clicked button
+ /// event args
+ 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));
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentIndexPage.xaml b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentIndexPage.xaml
new file mode 100644
index 00000000..7cf96e78
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentIndexPage.xaml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentIndexPage.xaml.cs b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentIndexPage.xaml.cs
new file mode 100644
index 00000000..9c048b81
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentIndexPage.xaml.cs
@@ -0,0 +1,160 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//----------------------------------------------------------------------
+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;
+
+ ///
+ /// Page with a list of the faculties.
+ ///
+ public partial class DepartmentIndexPage : PhoneApplicationPage
+ {
+ ///
+ /// Department/chair feed object, storing the model and data.
+ ///
+ private static DepartmentFeed feed = null;
+
+ ///
+ /// Department feed object for storing the favorite list.
+ ///
+ private static DepartmentFavoriteFeed favorite = null;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ 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();
+ }
+
+ ///
+ /// Return the feed object of the departments.
+ ///
+ /// feed object
+ public static DepartmentFeed GetFeed()
+ {
+ return DepartmentIndexPage.feed; // DepartmentIndexPage.feed;
+ }
+
+ ///
+ /// Return the feed object of the favorite departments.
+ ///
+ /// feed object
+ public static DepartmentFavoriteFeed GetFavoriteFeed()
+ {
+ return DepartmentIndexPage.favorite; // DepartmentIndexPage.favorite;
+ }
+
+ ///
+ /// On navigation to this page.
+ /// Initialize the feed loading.
+ ///
+ /// event args
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+
+ if (NavigationMode.Back != e.NavigationMode)
+ {
+ }
+ }
+
+ ///
+ /// On navigation from this page.
+ /// Store the favorite list.
+ ///
+ /// event args
+ protected override void OnNavigatedFrom(NavigationEventArgs e)
+ {
+ if (NavigationMode.Back == e.NavigationMode)
+ {
+ DepartmentIndexPage.favorite.SaveData();
+ }
+
+ base.OnNavigatedFrom(e);
+ }
+
+ ///
+ /// On orientation changed.
+ ///
+ /// sender object
+ /// event args
+ private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
+ {
+ }
+
+ ///
+ /// Setup the faculty list.
+ ///
+ private void SetupFacultyList()
+ {
+ this.FacultyList.ItemsSource = DepartmentIndexPage.feed.GetModel().Faculties;
+ }
+
+ ///
+ /// Checks if the favorite feed is valid.
+ ///
+ 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"));
+ }
+ }
+
+ ///
+ /// On clicking on the favorite button.
+ ///
+ /// clicked button
+ /// event args
+ private void FavoriteBtn_Click(object sender, RoutedEventArgs e)
+ {
+ NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentFavoritePage, UriKind.Relative));
+ }
+
+ ///
+ /// On clicking on a faculty button.
+ ///
+ /// clicked button
+ /// event args
+ 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));
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentInfoPage.xaml b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentInfoPage.xaml
new file mode 100644
index 00000000..19d9b033
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentInfoPage.xaml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentInfoPage.xaml.cs b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentInfoPage.xaml.cs
new file mode 100644
index 00000000..4f9f7c22
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/pages/departments/DepartmentInfoPage.xaml.cs
@@ -0,0 +1,56 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 01.07.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Pages.Departments
+{
+ using System;
+ using System.Windows.Navigation;
+ using Microsoft.Phone.Controls;
+
+ ///
+ /// Info page of a chair.
+ ///
+ public partial class DepartmentInfoPage : PhoneApplicationPage
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public DepartmentInfoPage()
+ {
+ this.InitializeComponent();
+ }
+
+ ///
+ /// On navigation to this page.
+ /// Initialize the page headline text.
+ ///
+ /// event args
+ 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));
+ }
+ }
+
+ ///
+ /// On orientation changed.
+ ///
+ /// sender object
+ /// event args
+ private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/utility/FeedEventHandler.cs b/CampusAppWP8/CampusAppWP8/utility/FeedEventHandler.cs
index 4ea85a84..cc5a4e94 100644
--- a/CampusAppWP8/CampusAppWP8/utility/FeedEventHandler.cs
+++ b/CampusAppWP8/CampusAppWP8/utility/FeedEventHandler.cs
@@ -43,7 +43,10 @@ namespace CampusAppWP8.Utility
///
public void FireFeedReadyevent()
{
- this.FeedIsReadyEvent();
+ if (this.FeedIsReadyEvent != null)
+ {
+ this.FeedIsReadyEvent();
+ }
}
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/utility/File.cs b/CampusAppWP8/CampusAppWP8/utility/File.cs
new file mode 100644
index 00000000..8e6fcae3
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/utility/File.cs
@@ -0,0 +1,231 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 03.05.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8.Utility
+{
+ using System;
+ using System.IO;
+ using Windows.Storage;
+
+ ///
+ /// File class.
+ ///
+ public class File
+ {
+ ///
+ /// Folder object.
+ ///
+ private static readonly IStorageFolder LocalFolder = ApplicationData.Current.LocalFolder;
+
+ ///
+ /// File name.
+ ///
+ private string filename = string.Empty;
+
+ ///
+ /// Read type.
+ ///
+ private IOTypeRead readType;
+
+ ///
+ /// Write type.
+ ///
+ private IOTypeWrite writeType;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// file name
+ /// read type
+ /// write type
+ public File(string filename, IOTypeRead read, IOTypeWrite write)
+ {
+ this.filename = filename;
+ this.readType = (read == IOTypeRead.INVALID) ? IOTypeRead.ReadAsync : read;
+ this.writeType = write;
+ }
+
+ ///
+ /// IO read type ENUM.
+ ///
+ public enum IOTypeRead
+ {
+ ///
+ /// Invalid/unset state.
+ ///
+ INVALID = 0,
+
+ ///
+ /// Sync read.
+ ///
+ ReadSync = 1,
+
+ ///
+ /// Async read.
+ ///
+ ReadAsync = 2
+ }
+
+ ///
+ /// IO write type ENUM.
+ ///
+ public enum IOTypeWrite
+ {
+ ///
+ /// Invalid/unset state.
+ ///
+ INVALID = 0,
+
+ ///
+ /// Sync write.
+ ///
+ WriteSync = 1,
+
+ ///
+ /// Async write.
+ ///
+ WriteAsync = 2,
+
+ ///
+ /// Read only, no writing.
+ ///
+ ReadOnly = 3
+ }
+
+ ///
+ /// Read data from file to a string.
+ ///
+ /// read type
+ /// data string
+ 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;
+ }
+
+ ///
+ /// Write bytes to the file.
+ ///
+ /// data byte array
+ /// write type
+ 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);
+ }
+ }
+
+ ///
+ /// Return a info object of the file.
+ ///
+ /// info of the file
+ public FileInfo GetFileInfo()
+ {
+ FileInfo info = new FileInfo(File.LocalFolder.Path + "\\" + this.filename);
+ return info;
+ }
+
+ ///
+ /// Check if a file is existing.
+ ///
+ /// true, if file exists, otherwise false
+ public bool Exist()
+ {
+ return this.GetFileInfo().Exists;
+ }
+
+ ///
+ /// Read data synchronous from file.
+ ///
+ /// data string
+ 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;
+ }
+
+ ///
+ /// Read data asynchronous from file.
+ ///
+ /// data string
+ private string ReadAsync()
+ {
+ string retValue = string.Empty;
+
+ return retValue;
+ }
+
+ ///
+ /// Write data synchronous to file.
+ ///
+ /// data array
+ /// true, if succeeded
+ private bool WriteSync(byte[] data)
+ {
+ bool retValue = true;
+
+ return retValue;
+ }
+
+ ///
+ /// Write data asynchronous to file.
+ ///
+ /// data array
+ 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);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/utility/FileList.cs b/CampusAppWP8/CampusAppWP8/utility/FileList.cs
index 189278eb..18f5b3f1 100644
--- a/CampusAppWP8/CampusAppWP8/utility/FileList.cs
+++ b/CampusAppWP8/CampusAppWP8/utility/FileList.cs
@@ -24,5 +24,15 @@ namespace CampusAppWP8.Utility
/// Opening hours feed file name.
///
public static readonly string OpeninghoursXmlFile = "OpeninghoursFeed.xml";
+
+ ///
+ /// Department feed file name.
+ ///
+ public static readonly string DepartmentXmlFile = "DepartmentFeed.xml";
+
+ ///
+ /// Department favorite feed file name.
+ ///
+ public static readonly string DepartmentFavoriteXmlFile = "DepartmentFavoriteFeed.xml";
}
}
diff --git a/CampusAppWP8/CampusAppWP8/utility/FileManager.cs b/CampusAppWP8/CampusAppWP8/utility/FileManager.cs
index d3d8b50b..884a4edb 100644
--- a/CampusAppWP8/CampusAppWP8/utility/FileManager.cs
+++ b/CampusAppWP8/CampusAppWP8/utility/FileManager.cs
@@ -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);
}
}
diff --git a/CampusAppWP8/CampusAppWP8/utility/XmlFile.cs b/CampusAppWP8/CampusAppWP8/utility/XmlFile.cs
new file mode 100644
index 00000000..29196969
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/utility/XmlFile.cs
@@ -0,0 +1,38 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 05.07.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8.Utility
+{
+ using CampusAppWP8.Resources;
+
+ public class XmlFile : 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(data, Constants.XMLRootElementName);
+ }
+
+ return retValue;
+ }
+
+ }
+}
\ No newline at end of file