diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..ad3aeb41 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,64 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +*.csproj -text merge=union +*.sln -text merge=union +*.resx -text merge=union +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..cbb8760a --- /dev/null +++ b/.gitignore @@ -0,0 +1,163 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store +gitattributes +gitignore +winphone/ +.spl +.srum +*.spl +*.srum +Doxyfile +screenshots/ diff --git a/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs b/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs index 6b3a6e4f..885c86fc 100644 --- a/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/Lecture/LectureApi.cs @@ -5,7 +5,7 @@ // stubbfel // 13.06.2013 //---------------------------------------------------------------------- -namespace CampusAppWP8.Api.Lecture +namespace CampusAppWP8.Feed.Lecture { using System; using CampusAppWP8.Model.Lecture; diff --git a/CampusAppWP8/CampusAppWP8/App.xaml b/CampusAppWP8/CampusAppWP8/App.xaml index eb834714..5358a12e 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml +++ b/CampusAppWP8/CampusAppWP8/App.xaml @@ -8,8 +8,17 @@ - - + + + + + + + + + + + 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/btulogo_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/btulogo_159.png new file mode 100644 index 00000000..c220e77b Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/btulogo_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/btulogo_159.png b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/btulogo_159.png new file mode 100644 index 00000000..f98729b1 Binary files /dev/null and b/CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/btulogo_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 3fdb572d..85541caa 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -96,16 +96,21 @@ App.xaml + + + + + + - - - + + @@ -113,16 +118,31 @@ + + + + + + CampusMapPage.xaml + + DepartmentFavoritePage.xaml + + + DepartmentIndexPage.xaml + + + DepartmentInfoPage.xaml + DepartmentPage.xaml @@ -133,11 +153,9 @@ EventPage.xaml - + LecturePage.xaml - - ModulWebPage.xaml @@ -149,6 +167,9 @@ ResultPage.xaml + + LinkPage.xaml + MensaPage.xaml @@ -159,13 +180,16 @@ NewsPage.xaml - + OpeninghoursPage.xaml - + StartPage.xaml + + StudentCouncilPage.xaml + WebmailPage.xaml @@ -181,24 +205,26 @@ Constants.resx - True + True True Icons.resx - PreserveNewest - - - - + + + + + + - + + Code + - @@ -210,6 +236,18 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -238,6 +276,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -258,10 +300,22 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + @@ -277,14 +331,24 @@ PreserveNewest + + + + + + + + + + @@ -332,13 +396,14 @@ Designer - ResXFileCodeGenerator + PublicResXFileCodeGenerator Constants.Designer.cs + Designer - PublicResXFileCodeGenerator + PublicResXFileCodeGenerator Icons.Designer.cs - PreserveNewest + Designer diff --git a/CampusAppWP8/CampusAppWP8/Const.cs b/CampusAppWP8/CampusAppWP8/Const.cs new file mode 100644 index 00000000..57cfe428 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Const.cs @@ -0,0 +1,33 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8 +{ + using CampusAppWP8.Resources; + + /// + /// Access to Constants.rex + /// + public class Const + { + /// + /// Resource object. + /// + private static Constants constantResources = new Constants(); + + /// + /// Gets the resource object. + /// + public Constants Constants + { + get + { + return constantResources; + } + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs new file mode 100644 index 00000000..bdd59d24 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFavoriteFeed.cs @@ -0,0 +1,93 @@ +//----------------------------------------------------------------------- +// +// 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. + /// + /// automatic loading of the data + 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 . + /// + /// model object + /// 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 . + /// + /// model object + /// file info object + /// 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..e967ec95 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Departments/DepartmentFeed.cs @@ -1,37 +1,104 @@ -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.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. + /// + /// automatic loading of the data + 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 . /// + /// model object /// 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 + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 7.0); + } + + return retValue; } /// - /// Method implement CheckIsFileUpToDate()-Method + /// Method implement CheckIsFileUpToDate()-Method . /// + /// model object + /// file info object /// 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) + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 7.0); + } + } + 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..099c8571 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Events/EventFeed.cs @@ -1,41 +1,89 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using CampusAppWP8.Model.events_news; -using CampusAppWP8.Utility; - -namespace CampusAppWP8.Api.Events +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Events { + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.RSS; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + /// /// Event Feed. /// - public class EventFeed : XmlFeed + public class EventFeed : XmlModel { /// - /// Default constructor. + /// Initializes a new instance of the class. /// - public EventFeed() : base(URLList.EventsFeedURL, "EventFeed.xml") + /// automatic loading of the data + public EventFeed(bool autoLoad = true) + : base(ModelType.FileAndFeed, Constants.FileEvents_Name, Constants.UrlEvents_Addr) { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + + if (autoLoad == true) + { + this.LoadData(); + } } + /// /// Method implement CheckIsModelUpToDate()-Method /// + /// model object /// true, if model is up-to-date, otherwise false - protected override bool CheckIsModelUpToDate() + private bool CheckIsModelUpToDate(RSSViewModel model) { - return false; + bool retValue = true; + + if (model == null) + { + retValue = false; + } + else + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 1.0); + } + + return retValue; } /// /// Method implement CheckIsFileUpToDate()-Method /// + /// model object + /// file info object /// true, if file is up-to-date, otherwise false - protected override bool CheckIsFileUpToDate() + private bool CheckIsFileUpToDate(RSSViewModel model, FileInfo info) { - return true; + bool retValue = true; + + if (model == null) + { + // at loading + if (info.Exists == true) + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0); + } + } + else + { + // at saving + if ((info.Exists == false) + || (info.Length == 0)) + { + retValue = false; + } + } + + return retValue; } } } diff --git a/CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs new file mode 100644 index 00000000..76f9d279 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs @@ -0,0 +1,90 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Link +{ + using System; + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.Link; + using CampusAppWP8.Resources; + + /// + /// This Class is for ClubLinkFeeds + /// + public class ClubLinkFeed : XmlModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public ClubLinkFeed() + : base(ModelType.FileAndFeed, Constants.FileLink_ClubLinks, Constants.UrlLink_ClubLinks) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + } + + #endregion + + #region Method + + #region Private + + /// + /// Method check if the FeedModel is up-to-date + /// + /// reference of the FeedModel + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(LinkListModel model) + { + if (model == null) + { + return false; + } + + DateTime lastModified = model.CreateTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the FeedFile is up-to-date + /// + /// reference of the FeedModel + /// info about the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo) + { + DateTime lastModified = fileInfo.LastWriteTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Check if the model or file is up-to-date. + /// + /// Date of the last modification + /// true, if is up-to-date, otherwise false + private bool CheckIsUpToDate(DateTime lastModified) + { + DateTime temp = lastModified.AddDays(1); + + int diff = temp.CompareTo(DateTime.Now); + + if (diff < 0) + { + return false; + } + + return true; + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs new file mode 100644 index 00000000..35c1db36 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs @@ -0,0 +1,90 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.Link +{ + using System; + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.Link; + using CampusAppWP8.Resources; + + /// + /// This Class is for CommonLinkFeeds + /// + public class CommonLinkFeed : XmlModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public CommonLinkFeed() + : base(ModelType.FileAndFeed, Constants.FileLink_CommonLinks, Constants.UrlLink_CommonLinks) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + } + + #endregion + + #region Method + + #region Private + + /// + /// Method check if the FeedModel is up-to-date + /// + /// reference of the FeedModel + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(LinkListModel model) + { + if (model == null) + { + return false; + } + + DateTime lastModified = model.CreateTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the FeedFile is up-to-date + /// + /// reference of the FeedModel + /// info about the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo) + { + DateTime lastModified = fileInfo.LastWriteTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Check if the model or file is up-to-date. + /// + /// Date of the last modification + /// true, if is up-to-date, otherwise false + private bool CheckIsUpToDate(DateTime lastModified) + { + DateTime temp = lastModified.AddDays(1); + + int diff = temp.CompareTo(DateTime.Now); + + if (diff < 0) + { + return false; + } + + return true; + } + + #endregion + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs index e1c85c4e..265d1aca 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs @@ -5,17 +5,18 @@ // stubbfel // 03.05.2013 //---------------------------------------------------------------------- -namespace CampusAppWP8.Api.Mensa +namespace CampusAppWP8.Feed.Mensa { using System; - using System.Collections.ObjectModel; + using System.IO; + using CampusAppWP8.Model; using CampusAppWP8.Model.Mensa; - using CampusAppWP8.Utility; + using CampusAppWP8.Resources; /// - /// This Class is for MesaFeeds + /// This Class is for MensaFeeds /// - public class MensaFeed : XmlFeed + public class MensaFeed : XmlModel { #region Constructor @@ -23,40 +24,46 @@ namespace CampusAppWP8.Api.Mensa /// Initializes a new instance of the class. /// public MensaFeed() - : base(URLList.MensaFeedURL, FileList.MensaXmlFile) + : base(ModelType.FileAndFeed, Constants.FileMensa_Shedule, Constants.UrlMensa_Week) { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); } #endregion #region Method - #region Protected - - /// - /// Method implement CheckIsModelUpToDate()-Method - /// - /// true, if model is up-to-date, otherwise false - protected override bool CheckIsModelUpToDate() - { - DateTime lastModified = this.Model.CreateTime; - return this.CheckIsUpToDate(lastModified); - } - - /// - /// Method implement CheckIsFileUpToDate()-Method - /// - /// true, if file is up-to-date, otherwise false - protected override bool CheckIsFileUpToDate() - { - DateTime lastModified = FileManager.GetFileInfo(FileName).LastWriteTime; - return this.CheckIsUpToDate(lastModified); - } - - #endregion - #region Private + /// + /// Method check if the FeedModel is up-to-date + /// + /// reference of the FeedModel + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(MenuWeekModel model) + { + if (model == null) + { + return false; + } + + DateTime lastModified = model.CreateTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the FeedFile is up-to-date + /// + /// reference of the FeedModel + /// info about the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(MenuWeekModel model, FileInfo fileInfo) + { + DateTime lastModified = fileInfo.LastWriteTime; + return this.CheckIsUpToDate(lastModified); + } + /// /// Method check if the last modification was later as the NewMenuWeekDay /// diff --git a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs index 6cd2e40d..d6cd0411 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/News/NewsFeed.cs @@ -1,42 +1,89 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using CampusAppWP8.Model.events_news; -using CampusAppWP8.Utility; - -namespace CampusAppWP8.Api.News +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Feed.News { + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.RSS; + using CampusAppWP8.Resources; + using CampusAppWP8.Utility; + /// /// News Feed. /// - public class NewsFeed : XmlFeed + public class NewsFeed : XmlModel { /// - /// Default constructor. + /// Initializes a new instance of the class. /// - public NewsFeed() : base(URLList.NewsFeedURL, "NewsFeed.xml") + /// automatic loading of the data + public NewsFeed(bool autoLoad = true) + : base(ModelType.FileAndFeed, Constants.FileNews_Name, Constants.UrlNews_Addr) { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + + if (autoLoad == true) + { + this.LoadData(); + } } /// /// Method implement CheckIsModelUpToDate()-Method /// + /// model object /// true, if model is up-to-date, otherwise false - protected override bool CheckIsModelUpToDate() + private bool CheckIsModelUpToDate(RSSViewModel model) { - return false; + bool retValue = true; + + if (model == null) + { + retValue = false; + } + else + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 1.0); + } + + return retValue; } /// /// Method implement CheckIsFileUpToDate()-Method /// + /// model object + /// info object of the file /// true, if file is up-to-date, otherwise false - protected override bool CheckIsFileUpToDate() + private bool CheckIsFileUpToDate(RSSViewModel model, FileInfo info) { - return true; + bool retValue = true; + + if (model == null) + { + // at loading + if (info.Exists == true) + { + retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0); + } + } + else + { + // at saving + if ((info.Exists == false) + || (info.Length == 0)) + { + retValue = false; + } + } + + return retValue; } } } diff --git a/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs index 8200ca78..d1b0fb71 100644 --- a/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs +++ b/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs @@ -8,14 +8,15 @@ namespace CampusAppWP8.Feed.Openinghours { using System; - using System.Collections.ObjectModel; + using System.IO; + using CampusAppWP8.Model; using CampusAppWP8.Model.Openinghours; - using CampusAppWP8.Utility; + using CampusAppWP8.Resources; /// /// This Class is for MesaFeeds /// - public class OpeninghoursFeed : XmlFeed + public class OpeninghoursFeed : XmlModel { #region Constructor @@ -23,40 +24,46 @@ namespace CampusAppWP8.Feed.Openinghours /// Initializes a new instance of the class. /// public OpeninghoursFeed() - : base(URLList.OpeninghoursFeedURL, FileList.OpeninghoursXmlFile) + : base(ModelType.FileAndFeed, Constants.FileOpeningHours_OpeningHours, Constants.UrlOpeningHours_OpeningHours) { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); } #endregion #region Method - #region Protected - - /// - /// Method implement CheckIsModelUpToDate()-Method . - /// - /// true, if model is up-to-date, otherwise false - protected override bool CheckIsModelUpToDate() - { - DateTime lastModified = this.Model.CreateTime; - return this.CheckIsUpToDate(lastModified); - } - - /// - /// Method implement CheckIsFileUpToDate()-Method . - /// - /// true, if file is up-to-date, otherwise false - protected override bool CheckIsFileUpToDate() - { - DateTime lastModified = FileManager.GetFileInfo(FileName).LastWriteTime; - return this.CheckIsUpToDate(lastModified); - } - - #endregion - #region Private + /// + /// Method check if the FeedModel is up-to-date + /// + /// reference of the FeedModel + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(OpeninghoursModel model) + { + if (model == null) + { + return false; + } + + DateTime lastModified = model.CreateTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the FeedFile is up-to-date + /// + /// reference of the FeedModel + /// info about the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(OpeninghoursModel model, FileInfo fileInfo) + { + DateTime lastModified = fileInfo.LastWriteTime; + return this.CheckIsUpToDate(lastModified); + } + /// /// Check if the model or file is up-to-date. /// diff --git a/CampusAppWP8/CampusAppWP8/Feed/StudentCouncil/StudentCouncilFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/StudentCouncil/StudentCouncilFeed.cs new file mode 100644 index 00000000..a2520fc3 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Feed/StudentCouncil/StudentCouncilFeed.cs @@ -0,0 +1,90 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Feed.StudentCouncil +{ + using System; + using System.IO; + using CampusAppWP8.Model; + using CampusAppWP8.Model.StudentCouncil; + using CampusAppWP8.Resources; + + /// + /// This Class is for StudentCouncilFeed + /// + public class StudentCouncilFeed : XmlModel + { + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public StudentCouncilFeed() + : base(ModelType.FileAndFeed, Constants.FileStudentCouncil_StudentCouncils, Constants.UrlStudentCouncil_StudentCouncils) + { + this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate); + this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate); + } + + #endregion + + #region Method + + #region Private + + /// + /// Method check if the FeedModel is up-to-date + /// + /// reference of the FeedModel + /// true, if model is up-to-date, otherwise false + private bool CheckIsModelUpToDate(StudentCouncilListModel model) + { + if (model == null) + { + return false; + } + + DateTime lastModified = model.CreateTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Method check if the FeedFile is up-to-date + /// + /// reference of the FeedModel + /// info about the file + /// true, if file is up-to-date, otherwise false + private bool CheckIsFileUpToDate(StudentCouncilListModel model, FileInfo fileInfo) + { + DateTime lastModified = fileInfo.LastWriteTime; + return this.CheckIsUpToDate(lastModified); + } + + /// + /// Check if the model or file is up-to-date. + /// + /// Date of the last modification + /// true, if is up-to-date, otherwise false + private bool CheckIsUpToDate(DateTime lastModified) + { + DateTime temp = lastModified.AddDays(1); + + int diff = temp.CompareTo(DateTime.Now); + + if (diff < 0) + { + return false; + } + + return true; + } + + #endregion + + #endregion + } +} 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/RSSChannelModel.cs b/CampusAppWP8/CampusAppWP8/Model/Events/RSSChannelModel.cs index 2e8bc8aa..dc24d2e9 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Events/RSSChannelModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Events/RSSChannelModel.cs @@ -37,6 +37,11 @@ namespace CampusAppWP8.Model.events_news if (value != this.item) { this.item = value; + int i = 0; + foreach (RSSModel rssItem in this.item) + { + rssItem.Index = i++; + } NotifyPropertyChanged("item"); } } diff --git a/CampusAppWP8/CampusAppWP8/Model/Events/RSSModel.cs b/CampusAppWP8/CampusAppWP8/Model/Events/RSSModel.cs index 19d53cb9..20833cfd 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Events/RSSModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Events/RSSModel.cs @@ -108,6 +108,11 @@ namespace CampusAppWP8.Model.events_news get { return String.Format("{0:h:mm} Uhr", this.timestamp); } } + /// + /// Gets or sets the ListIndex + /// + public int Index { get; set; } + /// /// Set/Get the link/url of the feed. /// 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/Model/Lecture/LecturePageModel.cs b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs index ca79f582..c0446795 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs @@ -8,6 +8,7 @@ namespace CampusAppWP8.Model.Lecture { using System.Collections.Generic; + using System.Linq; using System.Runtime.Serialization; using CampusAppWP8.Model.Utility; using CampusAppWP8.Resources; @@ -161,6 +162,13 @@ namespace CampusAppWP8.Model.Lecture this.numberList.Add(new ListPickerItemModel() { Text = "2", Value = "2" }); this.numberList.Add(new ListPickerItemModel() { Text = "3", Value = "3" }); this.numberList.Add(new ListPickerItemModel() { Text = "4", Value = "4" }); + this.numberList.Add(new ListPickerItemModel() { Text = "5", Value = "5" }); + this.numberList.Add(new ListPickerItemModel() { Text = "5", Value = "6" }); + this.numberList.Add(new ListPickerItemModel() { Text = "7", Value = "7" }); + this.numberList.Add(new ListPickerItemModel() { Text = "8", Value = "8" }); + this.numberList.Add(new ListPickerItemModel() { Text = "9", Value = "9" }); + this.numberList.Add(new ListPickerItemModel() { Text = "10", Value = "10" }); + } /// @@ -233,6 +241,7 @@ namespace CampusAppWP8.Model.Lecture this.courseList.Add(new ListPickerItemModel() { Text = "Architektur.Studium.Generale", Value = "858" }); this.courseList.Add(new ListPickerItemModel() { Text = "Verarbeitungstechnologien der Werkstoffe", Value = "860" }); this.courseList.Add(new ListPickerItemModel() { Text = "Forensic Sciences and Engineering", Value = "871" }); + this.courseList = this.courseList.OrderBy(o => o.Text).ToList(); } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Model/Link/LinkListModel.cs b/CampusAppWP8/CampusAppWP8/Model/Link/LinkListModel.cs new file mode 100644 index 00000000..c512e9ea --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Link/LinkListModel.cs @@ -0,0 +1,64 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Model.Link +{ + using System; + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// Model for a list of links. + /// + [XmlRoot("root")] + public class LinkListModel + { + #region Member + + /// + /// Time when the model was created. + /// + private readonly DateTime createTime; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LinkListModel() + { + this.createTime = DateTime.Now; + } + + #endregion + + #region Property + + /// + /// Gets or sets feed information item list. + /// + [XmlArray("data")] + [XmlArrayItem("link")] + public ObservableCollection Links { get; set; } + + /// + /// Gets the creation time of the model. + /// + public DateTime CreateTime + { + get + { + return this.createTime; + } + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/Link/LinkModel.cs b/CampusAppWP8/CampusAppWP8/Model/Link/LinkModel.cs new file mode 100644 index 00000000..d25e347d --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Link/LinkModel.cs @@ -0,0 +1,173 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Model.Link +{ + using System.Globalization; + using System.Xml.Serialization; + + /// + /// Model for menu + /// + public class LinkModel + { + #region Member + + /// + /// German version of the link title. + /// + private string titleDE; + + /// + /// English version of the link title. + /// + private string titleEN; + + /// + /// German version of the link. + /// + private string linkDE; + + /// + /// English version of the link. + /// + private string linkEN; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public LinkModel() + { + } + + #endregion + + #region Property + + /// + /// Gets or sets the german title of the link. + /// + [XmlAttribute("title_de")] + public string Title_DE + { + get + { + return this.titleDE; + } + + set + { + if (value != this.titleDE) + { + this.titleDE = value; + } + } + } + + /// + /// Gets or sets the english title of the link. + /// + [XmlAttribute("title_en")] + public string Title_EN + { + get + { + return this.titleEN; + } + + set + { + this.titleEN = value; + } + } + + /// + /// Gets or sets the german link. + /// + [XmlAttribute("link_de")] + public string Link_DE + { + get + { + return this.linkDE; + } + + set + { + if (value != this.linkDE) + { + this.linkDE = value; + } + } + } + + /// + /// Gets or sets the english link. + /// + [XmlAttribute("link_en")] + public string Link_EN + { + get + { + return this.linkEN; + } + + set + { + if (value != this.linkEN) + { + this.linkEN = value; + } + } + } + + /// + /// Gets the localized title. If the phone is set to german language, + /// the german title will be returned otherwise the english title. + /// + public string Title + { + get + { + if (CultureInfo.CurrentUICulture.Name.StartsWith("de")) + { + return this.titleDE; + } + else + { + return this.titleEN; + } + } + } + + /// + /// Gets the localized link. if the phone is set to german language, + /// the german comment will be returned otherwise the english link. + /// + public string Link + { + get + { + if (CultureInfo.CurrentUICulture.Name.StartsWith("de")) + { + return this.Link_DE; + } + else + { + return this.Link_EN; + } + } + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/MainModel.cs b/CampusAppWP8/CampusAppWP8/Model/MainModel.cs new file mode 100644 index 00000000..d2346440 --- /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/mensa/MenuModel.cs b/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuModel.cs similarity index 99% rename from CampusAppWP8/CampusAppWP8/model/mensa/MenuModel.cs rename to CampusAppWP8/CampusAppWP8/Model/Mensa/MenuModel.cs index eece367a..06d3aa34 100644 --- a/CampusAppWP8/CampusAppWP8/model/mensa/MenuModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuModel.cs @@ -3,7 +3,7 @@ // Company copyright tag. // // stubbfel -// 03.05.2013 +// 04.05.2013 //---------------------------------------------------------------------- namespace CampusAppWP8.Model.Mensa { diff --git a/CampusAppWP8/CampusAppWP8/model/mensa/MenuWeekModel.cs b/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuWeekModel.cs similarity index 100% rename from CampusAppWP8/CampusAppWP8/model/mensa/MenuWeekModel.cs rename to CampusAppWP8/CampusAppWP8/Model/Mensa/MenuWeekModel.cs diff --git a/CampusAppWP8/CampusAppWP8/Model/RSS/RSSChannelModel.cs b/CampusAppWP8/CampusAppWP8/Model/RSS/RSSChannelModel.cs new file mode 100644 index 00000000..52c1d499 --- /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. + /// + private ObservableCollection item; + + /// + /// Initializes a new instance of the class. + /// + public RSSChannelModel() + { + this.item = new ObservableCollection(); + } + + /// + /// Gets or sets the RSS feed item list. + /// + [XmlElement("item")] + 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..725cd074 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/RSS/RSSModel.cs @@ -0,0 +1,256 @@ +//----------------------------------------------------------------------------- +// +// 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 + { + /// + /// Index of this object. + /// + private int index = -1; + + /// + /// 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; + } + } + } + + /// + /// Gets or sets the ListIndex. + /// + public int Index + { + get + { + return this.index; + } + + set + { + this.index = 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..e09a01f0 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/RSS/RSSViewModel.cs @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 24.06.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Model.RSS +{ + using System; + using System.Collections.ObjectModel; + using System.Xml.Serialization; + + /// + /// ViewModel of the RSS feed, containing the feed/channel object. + /// + [XmlRoot("root")] + public class RSSViewModel + { + /// + /// Object to store the time when the instance was created. + /// + private DateTime createTime; + + /// + /// Channel list for the RSS feeds. + /// + private ObservableCollection channel; + + /// + /// Initializes a new instance of the class. + /// + public RSSViewModel() + { + this.channel = new ObservableCollection(); + this.createTime = DateTime.Now; + } + + /// + /// Gets or sets the channel list. + /// + [XmlArray("rss")] + [XmlArrayItem("channel")] + public ObservableCollection Channel + { + get + { + return this.channel; + } + + set + { + if (value != this.channel) + { + this.channel = value; + } + } + } + + /// + /// Gets the creation time. + /// + public DateTime CreateTime + { + get + { + return this.createTime; + } + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilListModel.cs b/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilListModel.cs new file mode 100644 index 00000000..1a935a1a --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilListModel.cs @@ -0,0 +1,80 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Model.StudentCouncil +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; + using System.Xml.Serialization; + + /// + /// Model for menus in one week + /// + [XmlRoot("root")] + public class StudentCouncilListModel + { + #region Members + /// + /// Time when the model was created + /// + private readonly DateTime createTime; + + #endregion + #region Constructor + /// + /// Initializes a new instance of the class. + /// + public StudentCouncilListModel() + { + this.createTime = DateTime.Now; + } + + #endregion + + #region Proberty + /// + /// Gets or sets the StudentCouncils + /// + [XmlArray("data")] + [XmlArrayItem("studentcouncil")] + public ObservableCollection StudentCouncils { get; set; } + + /// + /// Gets the creation time of the model + /// + public DateTime CreateTime + { + get + { + return this.createTime; + } + } + + #endregion + + #region Method + /// + /// Method group the StudentCouncilList by Faculty + /// + /// a Dictionary, where the Key is name of the Faculty und the value is a List of StudentCouncil + public Dictionary> GetStudentCouncilsGroupByFaculty() + { + List> tmpList = this.StudentCouncils.GroupBy(p => p.Faculty).ToList(); + Dictionary> itemMap = new Dictionary>(); + foreach (IGrouping group in tmpList) + { + Dictionary> tempDic = new Dictionary>(); + itemMap.Add(group.Key, group.ToList()); + } + + return itemMap; + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilModel.cs b/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilModel.cs new file mode 100644 index 00000000..1009645e --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/StudentCouncil/StudentCouncilModel.cs @@ -0,0 +1,86 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 02.07.2013 +//----------------------------------------------------------------------------- + +namespace CampusAppWP8.Model.StudentCouncil +{ + using System.Xml.Serialization; + using CampusAppWP8.Resources; + + /// + /// Model for menu + /// + public class StudentCouncilModel + { + #region Member + + /// + /// name of the faculty. + /// + private string faculty; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public StudentCouncilModel() + { + } + + #endregion + + #region Property + + /// + /// Gets or sets the faculty of the StudentCouncil. + /// + [XmlAttribute("faculty")] + public string Faculty + { + get + { + return this.faculty; + } + + set + { + if (value != this.faculty) + { + this.faculty = value; + int num; + if (int.TryParse(this.faculty, out num)) + { + this.faculty = AppResources.Faculty + " " + num; + } + } + } + } + + /// + /// Gets or sets the name of the StudentCouncil. + /// + [XmlAttribute("name")] + public string Name { get; set; } + + /// + /// Gets or sets the webpage-url of the StudentCouncil. + /// + [XmlAttribute("url")] + public string Url { get; set; } + + /// + /// Gets or sets the email-address of the StudentCouncil. + /// + [XmlAttribute("email")] + public string Email { get; set; } + + #endregion + } +} 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/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/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 b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml index 1c4b30c8..91c75427 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml @@ -6,10 +6,11 @@ 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:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" - SupportedOrientations="Portrait" Orientation="Portrait" + SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" mc:Ignorable="d" shell:SystemTray.IsVisible="True"> @@ -26,7 +27,20 @@ - + + + + + + + + + + + \ 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 78774169..d79cc557 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventIndexPage.xaml.cs @@ -7,27 +7,21 @@ //----------------------------------------------------------------------------- namespace CampusAppWP8.Pages.Events { - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; using System.Linq; - using System.Windows; - using System.Windows.Controls; using System.Windows.Navigation; - using CampusAppWP8.Api.Events; - using CampusAppWP8.Model.events_news; + using CampusAppWP8.Feed.Events; using CampusAppWP8.Utility; using Microsoft.Phone.Controls; - + /// /// Overview page of all 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 = null; /// /// Initializes a new instance of the class. @@ -35,7 +29,23 @@ namespace CampusAppWP8.Pages.Events public EventIndexPage() { this.InitializeComponent(); - EventIndexPage.eventFeed = new EventFeed(); + + if (EventIndexPage.eventFeed == null) + { + EventIndexPage.eventFeed = new EventFeed(false); + } + + EventIndexPage.eventFeed.onLoaded += new EventFeed.OnLoaded(this.SetupEventPageList); + EventIndexPage.eventFeed.LoadData(); + } + + /// + /// Return the eventFeed object. + /// + /// event feed object + public static EventFeed GetEventFeed() + { + return EventIndexPage.eventFeed; } /// @@ -45,17 +55,6 @@ namespace CampusAppWP8.Pages.Events protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); - - 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)) - { - // Set handler and load the fees informations. - EventIndexPage.eventFeed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.SetupEventPageList); - EventIndexPage.eventFeed.LoadFeed(); - } } /// @@ -65,53 +64,7 @@ namespace CampusAppWP8.Pages.Events /// private void SetupEventPageList() { - if ((EventIndexPage.eventFeed.Model != null) - && (EventIndexPage.eventFeed.Model.Channel != null) - && (EventIndexPage.eventFeed.Model.Channel.Count() >= 1) - && (this.ButtonPanel.Items.Count() == 0)) - { - // Sort the list of rssfeeds. - IEnumerable tempList = EventIndexPage.eventFeed.Model.Channel[0].item.OrderByDescending(e => e.DTTimestamp); - EventIndexPage.eventFeed.Model.Channel[0].item = new ObservableCollection(tempList); - - // Create the buttons for the fees selection and add it to the buttonpanel. - for (int i = 0; i < EventIndexPage.eventFeed.Model.Channel[0].item.Count(); i++) - { - Button tempBtn = new Button(); - tempBtn.Name = "EventRowAppButton"; - tempBtn.Content = EventIndexPage.eventFeed.Model.Channel[0].item[i].Title; - tempBtn.VerticalContentAlignment = VerticalAlignment.Stretch; - tempBtn.HorizontalContentAlignment = HorizontalAlignment.Stretch; - tempBtn.BorderThickness = new Thickness(0.0); - tempBtn.Padding = new Thickness(0.0); - tempBtn.Click += this.EventRowAppButton_Click; - tempBtn.Tag = i; - - this.ButtonPanel.Items.Add(tempBtn); - } - } - } - - /// - /// Gets the eventFeed object. - /// - public static EventFeed GetEventFeed - { - get { return EventIndexPage.eventFeed; } - } - - /// - /// Is called on clicking on a feed button. - /// Navigates to the event pivot page with the information of the - /// selected feed index. - /// - /// pressed button object - /// event args - private void EventRowAppButton_Click(object sender, RoutedEventArgs e) - { - FrameworkElement tempElem = sender as FrameworkElement; - - NavigationService.Navigate(new Uri("/pages/events/EventPage.xaml?pivotindex=" + tempElem.Tag, UriKind.Relative)); + this.EventList.ItemsSource = EventIndexPage.eventFeed.Model.Channel[0].Item; } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml index 7ff46edf..0f72f4bf 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml @@ -6,12 +6,12 @@ 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}" Foreground="{StaticResource PhoneForegroundBrush}" - SupportedOrientations="Portrait" Orientation="Portrait" + SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" shell:SystemTray.IsVisible="True"> diff --git a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs index 2520c3b7..35882882 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Events/EventPage.xaml.cs @@ -5,7 +5,6 @@ // fiedlchr // 03.05.2013 //----------------------------------------------------------------------------- - namespace CampusAppWP8.Pages.Events { using System; @@ -14,8 +13,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. /// @@ -47,13 +45,8 @@ namespace CampusAppWP8.Pages.Events // Set pivotitem Source if (this.isSourceSet == false) { - if ((EventIndexPage.GetEventFeed.Model != null) - && (EventIndexPage.GetEventFeed.Model.Channel != null) - && (EventIndexPage.GetEventFeed.Model.Channel.Count() >= 1)) - { - this.EventPivot.ItemsSource = EventIndexPage.GetEventFeed.Model.Channel[0].item; - this.isSourceSet = true; - } + this.EventPivot.ItemsSource = EventIndexPage.GetEventFeed().Model.Channel[0].Item; + this.isSourceSet = true; } string pivotIndex = string.Empty; @@ -64,7 +57,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/Lecture/LecturePage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml index f0454ac3..d67c3cee 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml @@ -13,7 +13,7 @@ SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" mc:Ignorable="d" shell:SystemTray.IsVisible="True"> - + @@ -22,11 +22,12 @@ - + + - - - + + + @@ -53,7 +54,7 @@ - + @@ -64,9 +65,9 @@ - - - + + + @@ -76,7 +77,7 @@ - + @@ -86,12 +87,12 @@ - - - + + + - + @@ -99,7 +100,7 @@ - + @@ -109,14 +110,14 @@ - - - + + + - + @@ -126,11 +127,12 @@ - - - + + + + @@ -139,7 +141,7 @@ - + @@ -149,9 +151,9 @@ - - - + + + @@ -159,7 +161,7 @@ diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs index 779ba594..d1b83c22 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs @@ -12,7 +12,7 @@ namespace CampusAppWP8.Pages.Lecture using System.Windows; using System.Windows.Media.Imaging; using System.Windows.Navigation; - using CampusAppWP8.Api.Lecture; + using CampusAppWP8.Feed.Lecture; using CampusAppWP8.Model.Lecture; using CampusAppWP8.Model.Utility; using CampusAppWP8.Resources; diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml index dfea3521..bc3d090b 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultDetailPage.xaml @@ -22,7 +22,8 @@ - + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml index cac704bf..d4d8c4f4 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml @@ -6,6 +6,8 @@ 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:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" + xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" @@ -13,39 +15,6 @@ mc:Ignorable="d" shell:SystemTray.IsVisible="True"> - - - - - - - - - + - - - + + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs index 6c577d86..7d484a9b 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs @@ -7,15 +7,10 @@ //---------------------------------------------------------------------- namespace CampusAppWP8.Pages.Openinghours { - using System.Linq; - using System.Windows; - using System.Windows.Controls; using System.Windows.Navigation; using CampusAppWP8.Feed.Openinghours; - using CampusAppWP8.Utility; using Microsoft.Phone.Controls; - using Microsoft.Phone.Tasks; - + /// /// Opening hours page. /// @@ -28,11 +23,6 @@ namespace CampusAppWP8.Pages.Openinghours /// private OpeninghoursFeed feed = null; - /// - /// last visible UI element. - /// - private UIElement lastOpenUIElem = null; - #endregion #region Constructor @@ -69,7 +59,7 @@ namespace CampusAppWP8.Pages.Openinghours this.ProgressBar.Visibility = System.Windows.Visibility.Visible; } - this.feed.LoadFeed(); + this.feed.LoadData(); } // protected @@ -83,7 +73,7 @@ namespace CampusAppWP8.Pages.Openinghours private void InitializeFeed() { this.feed = new OpeninghoursFeed(); - this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady); + this.feed.onLoaded += new OpeninghoursFeed.OnLoaded(this.FeedIsReady); } /// @@ -103,91 +93,6 @@ namespace CampusAppWP8.Pages.Openinghours this.InstitutionPanel.ItemsSource = this.feed.Model.Institutions; } - /// - /// Called on clicking on a institution. - /// - /// button object - /// event args - private void InstitutionBtn_Click(object sender, RoutedEventArgs e) - { - if (this.lastOpenUIElem != null) - { - this.lastOpenUIElem.Visibility = Visibility.Collapsed; - } - - FrameworkElement btn = sender as FrameworkElement; - StackPanel parent = btn.Parent as StackPanel; - - if (parent.Children.Count() >= 2) - { - if (this.lastOpenUIElem != parent.Children[1]) - { - this.lastOpenUIElem = parent.Children[1]; - this.lastOpenUIElem.Visibility = Visibility.Visible; - } - else - { - this.lastOpenUIElem = null; - } - } - } - - /// - /// Called on clicking on a mail button. - /// - /// button object - /// event args - private void EMailBtn_Click(object sender, RoutedEventArgs e) - { - FrameworkElement tempUIElem = sender as FrameworkElement; - - string[] info = tempUIElem.Tag.ToString().Split(':'); - - if ((info.Count() > 0) && (info[0] != null)) - { - EmailComposeTask emailTask = new EmailComposeTask(); - emailTask.To = "mailto:" + info[0]; - emailTask.Show(); - } - } - - /// - /// Called on clicking on a phone button. - /// - /// button object - /// event args - private void PhoneBtn_Click(object sender, RoutedEventArgs e) - { - FrameworkElement tempUIElem = sender as FrameworkElement; - PhoneCallTask phoneCallTask = new PhoneCallTask(); - - string[] info = tempUIElem.Tag.ToString().Split(':'); - - if ((info.Count() > 0) && (info[0] != null)) - { - phoneCallTask.PhoneNumber = info[0]; - } - - if ((info.Count() > 1) && (info[1] != null)) - { - phoneCallTask.DisplayName = info[1]; - } - - phoneCallTask.Show(); - } - - /// - /// Called on clicking on a location button. - /// - /// button object - /// event args - private void LocationBtn_Click(object sender, RoutedEventArgs e) - { - FrameworkElement tempUIElem = sender as FrameworkElement; - - // TODO: open campusmap - } - // private #endregion // Method diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml new file mode 100644 index 00000000..42dc15ff --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs new file mode 100644 index 00000000..eaa6d530 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -0,0 +1,83 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 21.05.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages +{ + using System; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Navigation; + using CampusAppWP8.Resources; + using Microsoft.Phone.Controls; + + /// + /// Class for the StartPage + /// + public partial class StartPage : PhoneApplicationPage + { + /// + /// Initializes a new instance of the class. + /// + public StartPage() + { + this.InitializeComponent(); + } + + /// + /// Method handle OrientationPage + /// + /// Caller of the function + /// some EventArgs + private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) + { + // Switch the placement of the buttons based on an orientation change. + if (this.Orientation == PageOrientation.LandscapeLeft || this.Orientation == PageOrientation.LandscapeRight) + { + OpenHoursAppButton.SetValue(Grid.RowProperty, 0); + OpenHoursAppButton.SetValue(Grid.ColumnProperty, 3); + OpenHoursAppButtonText.Text = AppResources.OpenHoursApp_Title; + + OSAAppButton.SetValue(Grid.RowProperty, 1); + OSAAppButton.SetValue(Grid.ColumnProperty, 3); + + LinkAppButton.SetValue(Grid.RowProperty, 2); + LinkAppButton.SetValue(Grid.ColumnProperty, 3); + + ContentPanel.Margin = new Thickness(12, -24, 0, 0); + + HomeworkAppButtonText.Text = AppResources.HomeworkApp_Title; + ContentPanel.RowDefinitions[3].Height = GridLength.Auto; + ContentPanel.ColumnDefinitions[3].Width = new GridLength(1, GridUnitType.Star); + } + else + { + // If not in portrait, move buttonList content to visible row and column. + ContentPanel.Margin = new Thickness(12, 0, 12, 12); + OpenHoursAppButton.SetValue(Grid.RowProperty, 3); + OpenHoursAppButton.SetValue(Grid.ColumnProperty, 0); + OpenHoursAppButtonText.Text = AppResources.OpenHoursApp_Title2; + + OSAAppButton.SetValue(Grid.RowProperty, 3); + OSAAppButton.SetValue(Grid.ColumnProperty, 1); + + LinkAppButton.SetValue(Grid.RowProperty, 3); + LinkAppButton.SetValue(Grid.ColumnProperty, 2); + + HomeworkAppButtonText.Text = AppResources.HomeworkApp_Title2; + + ContentPanel.RowDefinitions[3].Height = new GridLength(1,GridUnitType.Star); + ContentPanel.ColumnDefinitions[3].Width = GridLength.Auto; + } + } + + 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/StudentCouncil/StudentCouncilPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml new file mode 100644 index 00000000..6be59cd1 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs new file mode 100644 index 00000000..fa36d6a6 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/StudentCouncil/StudentCouncilPage.xaml.cs @@ -0,0 +1,94 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 03.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Pages.StudentCouncil +{ + using System.Windows.Navigation; + using Microsoft.Phone.Controls; + using CampusAppWP8.Feed.StudentCouncil; + + /// + /// Class for the StudentCouncilPage + /// + public partial class StudentCouncilPage : PhoneApplicationPage + { + #region Members + + /// + /// the feed of the StudentCouncil + /// + private StudentCouncilFeed feed; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + public StudentCouncilPage() + { + this.InitializeComponent(); + this.InitializeFeed(); + } + + #endregion + + #region Method + + #region protected + + /// + /// Override the OnNavigatedTo method + /// + /// Arguments of navigation + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + if (this.feed == null) + { + this.InitializeFeed(); + } + + this.ProgressBar.Visibility = System.Windows.Visibility.Visible; + this.feed.LoadData(); + } + + #endregion + #region private + + /// + /// Method initialize the Feed + /// + private void InitializeFeed() + { + this.feed = new StudentCouncilFeed(); + this.feed.onLoaded += new StudentCouncilFeed.OnLoaded(this.FeedIsReady); + } + + /// + /// Method will be execute if the feed is ready + /// + private void FeedIsReady() + { + this.SetupStudentCouncilPivot(); + this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; + } + + /// + /// Method set ItemSource + /// + private void SetupStudentCouncilPivot() + { + this.StudentCouncilPivot.ItemsSource = this.feed.Model.GetStudentCouncilsGroupByFaculty(); + } + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Webmail/WebmailPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Webmail/WebmailPage.xaml index ea9333d6..76b9077f 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Webmail/WebmailPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Webmail/WebmailPage.xaml @@ -16,15 +16,14 @@ - - + - + diff --git a/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml b/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml index 7eaa8266..7e39fb64 100644 --- a/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml +++ b/CampusAppWP8/CampusAppWP8/Properties/WMAppManifest.xml @@ -2,7 +2,7 @@ - Assets\ApplicationIcon.png + Assets\Icons\DarkTheme\btulogo_159.png diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index c7b511b2..ac03ffd4 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.18046 +// Laufzeitversion:4.0.30319.18051 // // Ä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. /// @@ -177,6 +222,24 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Haus- aufgaben ähnelt. + /// + public static string HomeworkApp_Title2 { + get { + return ResourceManager.GetString("HomeworkApp_Title2", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Details ähnelt. + /// + public static string Info { + get { + return ResourceManager.GetString("Info", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt. /// @@ -294,6 +357,24 @@ 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. /// @@ -429,6 +510,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Öffnungs- zeiten ähnelt. + /// + public static string OpenHoursApp_Title2 { + get { + return ResourceManager.GetString("OpenHoursApp_Title2", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Fachschaften ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 4aa62828..b7bf7b09 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -1,290 +1,320 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - LeftToRight - Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language - - - de-de - Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language. - - - BTU CampusApp - - - Beispielwert für die Laufzeiteigenschaft - - - Hinzufügen - - - Menübefehl - - - Willkommen zur BTU-CampusApp WP8 - - - Campusplan - - - Lehrstühle - - - Events - - - Hausaufgaben - - - Vorlesungen - - - Links - - - Webmail - - - Mensaplan - - - News - - - Öffnungszeiten - - - Fachschaften - - - Stundenplan - - - Studiengang - - - Abschluss - - - Veranstaltungsname - - - Semester - - - Fachsemester - - - Freitag - - - Montag - - - Donnerstag - - - Dienstag - - - Mittwoch - - - Aktion - - - Bio - - - Essen 1 - - - Essen 2 - - - Essen 3 - - - Essen 4 - - - Heute nicht im Angbot - - - zur Übersicht - - - 84 - - - Studiengänge - - - Lehrstuhl - - - Vorlesungen - Details - - - Lehrinhalt - - - Verantwortlicher - - - Veranstaltungsart - - - Fakultät - - - Lehrstühle - - - Link - - - Bachelor - - - Diplom - - - Master - - - Studiengangauswahl - - - Gebäude - - - Hinweis - - - Raum - - - Samstag - - - Sonntag - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + LeftToRight + Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language + + + de-de + Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language. + + + BTU CampusApp + + + Beispielwert für die Laufzeiteigenschaft + + + Hinzufügen + + + Menübefehl + + + Willkommen zur BTU-CampusApp WP8 + + + Campusplan + + + Lehrstühle + + + Events + + + Haus- aufgaben + + + Vorlesungen + + + Links + + + Webmail + + + Mensaplan + + + News + + + Öffnungs- zeiten + + + Fachschaften + + + Stundenplan + + + Studiengang + + + Abschluss + + + Veranstaltungsname + + + Semester + + + Fachsemester + + + Freitag + + + Montag + + + Donnerstag + + + Dienstag + + + Mittwoch + + + Aktion + + + Bio + + + Essen 1 + + + Essen 2 + + + Essen 3 + + + Essen 4 + + + Heute nicht im Angbot + + + zur Übersicht + + + 84 + + + Studiengänge + + + Lehrstuhl + + + Vorlesungen - Details + + + Lehrinhalt + + + Verantwortlicher + + + Veranstaltungsart + + + Fakultät + + + Lehrstühle + + + Link + + + Bachelor + + + Diplom + + + Master + + + Studiengangauswahl + + + Gebäude + + + Hinweis + + + Raum + + + Samstag + + + Sonntag + + + Hinzufügen + + + Favoriten + + + Details + + + Löschen + + + Löschung ist fehlgeschlagen + + + Löschung war erfolgreich + + + Hausaufgaben + + + Öffnungszeiten + + + stud. Vereine + + + allg. Links + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index c4881720..e79b1eff 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.18046 +// Laufzeitversion:4.0.30319.18051 // // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn // der Code erneut generiert wird. @@ -22,7 +22,7 @@ namespace CampusAppWP8.Resources { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Constants { + public class Constants { private static global::System.Resources.ResourceManager resourceMan; @@ -36,7 +36,7 @@ namespace CampusAppWP8.Resources { /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CampusAppWP8.Resources.Constants", typeof(Constants).Assembly); @@ -51,7 +51,7 @@ namespace CampusAppWP8.Resources { /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + public static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -60,10 +60,100 @@ 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 EventsFeed.xml ähnelt. + /// + public static string FileEvents_Name { + get { + return ResourceManager.GetString("FileEvents_Name", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die ClubLinks.xml ähnelt. + /// + public static string FileLink_ClubLinks { + get { + return ResourceManager.GetString("FileLink_ClubLinks", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die CommonLinks.xml ähnelt. + /// + public static string FileLink_CommonLinks { + get { + return ResourceManager.GetString("FileLink_CommonLinks", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die MensaFeed.xml ähnelt. + /// + public static string FileMensa_Shedule { + get { + return ResourceManager.GetString("FileMensa_Shedule", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die NewsFeed.xml ähnelt. + /// + public static string FileNews_Name { + get { + return ResourceManager.GetString("FileNews_Name", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die OpeninghoursFeed.xml ähnelt. + /// + public static string FileOpeningHours_OpeningHours { + get { + return ResourceManager.GetString("FileOpeningHours_OpeningHours", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die StudentCouncils.xml ähnelt. + /// + public static string FileStudentCouncil_StudentCouncils { + get { + return ResourceManager.GetString("FileStudentCouncil_StudentCouncils", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_DepartmentFavoriteModel ähnelt. + /// + public static string IsolatedStorage_DepartmentFavoriteModel { + get { + return ResourceManager.GetString("IsolatedStorage_DepartmentFavoriteModel", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die LectureModel ähnelt. /// - internal static string IsolatedStorage_LectureModel { + public static string IsolatedStorage_LectureModel { get { return ResourceManager.GetString("IsolatedStorage_LectureModel", resourceCulture); } @@ -72,7 +162,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_LecturePageModel ähnelt. /// - internal static string IsolatedStorage_LecturePageModel { + public static string IsolatedStorage_LecturePageModel { get { return ResourceManager.GetString("IsolatedStorage_LecturePageModel", resourceCulture); } @@ -81,7 +171,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die lsf_auszug ähnelt. /// - internal static string LectureXmlValidRootName { + public static string LectureXmlValidRootName { get { return ResourceManager.GetString("LectureXmlValidRootName", resourceCulture); } @@ -90,7 +180,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt. /// - internal static string ParamGetLecture_Course { + public static string ParamGetLecture_Course { get { return ResourceManager.GetString("ParamGetLecture_Course", resourceCulture); } @@ -99,7 +189,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die Abschluss ähnelt. /// - internal static string ParamGetLecture_Degree { + public static string ParamGetLecture_Degree { get { return ResourceManager.GetString("ParamGetLecture_Degree", resourceCulture); } @@ -108,7 +198,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die Von ähnelt. /// - internal static string ParamGetLecture_From { + public static string ParamGetLecture_From { get { return ResourceManager.GetString("ParamGetLecture_From", resourceCulture); } @@ -117,7 +207,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die Semester ähnelt. /// - internal static string ParamGetLecture_Semester { + public static string ParamGetLecture_Semester { get { return ResourceManager.GetString("ParamGetLecture_Semester", resourceCulture); } @@ -126,7 +216,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die Bis ähnelt. /// - internal static string ParamGetLecture_To { + public static string ParamGetLecture_To { get { return ResourceManager.GetString("ParamGetLecture_To", resourceCulture); } @@ -135,7 +225,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die ActivityId ähnelt. /// - internal static string ParamModelLecture_ActivityId { + public static string ParamModelLecture_ActivityId { get { return ResourceManager.GetString("ParamModelLecture_ActivityId", resourceCulture); } @@ -144,25 +234,79 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die ModulNumber ähnelt. /// - internal static string ParamModelLecture_ModulNumber { + public static string ParamModelLecture_ModulNumber { get { return ResourceManager.GetString("ParamModelLecture_ModulNumber", resourceCulture); } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die pivotindex ähnelt. + /// + public static string ParamPivotIndex { + get { + return ResourceManager.GetString("ParamPivotIndex", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Url ähnelt. /// - internal static string ParamUrl { + public static string ParamUrl { get { return ResourceManager.GetString("ParamUrl", resourceCulture); } } + /// + /// 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. + /// + public static string PathEvent_EventPage { + get { + return ResourceManager.GetString("PathEvent_EventPage", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Events/EventIndexPage.xaml ähnelt. /// - internal static string PathEvents_EventsIndexPage { + public static string PathEvents_EventsIndexPage { get { return ResourceManager.GetString("PathEvents_EventsIndexPage", resourceCulture); } @@ -171,7 +315,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/LecturePage.xaml ähnelt. /// - internal static string PathLecture_LecturePage { + public static string PathLecture_LecturePage { get { return ResourceManager.GetString("PathLecture_LecturePage", resourceCulture); } @@ -180,7 +324,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ModulWebPage.xaml ähnelt. /// - internal static string PathLecture_ModulWebPage { + public static string PathLecture_ModulWebPage { get { return ResourceManager.GetString("PathLecture_ModulWebPage", resourceCulture); } @@ -189,7 +333,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ResultDetailPage.xaml ähnelt. /// - internal static string PathLecture_ResultDetailPage { + public static string PathLecture_ResultDetailPage { get { return ResourceManager.GetString("PathLecture_ResultDetailPage", resourceCulture); } @@ -198,16 +342,25 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ResultPage.xaml ähnelt. /// - internal static string PathLecture_ResultPage { + public static string PathLecture_ResultPage { get { return ResourceManager.GetString("PathLecture_ResultPage", resourceCulture); } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Links/LinkPage.xaml ähnelt. + /// + public static string PathLinks_LinkPage { + get { + return ResourceManager.GetString("PathLinks_LinkPage", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Webmail/WebmailPage.xaml ähnelt. /// - internal static string PathMail_WebMailPage { + public static string PathMail_WebMailPage { get { return ResourceManager.GetString("PathMail_WebMailPage", resourceCulture); } @@ -216,7 +369,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Mensa/MensaPage.xaml ähnelt. /// - internal static string PathMensa_MensaPage { + public static string PathMensa_MensaPage { get { return ResourceManager.GetString("PathMensa_MensaPage", resourceCulture); } @@ -225,25 +378,70 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/News/NewsIndexPage.xaml ähnelt. /// - internal static string PathNews_NewsIndexPage { + public static string PathNews_NewsIndexPage { get { return ResourceManager.GetString("PathNews_NewsIndexPage", resourceCulture); } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die /Pages/News/NewsPage.xaml ähnelt. + /// + public static string PathNews_NewsPage { + get { + return ResourceManager.GetString("PathNews_NewsPage", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Openinghours/OpeninghoursPage.xaml ähnelt. /// - internal static string PathOpeninghours_OpeninghoursPage { + public static string PathOpeninghours_OpeninghoursPage { get { return ResourceManager.GetString("PathOpeninghours_OpeninghoursPage", resourceCulture); } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die /Pages/StudentCouncil/StudentCouncilPage.xaml ähnelt. + /// + public static string PathStudentCouncil_StudentCouncilPage { + get { + return ResourceManager.GetString("PathStudentCouncil_StudentCouncilPage", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die ToggleContent ähnelt. + /// + public static string ToggleContent { + get { + return ResourceManager.GetString("ToggleContent", resourceCulture); + } + } + + /// + /// 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.tu-cottbus.de/oracle-gateway/php/rss2feed_veranstaltungen.php ähnelt. + /// + public static string UrlEvents_Addr { + get { + return ResourceManager.GetString("UrlEvents_Addr", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die http://www.zv.tu-cottbus.de/LSFveranst/LSF4 ähnelt. /// - internal static string UrlLecture_ApiBaseAddr { + public static string UrlLecture_ApiBaseAddr { get { return ResourceManager.GetString("UrlLecture_ApiBaseAddr", resourceCulture); } @@ -252,16 +450,70 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die https://www.tu-cottbus.de/modul/ ähnelt. /// - internal static string UrlLecture_ModulBaseAddr { + public static string UrlLecture_ModulBaseAddr { get { return ResourceManager.GetString("UrlLecture_ModulBaseAddr", resourceCulture); } } + /// + /// 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 { + return ResourceManager.GetString("UrlLink_ClubLinks", resourceCulture); + } + } + + /// + /// 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 { + return ResourceManager.GetString("UrlLink_CommonLinks", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/ ähnelt. + /// + public static string UrlMensa_Week { + get { + return ResourceManager.GetString("UrlMensa_Week", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php ähnelt. + /// + public static string UrlNews_Addr { + get { + return ResourceManager.GetString("UrlNews_Addr", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=openinghours&app=2&appversion=1 ähnelt. + /// + public static string UrlOpeningHours_OpeningHours { + get { + return ResourceManager.GetString("UrlOpeningHours_OpeningHours", resourceCulture); + } + } + + /// + /// 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 { + return ResourceManager.GetString("UrlStudentCouncil_StudentCouncils", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die https://webmail.tu-cottbus.de ähnelt. /// - internal static string UrlWebMail_Addr { + public static string UrlWebMail_Addr { get { return ResourceManager.GetString("UrlWebMail_Addr", resourceCulture); } @@ -270,7 +522,7 @@ namespace CampusAppWP8.Resources { /// /// Sucht eine lokalisierte Zeichenfolge, die root ähnelt. /// - internal static string XMLRootElementName { + public static string XMLRootElementName { get { return ResourceManager.GetString("XMLRootElementName", resourceCulture); } diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 9011849e..2e3354f7 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -1,192 +1,279 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - LectureModel - - - ActivityId - - - ModulNumber - - - Url - - - /Pages/Lecture/ModulWebPage.xaml - - - /Pages/Lecture/ResultDetailPage.xaml - - - https://www.tu-cottbus.de/modul/ - - - root - - - https://webmail.tu-cottbus.de - - - /Pages/Lecture/ResultPage.xaml - - - lsf_auszug - - - Studiengang - - - Abschluss - - - Von - - - Semester - - - Bis - - - http://www.zv.tu-cottbus.de/LSFveranst/LSF4 - - - IsolatedStorage_LecturePageModel - - - /Pages/Lecture/LecturePage.xaml - - - /Pages/Events/EventIndexPage.xaml - - - /Pages/Webmail/WebmailPage.xaml - - - /Pages/Mensa/MensaPage.xaml - - - /Pages/News/NewsIndexPage.xaml - - - /Pages/Openinghours/OpeninghoursPage.xaml - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + LectureModel + + + ActivityId + + + ModulNumber + + + Url + + + /Pages/Lecture/ModulWebPage.xaml + + + /Pages/Lecture/ResultDetailPage.xaml + + + https://www.tu-cottbus.de/modul/ + + + root + + + https://webmail.tu-cottbus.de + + + /Pages/Lecture/ResultPage.xaml + + + lsf_auszug + + + Studiengang + + + Abschluss + + + Von + + + Semester + + + Bis + + + http://www.zv.tu-cottbus.de/LSFveranst/LSF4 + + + IsolatedStorage_LecturePageModel + + + /Pages/Lecture/LecturePage.xaml + + + /Pages/Events/EventIndexPage.xaml + + + /Pages/Webmail/WebmailPage.xaml + + + /Pages/Mensa/MensaPage.xaml + + + /Pages/News/NewsIndexPage.xaml + + + /Pages/Openinghours/OpeninghoursPage.xaml + + + IsolatedStorage_DepartmentFavoriteModel + + + 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 + + + StudentCouncils.xml + + + pivotindex + + + /Pages/Events/EventPage.xaml + + + /Pages/Links/LinkPage.xaml + + + /Pages/News/NewsPage.xaml + + + /Pages/StudentCouncil/StudentCouncilPage.xaml + + + ToggleContent + + + http://www.tu-cottbus.de/campusapp-data/getdata.php?db=clubs&app=2&appversion=1 + + + http://www.tu-cottbus.de/campusapp-data/getdata.php?db=links&app=2&appversion=1 + + + http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&app=2&appversion=1 + + + MensaFeed.xml + + + EventsFeed.xml + + + EventsFeed.xml + + + http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/ + + + OpeninghoursFeed.xml + + + http://www.tu-cottbus.de/campusapp-data/getdata.php?db=openinghours&app=2&appversion=1 + + + NewsFeed.xml + + + http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_veranstaltungen.php + + + http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icons.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Icons.Designer.cs index a50f46eb..76662380 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,11 +69,198 @@ typeof(Icons).Assembly); } /// - /// Returns the full filename of the icon, depending on the current theme. + /// Gets the uri string of the campus icon. /// - /// Tagname - /// Filename - private static string Themerize(string _key) + public static string Campus + { + get + { + return Themerize("Campus"); + } + } + + /// + /// Gets the uri string of the departments icon. + /// + public static string Departments + { + get + { + return Themerize("Departments"); + } + } + + /// + /// Gets the uri string of the homework icon. + /// + public static string Homework + { + get + { + return Themerize("Homework"); + } + } + + /// + /// Gets the uri string of the lectures icon. + /// + public static string Lectures + { + get + { + return Themerize("Lectures"); + } + } + + /// + /// Gets the uri string of the link icon. + /// + public static string Link + { + get + { + return Themerize("Link"); + } + } + + /// + /// Gets the uri string of the mensa icon. + /// + public static string Mensa + { + get + { + return Themerize("Mensa"); + } + } + + /// + /// Gets the uri string of the news icon. + /// + public static string News + { + get + { + return Themerize("News"); + } + } + + /// + /// Gets the uri string of the opening hours icon. + /// + public static string Openhours + { + get + { + return Themerize("Openhours"); + } + } + + /// + /// Gets the uri string of the schedule icon. + /// + public static string Schedule + { + get + { + return Themerize("Schedule"); + } + } + + /// + /// Gets the uri string of the search icon. + /// + public static string Search + { + get + { + return Themerize("Search"); + } + } + + /// + /// Gets the uri string of the student council icon. + /// + public static string StudentCouncil + { + get + { + return Themerize("StudentCouncil"); + } + } + + /// + /// Gets the uri string of the web mail icon. + /// + public static string WebMail + { + get + { + return Themerize("WebMail"); + } + } + + /// + /// 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 + { + get + { + 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; @@ -89,152 +273,9 @@ typeof(Icons).Assembly); retValue = "/Assets/Icons/LightTheme/"; } - retValue += ResourceManager.GetString(_key, resourceCulture); + retValue += ResourceManager.GetString(key, resourceCulture); return retValue; } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die campus_159.png ähnelt. - /// - public static string Campus - { - get - { - return Themerize("Campus"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die departments_159.png ähnelt. - /// - public static string Departments - { - get - { - return Themerize("Departments"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die homework_159.png ähnelt. - /// - public static string Homework - { - get - { - return Themerize("Homework"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die lectures_159.png ähnelt. - /// - public static string Lectures - { - get - { - return Themerize("Lectures"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die link_159.png ähnelt. - /// - public static string Link - { - get - { - return Themerize("Link"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die mensa_159.png ähnelt. - /// - public static string Mensa - { - get - { - return Themerize("Mensa"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die news_159.png ähnelt. - /// - public static string News - { - get - { - return Themerize("News"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die openhours_159.png ähnelt. - /// - public static string Openhours - { - get - { - return Themerize("Openhours"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die schedule_159.png ähnelt. - /// - public static string Schedule - { - get - { - return Themerize("Schedule"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die search_159.png ähnelt. - /// - public static string Search - { - get - { - return Themerize("Search"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die student_council_159.png ähnelt. - /// - public static string StudentCouncil - { - get - { - return Themerize("StudentCouncil"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die webmail_159.png ähnelt. - /// - public static string WebMail - { - get - { - return Themerize("WebMail"); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die phone_159.png ähnelt. - /// - public static string Phone - { - get - { - return Themerize("Phone"); - } - } } } diff --git a/CampusAppWP8/CampusAppWP8/Resources/Icons.resx b/CampusAppWP8/CampusAppWP8/Resources/Icons.resx index 919f1551..50b43833 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Icons.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Icons.resx @@ -1,159 +1,171 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - campus_159.png - - - departments_159.png - - - homework_159.png - - - lectures_159.png - - - link_159.png - - - mensa_159.png - - - news_159.png - - - openhours_159.png - - - phone_159.png - - - schedule_159.png - - - search_159.png - - - student_council_159.png - - - webmail_159.png - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 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 + + + link_159.png + + + mensa_159.png + + + news_159.png + + + openhours_159.png + + + phone_159.png + + + schedule_159.png + + + search_159.png + + + student_council_159.png + + + webmail_159.png + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Styles/ListButton.xaml b/CampusAppWP8/CampusAppWP8/Styles/ListButton.xaml new file mode 100644 index 00000000..959c2f6a --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Styles/ListButton.xaml @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Styles/StartPageStyles.xaml b/CampusAppWP8/CampusAppWP8/Styles/StartPageStyles.xaml new file mode 100644 index 00000000..058047c0 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Styles/StartPageStyles.xaml @@ -0,0 +1,28 @@ + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Api.cs b/CampusAppWP8/CampusAppWP8/Utility/Api.cs index a7ef98e5..a0178de8 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Api.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Api.cs @@ -139,6 +139,6 @@ namespace CampusAppWP8.Utility } #endregion -#endregion + #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/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/Logger.cs b/CampusAppWP8/CampusAppWP8/Utility/Logger.cs similarity index 100% rename from CampusAppWP8/CampusAppWP8/utility/Logger.cs rename to CampusAppWP8/CampusAppWP8/Utility/Logger.cs diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/EmailButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/EmailButton.cs new file mode 100644 index 00000000..e5be0944 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/EmailButton.cs @@ -0,0 +1,81 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 04.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Lui.Button +{ + using System; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Media.Imaging; + using CampusAppWP8.Resources; + using Microsoft.Phone.Tasks; + + /// + /// This class create an Button which start the Email-Client + /// + public class EmailButton : System.Windows.Controls.Button + { + #region Members + + /// + /// Register the EmailProperty + /// + public static readonly DependencyProperty EmailProperty = DependencyProperty.Register("EmailAddress", typeof(object), typeof(EmailButton), new PropertyMetadata(false)); + + /// + /// Icon of the Button + /// + private static BitmapImage icon = new BitmapImage(new Uri(Icons.WebMail, UriKind.Relative)); + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public EmailButton() + : base() + { + this.Content = new Image + { + Source = icon + }; + } + + #endregion + + #region Proberties + + /// + /// Gets or sets the EmailAddress + /// + public object EmailAddress + { + get { return (object)this.GetValue(EmailProperty); } + set { this.SetValue(EmailProperty, value); } + } + + #endregion + + #region Methods + + /// + /// Overrides the OnClick-Method from button + /// + /// + /// now method start the EmailComposeTask + /// + protected override void OnClick() + { + EmailComposeTask emailTask = new EmailComposeTask(); + emailTask.To = "mailto:" + this.EmailAddress.ToString(); + emailTask.Show(); + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/GoToMapButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/GoToMapButton.cs new file mode 100644 index 00000000..591148e0 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/GoToMapButton.cs @@ -0,0 +1,84 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Lui.Button +{ + using System; + using System.Device.Location; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Media.Imaging; + using CampusAppWP8.Resources; + using Microsoft.Phone.Tasks; + + /// + /// This class create an Button which open a Map + /// + public class GoToMapButton : System.Windows.Controls.Button + { + #region Members + + /// + /// Register the SearchTermProperty + /// + public static readonly DependencyProperty SearchTermProperty = DependencyProperty.Register("SearchTerm", typeof(object), typeof(GoToMapButton), new PropertyMetadata(false)); + + /// + /// Icon of the Button + /// + private static BitmapImage icon = new BitmapImage(new Uri(Icons.Campus, UriKind.Relative)); + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public GoToMapButton() + : base() + { + this.Content = new Image + { + Source = icon + }; + } + + #endregion + + #region Proberties + + /// + /// Gets or sets the Url + /// + public object SearchTerm + { + get { return (object)this.GetValue(SearchTermProperty); } + set { this.SetValue(SearchTermProperty, value); } + } + + #endregion + + #region Methods + + /// + /// Overrides the OnClick-Method from button + /// + /// + /// now method start the MapTask + /// + protected override void OnClick() + { + MapsTask mapsTask = new MapsTask(); + mapsTask.Center = new GeoCoordinate(51.766788, 14.326681); + mapsTask.SearchTerm = this.SearchTerm as string; + mapsTask.ZoomLevel = 15; + mapsTask.Show(); + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/LinkButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/LinkButton.cs new file mode 100644 index 00000000..e2adeeb2 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/LinkButton.cs @@ -0,0 +1,82 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Lui.Button +{ + using System; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Media.Imaging; + using CampusAppWP8.Resources; + using Microsoft.Phone.Tasks; + + /// + /// This class create an Button which start the WebBrowser, which an certain url + /// + public class LinkButton : System.Windows.Controls.Button + { + #region Members + + /// + /// Register the EmailProperty + /// + public static readonly DependencyProperty LinkProperty = DependencyProperty.Register("Url", typeof(object), typeof(LinkButton), new PropertyMetadata(false)); + + /// + /// Icon of the Button + /// + private static BitmapImage icon = new BitmapImage(new Uri(Icons.Link, UriKind.Relative)); + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public LinkButton() + : base() + { + this.Content = new Image + { + Source = icon + }; + } + + #endregion + + #region Proberties + + /// + /// Gets or sets the Url + /// + public object Url + { + get { return (object)this.GetValue(LinkProperty); } + set { this.SetValue(LinkProperty, value); } + } + + #endregion + + #region Methods + + /// + /// Overrides the OnClick-Method from button + /// + /// + /// now method start the WebBrowserTask + /// + protected override void OnClick() + { + Uri linkUrl = new Uri(this.Url as string, UriKind.Absolute); + WebBrowserTask webBrowserTask = new WebBrowserTask(); + webBrowserTask.Uri = linkUrl; + webBrowserTask.Show(); + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/NavigateButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/NavigateButton.cs new file mode 100644 index 00000000..2f0a02a5 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/NavigateButton.cs @@ -0,0 +1,104 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Lui.Button +{ + using System; + using System.Windows; + using System.Windows.Controls; + + /// + /// This class create an Button which navigate to a certain page + /// + public class NavigateButton : System.Windows.Controls.Button + { + #region Members + + /// + /// Register the UrlProperty + /// + public static readonly DependencyProperty NavigateProperty = DependencyProperty.Register("Url", typeof(object), typeof(NavigateButton), new PropertyMetadata(false)); + + /// + /// Register the QueryValueProperty + /// + public static readonly DependencyProperty QueryValueProperty = DependencyProperty.Register("QuerryStringValue", typeof(object), typeof(NavigateButton), new PropertyMetadata(false)); + + /// + /// Register the QueryNameProperty + /// + public static readonly DependencyProperty QueryNameProperty = DependencyProperty.Register("QuerryStringName", typeof(object), typeof(NavigateButton), new PropertyMetadata(false)); + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public NavigateButton() + : base() + { + } + + #endregion + + #region Proberties + + /// + /// Gets or sets the Url + /// + public object Url + { + get { return (object)this.GetValue(NavigateProperty); } + set { this.SetValue(NavigateProperty, value); } + } + + /// + /// Gets or sets the QueryStringName + /// + public object QuerryStringName + { + get { return (object)this.GetValue(QueryNameProperty); } + set { this.SetValue(QueryNameProperty, value); } + } + + /// + /// Gets or sets the QueryStringValue + /// + public object QuerryStringValue + { + get { return (object)this.GetValue(QueryValueProperty); } + set { this.SetValue(QueryValueProperty, value); } + } + + #endregion + + #region Methods + + /// + /// Overrides the OnClick-Method from button + /// + /// + /// now method navigate to a certain page + /// + protected override void OnClick() + { + string urlString = this.Url as string; + + if (this.QuerryStringName != null && this.QuerryStringValue != null) + { + urlString += "?" + this.QuerryStringName + "=" + this.QuerryStringValue; + } + + Uri url = new Uri(urlString as string, UriKind.Relative); + Page page = App.RootFrame.Content as Page; + page.NavigationService.Navigate(url); + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/PhoneButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/PhoneButton.cs new file mode 100644 index 00000000..a65f0a4e --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/PhoneButton.cs @@ -0,0 +1,96 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Lui.Button +{ + using System; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Media.Imaging; + using CampusAppWP8.Resources; + using Microsoft.Phone.Tasks; + + /// + /// This class create an Button which start a PhoneCall + /// + public class PhoneButton : System.Windows.Controls.Button + { + #region Members + + /// + /// Register the PhoneProperty + /// + public static readonly DependencyProperty PhoneProperty = DependencyProperty.Register("Number", typeof(object), typeof(PhoneButton), new PropertyMetadata(false)); + + /// + /// Register the DisplayNameProperty + /// + public static readonly DependencyProperty DisplayNameProperty = DependencyProperty.Register("DisplayName", typeof(object), typeof(PhoneButton), new PropertyMetadata(false)); + + /// + /// Icon of the Button + /// + private static BitmapImage icon = new BitmapImage(new Uri(Icons.Phone, UriKind.Relative)); + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public PhoneButton() + : base() + { + this.Content = new Image + { + Source = icon + }; + } + + #endregion + + #region Proberties + + /// + /// Gets or sets the PhoneNumber + /// + public object Number + { + get { return (object)this.GetValue(PhoneProperty); } + set { this.SetValue(PhoneProperty, value); } + } + + /// + /// Gets or sets the DisplayName + /// + public object DisplayName + { + get { return (object)this.GetValue(DisplayNameProperty); } + set { this.SetValue(DisplayNameProperty, value); } + } + + #endregion + + #region Methods + + /// + /// Overrides the OnClick-Method from button + /// + /// + /// now method start the PhoneTask + /// + protected override void OnClick() + { + PhoneCallTask phoneCallTask = new PhoneCallTask(); + phoneCallTask.PhoneNumber = this.Number as string; + phoneCallTask.DisplayName = this.DisplayName as string; + phoneCallTask.Show(); + } + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToggleButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToggleButton.cs new file mode 100644 index 00000000..b59f43ad --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/ToggleButton.cs @@ -0,0 +1,257 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Lui.Button +{ + using System.Collections.Generic; + using System.Windows; + using System.Windows.Controls; + + /// + /// This class create an Button which can toggle the Visibility of certain FrameworkElements + /// + public class ToggleButton : System.Windows.Controls.Button + { + #region Members + + #region public + /// + /// Register the ToggleContentTag + /// + public static readonly DependencyProperty ToggleContentTagProperty = DependencyProperty.Register("ToggleContentTag", typeof(object), typeof(ToggleButton), new PropertyMetadata(false)); + + #endregion + #region private + + /// + /// List of FrameworkElement which can change their Visibility by this button + /// + private List toggleElements = null; + + /// + /// EventHandler of the ToggleButton + /// + private ToggleButtonHandler eventHandler; + + #endregion + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public ToggleButton() + : base() + { + } + + #endregion + + #region Events + + /// + /// Delegate for the ToggleButton events + /// + private delegate void ToggleButtonHandler(); + + /// + /// The closeButtonEvent + /// + private static event ToggleButtonHandler CloseButtonEvent; + #endregion + + #region Proberties + + /// + /// Gets or sets the ToggleContentTag + /// + public object ToggleContentTag + { + get { return (object)this.GetValue(ToggleContentTagProperty); } + set { this.SetValue(ToggleContentTagProperty, value); } + } + + #endregion + + #region Methods + + #region public + + /// + /// Method close the ToggleContent of the old ToggleContent and then show the new one + /// + public void ToggleToggleContent() + { + if (this.toggleElements != null) + { + // close the old (other) Button + if (CloseButtonEvent != null && !CloseButtonEvent.Equals(this.eventHandler)) + { + CloseButtonEvent(); + } + + foreach (UIElement elment in this.toggleElements) + { + this.ToggleToggleContentElement(elment); + } + } + } + + /// + /// Method show all Element of the ToggleContent + /// + public void ShowToggleContent() + { + if (this.toggleElements != null) + { + foreach (UIElement elment in this.toggleElements) + { + this.ShowToggleContentElement(elment); + } + } + } + + /// + /// Method show all Element of the ToggleContent + /// + public void HideToggleContent() + { + if (this.toggleElements != null) + { + foreach (UIElement elment in this.toggleElements) + { + this.HideToggleContentElement(elment); + } + } + } + #endregion + + #region protected + + /// + /// Overrides the OnClick-Method from button + /// + /// + /// now method toggle the visibility of some FrameWorkElements + /// + protected override void OnClick() + { + if (this.toggleElements == null) + { + this.SetupToggleElements(); + } + + this.ToggleToggleContent(); + } + + #endregion + + #region private + + /// + /// Method look for some ToggleContent + /// + private void SetupToggleElements() + { + this.toggleElements = new List(); + Panel parent = this.Parent as Panel; + if (parent == null) + { + parent = this.GetFirstParentPanel(); + } + + foreach (FrameworkElement element in parent.Children) + { + string elementTag = element.Tag as string; + if (elementTag != null && elementTag.Contains(this.ToggleContentTag as string)) + { + this.toggleElements.Add(element); + break; + } + } + } + + /// + /// Gets the first panel, which is a parent of this button + /// + /// first panel of the parents + private Panel GetFirstParentPanel() + { + FrameworkElement parentElement = this.Parent as FrameworkElement; + Panel parentPanel = parentElement as Panel; + while (parentPanel == null) + { + parentElement = parentElement.Parent as FrameworkElement; + if (parentElement == null) + { + break; + } + + parentPanel = parentElement as Panel; + } + + return parentPanel; + } + + /// + /// Method toggle the visibility of a certain element + /// + /// element of the ToggleContent + private void ToggleToggleContentElement(UIElement element) + { + if (element != null) + { + if (Visibility.Collapsed.Equals(element.Visibility)) + { + this.ShowToggleContentElement(element); + } + else + { + this.HideToggleContentElement(element); + } + } + } + + /// + /// Method show the visibility of a certain element + /// + /// element of the ToggleContent + private void ShowToggleContentElement(UIElement element) + { + if (element != null) + { + element.Visibility = Visibility.Visible; + if (this.eventHandler == null) + { + this.eventHandler = new ToggleButtonHandler(this.HideToggleContent); + CloseButtonEvent += this.eventHandler; + } + } + } + + /// + /// Method hide the visibility of a certain element + /// + /// element of the ToggleContent + private void HideToggleContentElement(UIElement element) + { + if (element != null) + { + element.Visibility = Visibility.Collapsed; + if (this.eventHandler != null) + { + CloseButtonEvent -= this.eventHandler; + this.eventHandler = null; + } + } + } + #endregion + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs new file mode 100644 index 00000000..2c700413 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// fiedlchr +// 16.07.2013 +//----------------------------------------------------------------------------- +namespace CampusAppWP8.Utility +{ + using System; + + public static class Utilities + { + public enum DifferenceType + { + Equal, + Less, + LessEqual, + Greater, + GreaterEqual + }; + + + public static bool DayDifference(DifferenceType type, DateTime date, double totalDiff) + { + bool retValue = false; + + TimeSpan diff = DateTime.Now.Subtract(date); + + if ((DifferenceType.Less == type) || (DifferenceType.LessEqual == type)) + { + if (diff.TotalDays < totalDiff) + { + retValue = true; + } + } + + if ((DifferenceType.Greater == type) || (DifferenceType.GreaterEqual == type)) + { + if (diff.TotalDays > totalDiff) + { + retValue = true; + } + } + + if ((DifferenceType.Equal == type) || (DifferenceType.LessEqual == type) || (DifferenceType.GreaterEqual == type)) + { + if (diff.TotalDays == totalDiff) + { + retValue = true; + } + } + + return retValue; + } + } +} \ No newline at end of file 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/BaseModel.cs b/CampusAppWP8/CampusAppWP8/model/BaseModel.cs deleted file mode 100644 index 28b41b3d..00000000 --- a/CampusAppWP8/CampusAppWP8/model/BaseModel.cs +++ /dev/null @@ -1,39 +0,0 @@ -//----------------------------------------------------------------------- -// -// Company copyright tag. -// -// stubbfel -// 03.05.2013 -//---------------------------------------------------------------------- -namespace CampusAppWP8.Model -{ - using System; - using System.ComponentModel; - - /// - /// This Class provide a basic model - /// - /// - /// not necessary, maybe delete => deprecated - /// - public class BaseModel : INotifyPropertyChanged - { - /// - /// The PropertyChangedEvent - /// - public event PropertyChangedEventHandler PropertyChanged; - - /// - /// Method fire PropertyChangedEvents - /// - /// name of the property - public void NotifyPropertyChanged(string propertyName) - { - PropertyChangedEventHandler handler = this.PropertyChanged; - if (null != handler) - { - handler(this, new PropertyChangedEventArgs(propertyName)); - } - } - } -} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/model/BaseViewModel.cs b/CampusAppWP8/CampusAppWP8/model/BaseViewModel.cs deleted file mode 100644 index ab34dd78..00000000 --- a/CampusAppWP8/CampusAppWP8/model/BaseViewModel.cs +++ /dev/null @@ -1,39 +0,0 @@ -//----------------------------------------------------------------------- -// -// Company copyright tag. -// -// stubbfel -// 03.05.2013 -//---------------------------------------------------------------------- -namespace CampusAppWP8.Model -{ - using System; - using System.ComponentModel; - - /// - /// This Class provide a basic ViewModel - /// - /// - /// not necessary, maybe delete => deprecated - /// - public class BaseViewModel : INotifyPropertyChanged - { - /// - /// The PropertyChangedEvent - /// - public event PropertyChangedEventHandler PropertyChanged; - - /// - /// Method fire PropertyChangedEvents - /// - /// name of the property - public void NotifyPropertyChanged(string propertyName) - { - PropertyChangedEventHandler handler = this.PropertyChanged; - if (null != handler) - { - handler(this, new PropertyChangedEventArgs(propertyName)); - } - } - } -} diff --git a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml deleted file mode 100644 index 91009353..00000000 --- a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs deleted file mode 100644 index f9f673f2..00000000 --- a/CampusAppWP8/CampusAppWP8/pages/StartPage.xaml.cs +++ /dev/null @@ -1,134 +0,0 @@ -//----------------------------------------------------------------------- -// -// Company copyright tag. -// -// stubbfel -// 21.05.2013 -//---------------------------------------------------------------------- -namespace CampusAppWP8.Pages -{ - using System; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Navigation; - using CampusAppWP8.Resources; - using Microsoft.Phone.Controls; - - /// - /// Class for the StartPage - /// - public partial class StartPage : PhoneApplicationPage - { - /// - /// Initializes a new instance of the class. - /// - public StartPage() - { - this.InitializeComponent(); - - // if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible) - // this.SetIconThemeToDark(); - } - - /// - /// Method handle OrientationPage - /// - /// Caller of the function - /// some EventArgs - private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) - { - // Switch the placement of the buttons based on an orientation change. - if (this.Orientation == PageOrientation.LandscapeLeft || this.Orientation == PageOrientation.LandscapeRight) - { - OpenHoursAppButton.SetValue(Grid.RowProperty, 0); - OpenHoursAppButton.SetValue(Grid.ColumnProperty, 3); - - OSAAppButton.SetValue(Grid.RowProperty, 1); - OSAAppButton.SetValue(Grid.ColumnProperty, 3); - - LinkAppButton.SetValue(Grid.RowProperty, 2); - LinkAppButton.SetValue(Grid.ColumnProperty, 3); - ContentPanel.Margin = new Thickness(12, -24, 0, 0); - } - else - { - // If not in portrait, move buttonList content to visible row and column. - OpenHoursAppButton.SetValue(Grid.RowProperty, 3); - OpenHoursAppButton.SetValue(Grid.ColumnProperty, 0); - - OSAAppButton.SetValue(Grid.RowProperty, 3); - OSAAppButton.SetValue(Grid.ColumnProperty, 1); - - LinkAppButton.SetValue(Grid.RowProperty, 3); - LinkAppButton.SetValue(Grid.ColumnProperty, 2); - ContentPanel.Margin = new Thickness(12, 0, 0, 0); - } - } - - /// - /// start the LectureApp - /// - /// Caller of the function - /// some EventArgs - private void OpenLectureApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathLecture_LecturePage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// start the NewsApp - /// - /// Caller of the function - /// some EventArgs - private void OpenNewsApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathNews_NewsIndexPage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// start the EventsApp - /// - /// Caller of the function - /// some EventArgs - private void OpenEventsApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathEvents_EventsIndexPage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// start the MensaApp - /// - /// Caller of the function - /// some EventArgs - private void OpenMensaApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathMensa_MensaPage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// start the WebmailApp - /// - /// Caller of the function - /// some EventArgs - private void OpenWebMailApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathMail_WebMailPage, UriKind.Relative); - NavigationService.Navigate(url); - } - - /// - /// Opens the opening hours page. - /// - /// opening hours button - /// event args - private void OpenOpeninghoursApp(object sender, RoutedEventArgs e) - { - Uri url = new Uri(Constants.PathOpeninghours_OpeninghoursPage, UriKind.Relative); - NavigationService.Navigate(url); - } - } -} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/pages/news/RSSItem.cs b/CampusAppWP8/CampusAppWP8/pages/news/RSSItem.cs deleted file mode 100644 index 9688e392..00000000 --- a/CampusAppWP8/CampusAppWP8/pages/news/RSSItem.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CampusAppWP8.Pages.news -{ - class RSSItem - { - private string title; - private string text; - private DateTime timestamp; - - public string Title - { - get { return this.title; } - set { this.title = value; } - } - - public string Text - { - get { return this.text; } - set { this.text = HTMLUnicodeToString(value); } - } - - public string Timestamp - { - get { return this.timestamp.ToString("R"); } - set { this.timestamp = DateTime.Parse(value); } - } - - public string Date - { - get { return String.Format("{0:ddd, dd.MM.yyyy}", this.timestamp); } - } - - public string Time - { - get { return String.Format("{0:h:mm} Uhr", this.timestamp); } - } - - private string HTMLUnicodeToString(string htmluni) - { - StringBuilder retValue = new StringBuilder(); - - for(int i = 0; i < htmluni.Length; i++) - { - switch (htmluni[i]) - { - case '&': - { - int startOff = i + 2; - int endOff = htmluni.IndexOf(';', startOff); - string sub = htmluni.Substring(startOff, endOff - startOff); - int cVal = int.Parse(sub); - - switch (cVal) - { - case 128: - retValue.Append('€'); - break; - - default: - retValue.Append((char)cVal); - break; - } - - i = endOff; - } - break; - case '<': - { - i = htmluni.IndexOf('>', i); - } - break; - case '\t': - break; - - default: - { - retValue.Append(htmluni[i]); - } - break; - } - } - - return retValue.ToString(); - } - } -} diff --git a/CampusAppWP8/CampusAppWP8/pages/news/RSSNewsTemplate.xaml b/CampusAppWP8/CampusAppWP8/pages/news/RSSNewsTemplate.xaml deleted file mode 100644 index 7ed4c242..00000000 --- a/CampusAppWP8/CampusAppWP8/pages/news/RSSNewsTemplate.xaml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - -