Compare commits
186 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a309ad980 | ||
|
|
c301f908ad | ||
|
|
6ce158dc41 | ||
|
|
e8fe0bb041 | ||
|
|
b337eefc8c | ||
|
|
70d92c7a3b | ||
|
|
363baad60c | ||
|
|
2606e089df | ||
|
|
a99ff5526c | ||
|
|
64fc09f622 | ||
|
|
a9a96b6ffc | ||
|
|
f79cd5836e | ||
|
|
d414e4df47 | ||
|
|
4652b82885 | ||
|
|
7637b62271 | ||
|
|
55e426f6c2 | ||
|
|
2eea814558 | ||
|
|
121c728df7 | ||
|
|
9a84f847d1 | ||
|
|
fa7a84661e | ||
|
|
75b6b4501f | ||
|
|
a3014d04c8 | ||
|
|
bcceaaaa53 | ||
|
|
6f5496a006 | ||
|
|
a366d0e949 | ||
|
|
88320657e9 | ||
|
|
1136e29034 | ||
|
|
759f0a8859 | ||
|
|
bf9a612de5 | ||
|
|
00fb9ca637 | ||
|
|
49151c0714 | ||
|
|
5eedf70604 | ||
|
|
c2871bb3d1 | ||
|
|
9abb7de1ec | ||
|
|
854dc8b46e | ||
|
|
96cd4bccb4 | ||
|
|
6338caea9c | ||
|
|
3874f2ef06 | ||
|
|
c12c76c5ae | ||
|
|
a3c8f3b9fc | ||
|
|
dadcc2e965 | ||
|
|
175b871005 | ||
|
|
af57bad869 | ||
|
|
932842aebb | ||
|
|
125587f99c | ||
|
|
1b52f87950 | ||
|
|
6b8ec1e8b0 | ||
|
|
5788889ae7 | ||
|
|
6b5341d1ac | ||
|
|
900cb9111a | ||
|
|
0df8f72c53 | ||
|
|
970c6ce8e8 | ||
|
|
9662be5632 | ||
|
|
6a69aec6eb | ||
|
|
dd7ef6e82e | ||
|
|
3e3b082463 | ||
|
|
4a5253c25c | ||
|
|
a375fe9008 | ||
|
|
1d434a394f | ||
|
|
5aee5e266a | ||
|
|
666b6c9730 | ||
|
|
59503f2d23 | ||
|
|
43cfeea2d7 | ||
|
|
d17b4b7e33 | ||
|
|
b78250401c | ||
|
|
d167dbfb9e | ||
|
|
0072df1186 | ||
|
|
218353393e | ||
|
|
de91ac2d76 | ||
|
|
74224a4fc5 | ||
|
|
0ceb0584d1 | ||
|
|
88b664284f | ||
|
|
92614e7128 | ||
|
|
9eff5be228 | ||
|
|
9ebeaa8147 | ||
|
|
b9f268d594 | ||
|
|
7978e27049 | ||
|
|
be65f4056b | ||
|
|
73a186cf28 | ||
|
|
7a7c478277 | ||
|
|
c886b3e573 | ||
|
|
98a51bce24 | ||
|
|
a7769184d5 | ||
|
|
40145c727e | ||
|
|
6ead6414e6 | ||
|
|
03789a9a38 | ||
|
|
92db7d16f3 | ||
|
|
9454a764d6 | ||
|
|
a433d47583 | ||
|
|
486058687d | ||
|
|
ce3c953b64 | ||
|
|
e2ee1aad9f | ||
|
|
281cd06bab | ||
|
|
d71f6db920 | ||
|
|
eb68b666f7 | ||
|
|
8a69101cbf | ||
|
|
d9a54b2b13 | ||
|
|
92d580f270 | ||
|
|
8b4ee44520 | ||
|
|
9c0415ddbb | ||
|
|
52a3154caf | ||
|
|
18f72e6096 | ||
|
|
82625f7aa4 | ||
|
|
0b82c3b18a | ||
|
|
3616bd233f | ||
|
|
573a562e03 | ||
|
|
25d6217a9b | ||
|
|
5fbd297af5 | ||
|
|
f1e41b1fce | ||
|
|
c0692dfca9 | ||
|
|
cf4c5dc486 | ||
|
|
707e7c0761 | ||
|
|
347e45f561 | ||
|
|
4395f4f6cd | ||
|
|
182b50eca2 | ||
|
|
544ae68f2c | ||
|
|
db15808e24 | ||
|
|
7e99840b6c | ||
|
|
0f82e4512d | ||
|
|
19e18a4daa | ||
|
|
2a24c01854 | ||
|
|
2ef3d053b1 | ||
|
|
c0a880e771 | ||
|
|
46cedaeeb4 | ||
|
|
bda60de4f5 | ||
|
|
e70a6d36f1 | ||
|
|
80d008a431 | ||
|
|
175765a3c0 | ||
|
|
5a709e7445 | ||
|
|
a2eeb54c55 | ||
|
|
511e6640ba | ||
|
|
505b19e57d | ||
|
|
5d2614d59b | ||
|
|
5c8756ac21 | ||
|
|
10018077fc | ||
|
|
ca13f3f581 | ||
|
|
6f1eae3ca8 | ||
|
|
8774683a80 | ||
|
|
8335c47b0f | ||
|
|
ceeaabac1c | ||
|
|
e1abe121bf | ||
|
|
ed891074e0 | ||
|
|
6dc522b6a8 | ||
|
|
b54be92e3c | ||
|
|
12acceff32 | ||
|
|
9e31f121ba | ||
|
|
a06133b173 | ||
|
|
4fa7c9d9dd | ||
|
|
e46a7a22e1 | ||
|
|
7396edc095 | ||
|
|
b6b003315f | ||
|
|
e1ea814861 | ||
|
|
579217ec1c | ||
|
|
2f247e29b4 | ||
|
|
3003508139 | ||
|
|
cb242fc2fd | ||
|
|
4f10725531 | ||
|
|
c3a572c6f6 | ||
|
|
e60bfae1a8 | ||
|
|
731e3305b9 | ||
|
|
bc77d076c9 | ||
|
|
b3ef2ab81f | ||
|
|
ea54e23d56 | ||
|
|
0f64e15c3f | ||
|
|
476a626de4 | ||
|
|
2b4b980883 | ||
|
|
086317fef5 | ||
|
|
3755348854 | ||
|
|
cc4cfd9afd | ||
|
|
7053571f6c | ||
|
|
170067df02 | ||
|
|
38becf5ae6 | ||
|
|
0e90a7a03c | ||
|
|
7e65f09ca8 | ||
|
|
7056650095 | ||
|
|
5e5074a534 | ||
|
|
f5ef147baa | ||
|
|
c9b3553d2a | ||
|
|
f8280d1ce1 | ||
|
|
448cfd5118 | ||
|
|
655b4c0638 | ||
|
|
ff39d78658 | ||
|
|
d8071e76eb | ||
|
|
2e883b1e98 | ||
|
|
5a55355f98 | ||
|
|
cfb7b74610 |
64
.gitattributes
vendored
Normal file
@@ -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
|
||||
194
.gitignore
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
## 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/
|
||||
CampusAppWP8/packages/WPtoolkit.4.2012.10.30/lib/sl3-wp/Microsoft.Phone.Controls.Toolkit.dll
|
||||
CampusAppWP8/packages/WPtoolkit.4.2012.10.30/lib/sl4-windowsphone71/Microsoft.Phone.Controls.Toolkit.dll
|
||||
CampusAppWP8/packages/WPtoolkit.4.2012.10.30/lib/wp8/Microsoft.Phone.Controls.Toolkit.dll
|
||||
CampusAppWP8/packages/BuiltToRoam.Core.Agent.1.0.1.5/BuiltToRoam.Core.Agent.1.0.1.5.nupkg
|
||||
CampusAppWP8/packages/BuiltToRoam.Core.Agent.1.0.1.5/BuiltToRoam.Core.Agent.1.0.1.5.nuspec
|
||||
CampusAppWP8/packages/BuiltToRoam.Core.Agent.1.0.1.5/lib/sl4-wp71/AsyncCtpLibrary_Phone.dll
|
||||
CampusAppWP8/packages/BuiltToRoam.Core.Agent.1.0.1.5/lib/sl4-wp71/BuiltToRoam.Core.Agent.dll
|
||||
CampusAppWP8/packages/BuiltToRoam.GeoWatcher.1.0.1.5/BuiltToRoam.GeoWatcher.1.0.1.5.nupkg
|
||||
CampusAppWP8/packages/BuiltToRoam.GeoWatcher.1.0.1.5/BuiltToRoam.GeoWatcher.1.0.1.5.nuspec
|
||||
CampusAppWP8/packages/BuiltToRoam.GeoWatcher.1.0.1.5/lib/sl4-wp71/BuiltToRoam.GeoWatcher.dll
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nupkg
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nuspec
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net20/Newtonsoft.Json.dll
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net20/Newtonsoft.Json.xml
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net35/Newtonsoft.Json.dll
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net35/Newtonsoft.Json.xml
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.xml
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.xml
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl3-wp/Newtonsoft.Json.dll
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl3-wp/Newtonsoft.Json.xml
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl4-windowsphone71/Newtonsoft.Json.dll
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl4-windowsphone71/Newtonsoft.Json.xml
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl4/Newtonsoft.Json.dll
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl4/Newtonsoft.Json.xml
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/winrt45/Newtonsoft.Json.dll
|
||||
CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/winrt45/Newtonsoft.Json.xml
|
||||
CampusAppWP8/packages/SharpZipLib-WP7.0.86.0.518/SharpZipLib-WP7.0.86.0.518.nupkg
|
||||
CampusAppWP8/packages/SharpZipLib-WP7.0.86.0.518/SharpZipLib-WP7.0.86.0.518.nuspec
|
||||
CampusAppWP8/packages/SharpZipLib-WP7.0.86.0.518/lib/sl4-windowsphone71/SharpZipLib.WindowsPhone7.dll
|
||||
27
CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="SpsApi.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>06.08.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.GeoApi
|
||||
{
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.GeoDb;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Class for SPSAPI
|
||||
/// </summary>
|
||||
public class SpsApi : XmlModel<SpsModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SpsApi" /> class.
|
||||
/// </summary>
|
||||
public SpsApi()
|
||||
: base(ModelType.Feed, Constants.UrlSpsService)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,11 @@
|
||||
// <author>stubbfel</author>
|
||||
// <sience>13.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Api.Lecture
|
||||
namespace CampusAppWP8.Feed.Lecture
|
||||
{
|
||||
using System;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Lecture;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the feed of the Lecture
|
||||
@@ -18,13 +17,13 @@ namespace CampusAppWP8.Api.Lecture
|
||||
/// <remarks>
|
||||
/// need the XmlAPI
|
||||
/// </remarks>
|
||||
public class LectureApi : XmlApi<LectureList>
|
||||
public class LectureApi : XmlModel<LectureList>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LectureApi" /> class.
|
||||
/// </summary>
|
||||
public LectureApi()
|
||||
: base(new Uri(Constants.UrlLecture_ApiBaseAddr))
|
||||
: base(ModelType.Feed, Constants.UrlLecture_ApiBaseAddr)
|
||||
{
|
||||
this.ValidRootName = Constants.LectureXmlValidRootName;
|
||||
}
|
||||
|
||||
@@ -8,13 +8,22 @@
|
||||
|
||||
<!--Anwendungsressourcen-->
|
||||
<Application.Resources>
|
||||
<local:LocalizedStrings xmlns:local="clr-namespace:CampusAppWP8" x:Key="LocalizedStrings"/>
|
||||
<local:ThemelizedIcons xmlns:local="clr-namespace:CampusAppWP8" x:Key="ThemelizedIcons"/>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Styles/ListButton.xaml"/>
|
||||
<ResourceDictionary Source="Styles/StartPageStyles.xaml"/>
|
||||
<ResourceDictionary>
|
||||
<local:LocalizedStrings xmlns:local="clr-namespace:CampusAppWP8" x:Key="LocalizedStrings"/>
|
||||
<local:ThemelizedIcons xmlns:local="clr-namespace:CampusAppWP8" x:Key="ThemelizedIcons"/>
|
||||
<local:Const xmlns:local="clr-namespace:CampusAppWP8" x:Key="Const"/>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
<Application.ApplicationLifetimeObjects>
|
||||
<!--Erforderliches Objekt, das Lebensdauerereignisse der Anwendung behandelt-->
|
||||
<shell:PhoneApplicationService
|
||||
<shell:PhoneApplicationService
|
||||
Launching="Application_Launching" Closing="Application_Closing"
|
||||
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
|
||||
</Application.ApplicationLifetimeObjects>
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
using System;
|
||||
using CampusAppWP8.File.Setting;
|
||||
using CampusAppWP8.Model.Setting;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Resources;
|
||||
using System.Globalization;
|
||||
using System.IO.IsolatedStorage;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using CampusAppWP8.Resources;
|
||||
using System.IO.IsolatedStorage;
|
||||
using Windows.Devices.Geolocation;
|
||||
|
||||
|
||||
namespace CampusAppWP8
|
||||
@@ -84,10 +89,11 @@ namespace CampusAppWP8
|
||||
public static T LoadFromIsolatedStorage<T>(string key)
|
||||
{
|
||||
IsolatedStorageSettings isolatedStore = IsolatedStorageSettings.ApplicationSettings;
|
||||
|
||||
if(isolatedStore.Contains(key)) {
|
||||
|
||||
if (isolatedStore.Contains(key))
|
||||
{
|
||||
object value = isolatedStore[key];
|
||||
return (T)value;
|
||||
return (T)value;
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
@@ -124,17 +130,52 @@ namespace CampusAppWP8
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
// Code, der beim Starten der Anwendung ausgeführt werden soll (z. B. über "Start")
|
||||
// Dieser Code wird beim Reaktivieren der Anwendung nicht ausgeführt
|
||||
private void Application_Launching(object sender, LaunchingEventArgs e)
|
||||
{
|
||||
this.LoadSettings();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the appsettings from the store
|
||||
/// </summary>
|
||||
private void LoadSettings()
|
||||
{
|
||||
UserProfilFile userFile;
|
||||
userFile = Settings.UserProfil;
|
||||
if (userFile.Model == null)
|
||||
{
|
||||
userFile.onLoaded += new UserProfilFile.OnLoaded(this.UserSettingsLoaded);
|
||||
userFile.LoadData();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.UserSettingsLoaded();
|
||||
}
|
||||
|
||||
Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPosition));
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the usersettings from the store
|
||||
/// </summary>
|
||||
private void UserSettingsLoaded()
|
||||
{
|
||||
if (Settings.UserProfil.Model == null)
|
||||
{
|
||||
Settings.UserProfil.Model = new UserProfilModel();
|
||||
}
|
||||
}
|
||||
|
||||
// Code, der ausgeführt werden soll, wenn die Anwendung aktiviert wird (in den Vordergrund gebracht wird)
|
||||
// Dieser Code wird beim ersten Starten der Anwendung nicht ausgeführt
|
||||
private void Application_Activated(object sender, ActivatedEventArgs e)
|
||||
{
|
||||
|
||||
this.LoadSettings();
|
||||
|
||||
}
|
||||
|
||||
// Code, der ausgeführt werden soll, wenn die Anwendung deaktiviert wird (in den Hintergrund gebracht wird)
|
||||
|
||||
BIN
CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/add_159.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/btulogo_159.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/delete_159.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Icons/DarkTheme/info_159.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/add_159.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/delete_159.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Icons/LightTheme/info_159.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Tiles/kachel_large.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Tiles/kachel_medium.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Tiles/kachel_small.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/update_159.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/update_159.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
@@ -93,19 +93,42 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Api\GeoApi\SpsApi.cs" />
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Feed\Departments\DepartmentFavoriteFeed.cs" />
|
||||
<Compile Include="Const.cs" />
|
||||
<Compile Include="File\Setting\UserProfilFile.cs" />
|
||||
<Compile Include="Model\GeoDb\PlaceModel.cs" />
|
||||
<Compile Include="Model\GeoDb\SpsModel.cs" />
|
||||
<Compile Include="Model\Mensa\MealModel.cs" />
|
||||
<Compile Include="Model\Setting\AppSettings.cs" />
|
||||
<Compile Include="Model\Setting\UserProfilModel.cs" />
|
||||
<Compile Include="Model\Utility\CourseListPickerItemListModel.cs" />
|
||||
<Compile Include="Model\Utility\DegreeListPickerItemListModel.cs" />
|
||||
<Compile Include="Model\Utility\CleanUrlParamModel.cs" />
|
||||
<Compile Include="Model\Utility\RoleListPickerItemListModel.cs" />
|
||||
<Compile Include="Model\Utility\SemesterListPickerItemListModel.cs" />
|
||||
<Compile Include="Model\Utility\ListPickerItemListModel.cs" />
|
||||
<Compile Include="Pages\Setting\UserProfil.xaml.cs">
|
||||
<DependentUpon>UserProfil.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Resources\Icons.Designer.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="Utility\Lui\Button\EmailButton.cs" />
|
||||
<Compile Include="Feed\Link\CommonLinkFeed.cs" />
|
||||
<Compile Include="Feed\Link\ClubLinkFeed.cs" />
|
||||
<Compile Include="Feed\Openinghours\OpeninghoursFeed.cs" />
|
||||
<Compile Include="Feed\StudentCouncil\StudentCouncilFeed.cs" />
|
||||
<Compile Include="LocalizedStrings.cs" />
|
||||
<Compile Include="Model\Campusmap\MapModel.cs" />
|
||||
<Compile Include="Model\Campusmap\MapPinModel.cs" />
|
||||
<Compile Include="Model\Departments\ChairModel.cs" />
|
||||
<Compile Include="Model\Departments\DepartmentModel.cs" />
|
||||
<Compile Include="Model\Departments\DepartmentViewModel.cs" />
|
||||
<Compile Include="Model\Departments\FacultyModel.cs" />
|
||||
<Compile Include="Model\Events\RSSChannelModel.cs" />
|
||||
<Compile Include="Model\Events\RSSViewModel.cs" />
|
||||
<Compile Include="Model\RSS\RSSChannelModel.cs" />
|
||||
<Compile Include="Model\RSS\RSSViewModel.cs" />
|
||||
<Compile Include="Model\Lecture\LectureActivity.cs" />
|
||||
<Compile Include="Model\Lecture\LectureCourse.cs" />
|
||||
<Compile Include="Model\Lecture\LectureDate.cs" />
|
||||
@@ -113,16 +136,31 @@
|
||||
<Compile Include="Model\Lecture\LectureList.cs" />
|
||||
<Compile Include="Model\Lecture\LectureModule.cs" />
|
||||
<Compile Include="Model\Lecture\LecturePageModel.cs" />
|
||||
<Compile Include="Model\MainModel.cs" />
|
||||
<Compile Include="Model\Link\LinkModel.cs" />
|
||||
<Compile Include="Model\Link\LinkListModel.cs" />
|
||||
<Compile Include="Model\Mensa\MenuModel.cs" />
|
||||
<Compile Include="Model\Mensa\MenuWeekModel.cs" />
|
||||
<Compile Include="Model\Openinghours\OpeninghoursInstitutionModel.cs" />
|
||||
<Compile Include="Model\Openinghours\OpeninghoursModel.cs" />
|
||||
<Compile Include="Model\StudentCouncil\StudentCouncilListModel.cs" />
|
||||
<Compile Include="Model\StudentCouncil\StudentCouncilModel.cs" />
|
||||
<Compile Include="Model\Utility\UrlParamModel.cs" />
|
||||
<Compile Include="Model\XmlModel.cs" />
|
||||
<Compile Include="Pages\Campusmap\CampusMapPage.xaml.cs">
|
||||
<DependentUpon>CampusMapPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Api\Lecture\LectureApi.cs" />
|
||||
<Compile Include="Feed\Departments\DepartmentFeed.cs" />
|
||||
<Compile Include="Pages\Departments\DepartmentFavoritePage.xaml.cs">
|
||||
<DependentUpon>DepartmentFavoritePage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Departments\DepartmentIndexPage.xaml.cs">
|
||||
<DependentUpon>DepartmentIndexPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Departments\DepartmentInfoPage.xaml.cs">
|
||||
<DependentUpon>DepartmentInfoPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Departments\DepartmentPage.xaml.cs">
|
||||
<DependentUpon>DepartmentPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -133,11 +171,9 @@
|
||||
<Compile Include="Pages\Events\EventPage.xaml.cs">
|
||||
<DependentUpon>EventPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pages\lecture\LecturePage.xaml.cs">
|
||||
<Compile Include="Pages\Lecture\LecturePage.xaml.cs">
|
||||
<DependentUpon>LecturePage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\BaseModel.cs" />
|
||||
<Compile Include="Model\BaseViewModel.cs" />
|
||||
<Compile Include="Feed\Mensa\MensaFeed.cs" />
|
||||
<Compile Include="Pages\Lecture\ModulWebPage.xaml.cs">
|
||||
<DependentUpon>ModulWebPage.xaml</DependentUpon>
|
||||
@@ -149,6 +185,9 @@
|
||||
<Compile Include="Pages\Lecture\ResultPage.xaml.cs">
|
||||
<DependentUpon>ResultPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Links\LinkPage.xaml.cs">
|
||||
<DependentUpon>LinkPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Mensa\MensaPage.xaml.cs">
|
||||
<DependentUpon>MensaPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -159,13 +198,16 @@
|
||||
<Compile Include="Pages\News\NewsPage.xaml.cs">
|
||||
<DependentUpon>NewsPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\Events\RSSModel.cs" />
|
||||
<Compile Include="Model\RSS\RSSModel.cs" />
|
||||
<Compile Include="Pages\Openinghours\OpeninghoursPage.xaml.cs">
|
||||
<DependentUpon>OpeninghoursPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pages\StartPage.xaml.cs">
|
||||
<Compile Include="Pages\StartPage.xaml.cs">
|
||||
<DependentUpon>StartPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\StudentCouncil\StudentCouncilPage.xaml.cs">
|
||||
<DependentUpon>StudentCouncilPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Webmail\WebmailPage.xaml.cs">
|
||||
<DependentUpon>WebmailPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -180,25 +222,20 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Constants.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Resources\Icons.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Icons.resx</DependentUpon>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Include="ThemelizedIcons.cs" />
|
||||
<Compile Include="Utility\Api.cs" />
|
||||
<Compile Include="Utility\ApiEventHandler.cs" />
|
||||
<Compile Include="Utility\Feed.cs" />
|
||||
<Compile Include="Utility\FeedEventHandler.cs" />
|
||||
<Compile Include="Utility\FileList.cs" />
|
||||
<Compile Include="Utility\FileManager.cs" />
|
||||
<Compile Include="Utility\File.cs" />
|
||||
<Compile Include="Utility\Logger.cs" />
|
||||
<Compile Include="Utility\HttpRequest.cs" />
|
||||
<Compile Include="Utility\Lui\Button\GoToMapButton.cs" />
|
||||
<Compile Include="Utility\Lui\Button\UpdateButtonAppBar.cs" />
|
||||
<Compile Include="Utility\Lui\Button\ToggleButton.cs" />
|
||||
<Compile Include="Utility\Lui\Button\NavigateButton.cs" />
|
||||
<Compile Include="Utility\Lui\Button\PhoneButton.cs" />
|
||||
<Compile Include="Utility\Lui\Button\LinkButton.cs" />
|
||||
<Compile Include="Utility\StringManager.cs" />
|
||||
<Compile Include="Utility\URLList.cs" />
|
||||
<Compile Include="Utility\XmlApi.cs" />
|
||||
<Compile Include="Utility\XmlFeed.cs" />
|
||||
<Compile Include="Utility\Utilities.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Utility\XmlManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -210,6 +247,18 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Departments\DepartmentFavoritePage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Departments\DepartmentIndexPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Departments\DepartmentInfoPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Departments\DepartmentPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -238,6 +287,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Pages\Links\LinkPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Mensa\MensaPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -254,14 +307,30 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Setting\UserProfil.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="pages\StartPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\StudentCouncil\StudentCouncilPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Webmail\WebmailPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\StartPageStyles.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Styles\ListButton.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Assets\psd\holo_optionsbuttons.psd" />
|
||||
@@ -277,14 +346,25 @@
|
||||
<Content Include="Assets\ApplicationIcon.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Assets\Icons\DarkTheme\add_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\btulogo_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\campus_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\delete_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\favorite_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\info_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\phone_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\update_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\add_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\btulogo_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\campus_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\departments_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\delete_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\departments_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\homework_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\favorite_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\homework_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\link_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\info_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\link_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\lectures_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\lectures_159.png" />
|
||||
@@ -302,6 +382,7 @@
|
||||
<Content Include="Assets\Icons\DarkTheme\student_council_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\student_council_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\webmail_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\update_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\webmail_159.png" />
|
||||
<Content Include="Assets\testmap.png" />
|
||||
<Content Include="Assets\Tiles\FlipCycleTileLarge.png">
|
||||
@@ -319,6 +400,9 @@
|
||||
<Content Include="Assets\Tiles\IconicTileSmall.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Assets\Tiles\kachel_large.png" />
|
||||
<Content Include="Assets\Tiles\kachel_medium.png" />
|
||||
<Content Include="Assets\Tiles\kachel_small.png" />
|
||||
<Content Include="README_FIRST.txt" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Cancel.png" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Check.png" />
|
||||
@@ -332,20 +416,34 @@
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Constants.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Constants.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Icons.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Icons.Designer.cs</LastGenOutput>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AsyncCtpLibrary_Phone">
|
||||
<HintPath>..\packages\BuiltToRoam.Core.Agent.1.0.1.5\lib\sl4-wp71\AsyncCtpLibrary_Phone.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BuiltToRoam.Core.Agent">
|
||||
<HintPath>..\packages\BuiltToRoam.Core.Agent.1.0.1.5\lib\sl4-wp71\BuiltToRoam.Core.Agent.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BuiltToRoam.GeoWatcher">
|
||||
<HintPath>..\packages\BuiltToRoam.GeoWatcher.1.0.1.5\lib\sl4-wp71\BuiltToRoam.GeoWatcher.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Phone.Controls, Version=8.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e, processorArchitecture=MSIL" />
|
||||
<Reference Include="Microsoft.Phone.Controls.Toolkit">
|
||||
<HintPath>..\packages\WPtoolkit.4.2012.10.30\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\sl4-windowsphone71\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpZipLib.WindowsPhone7">
|
||||
<HintPath>..\packages\SharpZipLib-WP7.0.86.0.518\lib\sl4-windowsphone71\SharpZipLib.WindowsPhone7.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
|
||||
|
||||
33
CampusAppWP8/CampusAppWP8/Const.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="Const.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>08.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8
|
||||
{
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Access to Constants.rex
|
||||
/// </summary>
|
||||
public class Const
|
||||
{
|
||||
/// <summary>
|
||||
/// Resource object.
|
||||
/// </summary>
|
||||
private static Constants constantResources = new Constants();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the resource object.
|
||||
/// </summary>
|
||||
public Constants Constants
|
||||
{
|
||||
get
|
||||
{
|
||||
return constantResources;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="DepartmentFavoriteFeed.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>01.07.2013</sience>
|
||||
//----------------------------------------------------------------------using System;
|
||||
namespace CampusAppWP8.Feed.Departments
|
||||
{
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Departments;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Feed object to handle favorite department feeds.
|
||||
/// </summary>
|
||||
public class DepartmentFavoriteFeed : XmlModel<DepartmentModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DepartmentFavoriteFeed" /> class.
|
||||
/// </summary>
|
||||
/// <param name="autoLoad">automatic loading of the data</param>
|
||||
public DepartmentFavoriteFeed(bool autoLoad = true)
|
||||
: base(ModelType.File, Constants.FileDepartment_Favorite_Name, string.Empty)
|
||||
{
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
|
||||
if (autoLoad == true)
|
||||
{
|
||||
this.LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
// Constructor
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region Protected
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsModelUpToDate(DepartmentModel model)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((model == null)
|
||||
|| (model.Faculties == null)
|
||||
|| (model.Faculties.Count != 1))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">file info object</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnLoad(DepartmentModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
if (this.Model == null)
|
||||
{
|
||||
retValue = true;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">file info object</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnSave(DepartmentModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
retValue = (model.HasChanged() == false) ? true : false;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
// Protected
|
||||
#endregion
|
||||
|
||||
// Method
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,116 @@
|
||||
using CampusAppWP8.Model.Departments;
|
||||
using CampusAppWP8.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CampusAppWP8.Api.Departments
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="DepartmentFeed.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.Departments
|
||||
{
|
||||
class DepartmentFeed : XmlFeed<DepartmentViewModel>
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Departments;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Feed class for the department information.
|
||||
/// </summary>
|
||||
public class DepartmentFeed : XmlModel<DepartmentModel>
|
||||
{
|
||||
public DepartmentFeed() : base(URLList.DepartmentFeedURL, "DepartmentFeed.xml")
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DepartmentFeed" /> class.
|
||||
/// </summary>
|
||||
/// <param name="autoLoad">automatic loading of the data</param>
|
||||
public DepartmentFeed(bool autoLoad = true)
|
||||
: base(ModelType.FileAndFeed, Constants.FileDepartment_Name, Constants.UrlDepartment_Addr)
|
||||
{
|
||||
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
|
||||
if (autoLoad == true)
|
||||
{
|
||||
this.LoadData();
|
||||
}
|
||||
}
|
||||
public System.Collections.ObjectModel.ObservableCollection<FacultyModel> _faculties { get; set; }
|
||||
|
||||
// Constructor
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region Protected
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>
|
||||
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsModelUpToDate()
|
||||
private bool CheckIsModelUpToDate(DepartmentModel model)
|
||||
{
|
||||
return false;
|
||||
bool retValue = true;
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 7.0);
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">file info object</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsFileUpToDate()
|
||||
private bool CheckIsFileUpToDateOnLoad(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);
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">file info object</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnSave(DepartmentModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
// at saving
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
// Protedted
|
||||
#endregion
|
||||
|
||||
// Method
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,100 @@
|
||||
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
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="EventFeed.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.Events
|
||||
{
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.RSS;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Event Feed.
|
||||
/// </summary>
|
||||
public class EventFeed : XmlFeed<RSSViewModel>
|
||||
public class EventFeed : XmlModel<RSSViewModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// Initializes a new instance of the <see cref="EventFeed" /> class.
|
||||
/// </summary>
|
||||
public EventFeed() : base(URLList.EventsFeedURL, "EventFeed.xml")
|
||||
/// <param name="autoLoad">automatic loading of the data</param>
|
||||
public EventFeed(bool autoLoad = true)
|
||||
: base(ModelType.FileAndFeed, Constants.FileEvents_Name, Constants.UrlEvents_Addr)
|
||||
{
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
|
||||
if (autoLoad == true)
|
||||
{
|
||||
this.LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">file info object</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsFileUpToDate()
|
||||
private bool CheckIsFileUpToDateOnLoad(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);
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">file info object</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnSave(RSSViewModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
88
CampusAppWP8/CampusAppWP8/Feed/Link/ClubLinkFeed.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="ClubLinkFeed.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>02.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.Link
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Link;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for ClubLinkFeeds
|
||||
/// </summary>
|
||||
public class ClubLinkFeed : XmlModel<LinkListModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ClubLinkFeed" /> class.
|
||||
/// </summary>
|
||||
public ClubLinkFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileLink_ClubLinks, Constants.UrlLink_ClubLinks)
|
||||
{
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region Private
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedModel is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsModelUpToDate(LinkListModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTime lastModified = model.CreateTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedFile is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="fileInfo">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
|
||||
{
|
||||
if (fileInfo == null || !fileInfo.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the model or file is up-to-date.
|
||||
/// </summary>
|
||||
/// <param name="lastModified">Date of the last modification</param>
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
88
CampusAppWP8/CampusAppWP8/Feed/Link/CommonLinkFeed.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="CommonLinkFeed.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>02.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.Link
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Link;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for CommonLinkFeeds
|
||||
/// </summary>
|
||||
public class CommonLinkFeed : XmlModel<LinkListModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CommonLinkFeed" /> class.
|
||||
/// </summary>
|
||||
public CommonLinkFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileLink_CommonLinks, Constants.UrlLink_CommonLinks)
|
||||
{
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region Private
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedModel is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsModelUpToDate(LinkListModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTime lastModified = model.CreateTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedFile is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="fileInfo">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDate(LinkListModel model, FileInfo fileInfo)
|
||||
{
|
||||
if (fileInfo == null || !fileInfo.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the model or file is up-to-date.
|
||||
/// </summary>
|
||||
/// <param name="lastModified">Date of the last modification</param>
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,18 @@
|
||||
// <author>stubbfel</author>
|
||||
// <sience>03.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for MesaFeeds
|
||||
/// This Class is for MensaFeeds
|
||||
/// </summary>
|
||||
public class MensaFeed : XmlFeed<MenuWeekModel>
|
||||
public class MensaFeed : XmlModel<MenuWeekModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
@@ -23,40 +24,52 @@ namespace CampusAppWP8.Api.Mensa
|
||||
/// Initializes a new instance of the <see cref="MensaFeed" /> class.
|
||||
/// </summary>
|
||||
public MensaFeed()
|
||||
: base(URLList.MensaFeedURL, FileList.MensaXmlFile)
|
||||
: base(ModelType.FileAndFeed, Constants.FileMensa_Shedule, Constants.UrlMensa_Week)
|
||||
{
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region Protected
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>
|
||||
/// </summary>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsModelUpToDate()
|
||||
{
|
||||
DateTime lastModified = this.Model.CreateTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>
|
||||
/// </summary>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsFileUpToDate()
|
||||
{
|
||||
DateTime lastModified = FileManager.GetFileInfo(FileName).LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedModel is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsModelUpToDate(MenuWeekModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTime lastModified = model.CreateTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedFile is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="fileInfo">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDate(MenuWeekModel model, FileInfo fileInfo)
|
||||
{
|
||||
if (fileInfo == null || !fileInfo.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the last modification was later as the NewMenuWeekDay
|
||||
/// </summary>
|
||||
|
||||
@@ -1,42 +1,99 @@
|
||||
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
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="NewsFeed.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.News
|
||||
{
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.RSS;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// News Feed.
|
||||
/// </summary>
|
||||
public class NewsFeed : XmlFeed<RSSViewModel>
|
||||
public class NewsFeed : XmlModel<RSSViewModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// Initializes a new instance of the <see cref="NewsFeed" /> class.
|
||||
/// </summary>
|
||||
public NewsFeed() : base(URLList.NewsFeedURL, "NewsFeed.xml")
|
||||
/// <param name="autoLoad">automatic loading of the data</param>
|
||||
public NewsFeed(bool autoLoad = true)
|
||||
: base(ModelType.FileAndFeed, Constants.FileNews_Name, Constants.UrlNews_Addr)
|
||||
{
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
|
||||
if (autoLoad == true)
|
||||
{
|
||||
this.LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">info object of the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsFileUpToDate()
|
||||
private bool CheckIsFileUpToDateOnLoad(RSSViewModel model, FileInfo info)
|
||||
{
|
||||
return true;
|
||||
bool retValue = true;
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
if (info.Exists == true)
|
||||
{
|
||||
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">info object of the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnSave(RSSViewModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,15 +7,16 @@
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.Openinghours
|
||||
{
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Openinghours;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for MesaFeeds
|
||||
/// </summary>
|
||||
public class OpeninghoursFeed : XmlFeed<OpeninghoursModel>
|
||||
public class OpeninghoursFeed : XmlModel<OpeninghoursModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
@@ -23,48 +24,78 @@ namespace CampusAppWP8.Feed.Openinghours
|
||||
/// Initializes a new instance of the <see cref="OpeninghoursFeed" /> class.
|
||||
/// </summary>
|
||||
public OpeninghoursFeed()
|
||||
: base(URLList.OpeninghoursFeedURL, FileList.OpeninghoursXmlFile)
|
||||
: base(ModelType.FileAndFeed, Constants.FileOpeningHours_OpeningHours, Constants.UrlOpeningHours_OpeningHours)
|
||||
{
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region Protected
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsModelUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsModelUpToDate()
|
||||
{
|
||||
DateTime lastModified = this.Model.CreateTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
protected override bool CheckIsFileUpToDate()
|
||||
{
|
||||
DateTime lastModified = FileManager.GetFileInfo(FileName).LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private
|
||||
|
||||
/// <summary>
|
||||
/// Check if the model or file is up-to-date.
|
||||
/// Method check if the FeedModel is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="lastModified">Date of the last modification</param>
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsModelUpToDate(OpeninghoursModel model)
|
||||
{
|
||||
return true;
|
||||
bool retValue = true;
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 7.0);
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedFile is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="info">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnLoad(OpeninghoursModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
if (info.Exists == true)
|
||||
{
|
||||
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 7.0);
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedFile is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="info">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnSave(OpeninghoursModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="StudentCouncilFeed.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>02.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Feed.StudentCouncil
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.StudentCouncil;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for StudentCouncilFeed
|
||||
/// </summary>
|
||||
public class StudentCouncilFeed : XmlModel<StudentCouncilListModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StudentCouncilFeed" /> class.
|
||||
/// </summary>
|
||||
public StudentCouncilFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileStudentCouncil_StudentCouncils, Constants.UrlStudentCouncil_StudentCouncils)
|
||||
{
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region Private
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedModel is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsModelUpToDate(StudentCouncilListModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTime lastModified = model.CreateTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedFile is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="fileInfo">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDate(StudentCouncilListModel model, FileInfo fileInfo)
|
||||
{
|
||||
if (fileInfo == null || !fileInfo.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the model or file is up-to-date.
|
||||
/// </summary>
|
||||
/// <param name="lastModified">Date of the last modification</param>
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
67
CampusAppWP8/CampusAppWP8/File/Setting/UserProfilFile.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="UserProfilFile.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>23.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.File.Setting
|
||||
{
|
||||
using System.IO;
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Setting;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Class for handle the user-profile-file
|
||||
/// </summary>
|
||||
public class UserProfilFile : XmlModel<UserProfilModel>
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserProfilFile" /> class.
|
||||
/// </summary>
|
||||
public UserProfilFile()
|
||||
: base(ModelType.File, Constants.FileProfil_User)
|
||||
{
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
}
|
||||
|
||||
// Constructor
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">file info object</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnLoad(UserProfilModel model, FileInfo info)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">file info object</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnSave(UserProfilModel model, FileInfo info)
|
||||
{
|
||||
if (model != null && !model.HasChanged())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +1,126 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="ChairModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Departments
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Class to hold information about a professorship chair.
|
||||
/// </summary>
|
||||
public class ChairModel : BaseModel
|
||||
public class ChairModel
|
||||
{
|
||||
private string name_de; // german name of the chair
|
||||
private string url; // link-url to the chair homepage
|
||||
private string name_en; // english name of the chair
|
||||
/// <summary>
|
||||
/// German name of the chair.
|
||||
/// </summary>
|
||||
private string nameDE = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Default Constructor. Set every class variable to default value.
|
||||
/// Link to the chair page.
|
||||
/// </summary>
|
||||
private string url = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// English name of the chair.
|
||||
/// </summary>
|
||||
private string nameEN = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChairModel" /> class.
|
||||
/// </summary>
|
||||
public ChairModel()
|
||||
{
|
||||
this.name_de = String.Empty;
|
||||
this.name_en = String.Empty;
|
||||
this.url = String.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor. Set the german and english name.
|
||||
/// Initializes a new instance of the <see cref="ChairModel" /> class.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the professorship chair.</param>
|
||||
/// <param name="name">name of the chair</param>
|
||||
public ChairModel(string name)
|
||||
{
|
||||
this.name_de = name;
|
||||
this.name_en = name;
|
||||
this.url = String.Empty;
|
||||
this.nameDE = name;
|
||||
this.nameEN = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set or return the german name of the chair.
|
||||
/// Gets or sets the german name of the chair.
|
||||
/// </summary>
|
||||
[XmlAttribute("name_de")]
|
||||
public string Name_DE
|
||||
public string NameDE
|
||||
{
|
||||
get { return this.name_de; }
|
||||
get
|
||||
{
|
||||
return this.nameDE;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.name_de)
|
||||
if (value != this.nameDE)
|
||||
{
|
||||
this.name_de = value;
|
||||
NotifyPropertyChanged("chair");
|
||||
this.nameDE = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set or return the english name of the chair.
|
||||
/// Gets or sets the english name of the chair.
|
||||
/// </summary>
|
||||
[XmlAttribute("name_en")]
|
||||
public string Name_EN
|
||||
public string NameEN
|
||||
{
|
||||
get { return this.name_en; }
|
||||
get
|
||||
{
|
||||
return this.nameEN;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.name_en)
|
||||
if (value != this.nameEN)
|
||||
{
|
||||
this.name_en = value;
|
||||
NotifyPropertyChanged("chair");
|
||||
this.nameEN = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set or return the url of the chair homepage.
|
||||
/// Gets or sets the url of the chair homepage.
|
||||
/// </summary>
|
||||
[XmlAttribute("url")]
|
||||
public string Url
|
||||
{
|
||||
get { return this.url; }
|
||||
get
|
||||
{
|
||||
return this.url;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.url)
|
||||
{
|
||||
this.url = value;
|
||||
NotifyPropertyChanged("chair");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the localized name of the chair.
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
if (CultureInfo.CurrentUICulture.Name.StartsWith("de"))
|
||||
{
|
||||
return this.NameDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.NameEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,86 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="DepartmentModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Departments
|
||||
{
|
||||
public class DepartmentModel : BaseModel
|
||||
{
|
||||
[XmlElement("chair")]
|
||||
public ObservableCollection<ChairModel> _chairs { get; set; }
|
||||
|
||||
private string _name = "d_mod";
|
||||
private Visibility visible;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// View model for department page.
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class DepartmentModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Object to store the time when the instance was created.
|
||||
/// </summary>
|
||||
private DateTime createTime;
|
||||
|
||||
/// <summary>
|
||||
/// List of faculties.
|
||||
/// </summary>
|
||||
private ObservableCollection<FacultyModel> faculties;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DepartmentModel" /> class.
|
||||
/// </summary>
|
||||
public DepartmentModel()
|
||||
{
|
||||
this.visible = Visibility.Collapsed;
|
||||
this.Chairs = new ObservableCollection<ChairModel>();
|
||||
//this.LoadData();
|
||||
this.Faculties = new ObservableCollection<FacultyModel>();
|
||||
this.createTime = DateTime.Now;
|
||||
}
|
||||
|
||||
public DepartmentModel(string name)
|
||||
{
|
||||
this.visible = Visibility.Collapsed;
|
||||
_name = name;
|
||||
this.Chairs = new ObservableCollection<ChairModel>();
|
||||
//this.LoadData();
|
||||
}
|
||||
|
||||
public void LoadData()
|
||||
{
|
||||
this.Chairs.Add(new ChairModel("LS 1"));
|
||||
this.Chairs.Add(new ChairModel("LS 2"));
|
||||
this.Chairs.Add(new ChairModel("LS 3"));
|
||||
this.Chairs.Add(new ChairModel("LS 4"));
|
||||
}
|
||||
|
||||
public ObservableCollection<ChairModel> Chairs
|
||||
/// <summary>
|
||||
/// Gets or sets the faculty list.
|
||||
/// </summary>
|
||||
[XmlArray("professorships")]
|
||||
[XmlArrayItem("faculty")]
|
||||
public ObservableCollection<FacultyModel> Faculties
|
||||
{
|
||||
get
|
||||
{
|
||||
return _chairs;
|
||||
return this.faculties;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _chairs)
|
||||
if (value != this.faculties)
|
||||
{
|
||||
_chairs = value;
|
||||
NotifyPropertyChanged("department");
|
||||
this.faculties = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
/// <summary>
|
||||
/// Gets the creation time.
|
||||
/// </summary>
|
||||
public DateTime CreateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != _name)
|
||||
{
|
||||
_name = value;
|
||||
NotifyPropertyChanged("chair");
|
||||
}
|
||||
return this.createTime;
|
||||
}
|
||||
}
|
||||
|
||||
public Visibility Visible
|
||||
/// <summary>
|
||||
/// Check if the content of the faculty lists hast changed since the
|
||||
/// last call of this function.
|
||||
/// </summary>
|
||||
/// <returns>true, if changes happen since last request, otherwise false</returns>
|
||||
public bool HasChanged()
|
||||
{
|
||||
get { return this.visible; }
|
||||
set
|
||||
bool retValue = false;
|
||||
|
||||
foreach (FacultyModel temp in this.Faculties)
|
||||
{
|
||||
if (value != this.visible)
|
||||
if ((temp.HasChanged() == true) && (retValue == false))
|
||||
{
|
||||
this.visible = value;
|
||||
retValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace CampusAppWP8.Model.Departments
|
||||
{
|
||||
[XmlRoot("root")]
|
||||
public class DepartmentViewModel : BaseViewModel
|
||||
{
|
||||
[XmlArray("professorships")]
|
||||
[XmlArrayItem("faculty")]
|
||||
public ObservableCollection<FacultyModel> _faculties { get; set; }
|
||||
|
||||
public DepartmentViewModel()
|
||||
{
|
||||
this.Faculties = new ObservableCollection<FacultyModel>();
|
||||
}
|
||||
|
||||
public ObservableCollection<FacultyModel> Faculties
|
||||
{
|
||||
get
|
||||
{
|
||||
return _faculties;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != _faculties)
|
||||
{
|
||||
_faculties = value;
|
||||
NotifyPropertyChanged("foodDays");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +1,238 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="FacultyModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Departments
|
||||
{
|
||||
public class FacultyModel : BaseModel
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Model for holding the faculty information.
|
||||
/// </summary>
|
||||
public class FacultyModel
|
||||
{
|
||||
[XmlElement("chair")]
|
||||
public ObservableCollection<ChairModel> chairs { get; set; }
|
||||
//public ObservableCollection<DepartmentModel> _faculties { get; set; }
|
||||
|
||||
private string name = "t_fak";
|
||||
/// <summary>
|
||||
/// Object to hold the information of the chair containing to this
|
||||
/// faculty.
|
||||
/// </summary>
|
||||
private ObservableCollection<ChairModel> chairs;
|
||||
|
||||
/// <summary>
|
||||
/// Name of the faculty.
|
||||
/// </summary>
|
||||
private string name = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// For checking of change.
|
||||
/// </summary>
|
||||
private bool hasChanged = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FacultyModel" /> class.
|
||||
/// </summary>
|
||||
public FacultyModel()
|
||||
{
|
||||
//this.Faculties = new ObservableCollection<DepartmentModel>();
|
||||
this.chairs = new ObservableCollection<ChairModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FacultyModel" /> class.
|
||||
/// </summary>
|
||||
/// <param name="name">name of the faculty</param>
|
||||
public FacultyModel(string name)
|
||||
{
|
||||
this.name = name;
|
||||
//this.Faculties = new ObservableCollection<DepartmentModel>();
|
||||
this.chairs = new ObservableCollection<ChairModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of the chairs containing to this faculty.
|
||||
/// </summary>
|
||||
[XmlElement("chair")]
|
||||
public ObservableCollection<ChairModel> Chairs
|
||||
{
|
||||
get { return this.chairs; }
|
||||
get
|
||||
{
|
||||
return this.chairs;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.chairs)
|
||||
{
|
||||
this.chairs = value;
|
||||
NotifyPropertyChanged("faculty");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[XmlAttribute("id")]
|
||||
/// <summary>
|
||||
/// Gets the name of the faculty.
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppResources.Faculty + " " + this.name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id of the faculty.
|
||||
/// </summary>
|
||||
[XmlAttribute("id")]
|
||||
public string Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.name)
|
||||
this.name = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a chair model from the lost.
|
||||
/// </summary>
|
||||
/// <param name="chairName">name of the chair</param>
|
||||
/// <returns>true, if succeeded</returns>
|
||||
public bool RemoveChair(string chairName)
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
ChairModel tempChair = null;
|
||||
|
||||
foreach (ChairModel temp in this.Chairs)
|
||||
{
|
||||
if (temp.Name.Equals(chairName) == true)
|
||||
{
|
||||
this.name = value;
|
||||
NotifyPropertyChanged("faculty");
|
||||
tempChair = temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (tempChair != null)
|
||||
{
|
||||
retValue = this.Chairs.Remove(tempChair);
|
||||
this.hasChanged = true;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a chair to the list, if it does not already exist.
|
||||
/// </summary>
|
||||
/// <param name="chairModel">chair model to add</param>
|
||||
/// <returns>true, is succeeded</returns>
|
||||
public bool AddChair(ChairModel chairModel)
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
if ((chairModel != null)
|
||||
&& (this.Chairs.Contains(chairModel) == false))
|
||||
{
|
||||
bool isIn = false;
|
||||
|
||||
foreach (ChairModel temp in this.Chairs)
|
||||
{
|
||||
if ((temp.NameDE.Equals(chairModel.NameDE) == true)
|
||||
|| (temp.NameEN.Equals(chairModel.NameEN) == true))
|
||||
{
|
||||
isIn = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isIn == false)
|
||||
{
|
||||
this.Chairs.Add(chairModel);
|
||||
this.hasChanged = true;
|
||||
retValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a chair model and add it to the list, if it does not already
|
||||
/// exist.
|
||||
/// </summary>
|
||||
/// <param name="nameDE">german name of the chair</param>
|
||||
/// <param name="nameEN">english name of the chair</param>
|
||||
/// <param name="url">url of the chair home page</param>
|
||||
/// <returns>true, if succeeded</returns>
|
||||
public bool AddChair(string nameDE, string nameEN, string url)
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
bool isIn = false;
|
||||
|
||||
foreach (ChairModel temp in this.Chairs)
|
||||
{
|
||||
if ((temp.NameDE.Equals(nameDE) == true)
|
||||
|| (temp.NameEN.Equals(nameEN) == true))
|
||||
{
|
||||
isIn = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isIn == false)
|
||||
{
|
||||
ChairModel newModel = new ChairModel();
|
||||
newModel.NameDE = nameDE;
|
||||
newModel.NameEN = nameEN;
|
||||
newModel.Url = url;
|
||||
|
||||
this.Chairs.Add(newModel);
|
||||
this.hasChanged = true;
|
||||
retValue = true;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the chair model of the chair with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">name of the chair</param>
|
||||
/// <returns>chair model, if succeeded, otherwise null</returns>
|
||||
public ChairModel GetChairModel(string name)
|
||||
{
|
||||
ChairModel retValue = null;
|
||||
|
||||
foreach (ChairModel temp in this.Chairs)
|
||||
{
|
||||
if (temp.Name.Equals(name) == true)
|
||||
{
|
||||
retValue = temp;
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return true if there were changes in the chair list, otherwise false.
|
||||
/// </summary>
|
||||
/// <param name="reset">when true, the hasChanged flag will be reset</param>
|
||||
/// <returns>true, when changed, otherwise false</returns>
|
||||
public bool HasChanged(bool reset = true)
|
||||
{
|
||||
bool retValue = this.hasChanged;
|
||||
|
||||
if (reset == true)
|
||||
{
|
||||
this.hasChanged = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +108,11 @@ namespace CampusAppWP8.Model.events_news
|
||||
get { return String.Format("{0:h:mm} Uhr", this.timestamp); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ListIndex
|
||||
/// </summary>
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set/Get the link/url of the feed.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
using CampusAppWP8.Model;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace CampusAppWP8.Model.events_news
|
||||
{
|
||||
/// <summary>
|
||||
/// ViewModel of the rss feed, containing the feed/channel object.
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class RSSViewModel : BaseViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// channel list for the rss feeds.
|
||||
/// </summary>
|
||||
[XmlArray("rss")]
|
||||
[XmlArrayItem("channel")]
|
||||
public ObservableCollection<RSSChannelModel> channel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public RSSViewModel()
|
||||
{
|
||||
this.channel = new ObservableCollection<RSSChannelModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set/Get the channel list.
|
||||
/// </summary>
|
||||
public ObservableCollection<RSSChannelModel> Channel
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.channel;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != this.channel)
|
||||
{
|
||||
this.channel = value;
|
||||
NotifyPropertyChanged("channel");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="PlaceModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>08.08.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.GeoDb
|
||||
{
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Model for a place of the SPSService
|
||||
/// </summary>
|
||||
public class PlaceModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the placeId
|
||||
/// </summary>
|
||||
[XmlAttribute("id")]
|
||||
public string PlaceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id of the "parent" of a place
|
||||
/// </summary>
|
||||
[XmlAttribute("parentId")]
|
||||
public string ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ReferencePoint of a place
|
||||
/// </summary>
|
||||
[XmlAttribute("refpoint")]
|
||||
public string RefPoint { get; set; }
|
||||
}
|
||||
}
|
||||
26
CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsModel.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="SpsModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>08.08.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.GeoDb
|
||||
{
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Model for a xml-response of the SPSService
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class SpsModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a list of places
|
||||
/// </summary>
|
||||
[XmlElement("place")]
|
||||
public ObservableCollection<PlaceModel> Places { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace CampusAppWP8.Model.Lecture
|
||||
public LectureModule Modul { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets LectureTitel
|
||||
/// Gets or sets LectureTitle
|
||||
/// </summary>
|
||||
[XmlElement("titel")]
|
||||
public string Title { get; set; }
|
||||
@@ -196,7 +196,7 @@ namespace CampusAppWP8.Model.Lecture
|
||||
string result = string.Empty;
|
||||
foreach (LectureLecturer tmpLecturer in this.Lecturer)
|
||||
{
|
||||
result += StringManager.AddNewLine(tmpLecturer.ToString());
|
||||
result += StringManager.AddNewLine(tmpLecturer.ToString());
|
||||
}
|
||||
|
||||
this.LecturerString = StringManager.RemvoveNewLine(result);
|
||||
|
||||
@@ -62,6 +62,5 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// </summary>
|
||||
[XmlElement("enddatum")]
|
||||
public string EndDate { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Lecture
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using CampusAppWP8.Model.Setting;
|
||||
using CampusAppWP8.Model.Utility;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Model for the LecturePage
|
||||
@@ -20,28 +19,63 @@ namespace CampusAppWP8.Model.Lecture
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// Variable for the courseIndex
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int selectCourseIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Variable for the degreeIndex
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int selectDegreeIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Variable for the semesterIndex
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int selectSemesterIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Variable for the fromIndex
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int selectFromIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Variable for the toIndex
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int selectToIndex;
|
||||
|
||||
/// <summary>
|
||||
/// List for the courses of the BTU
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// need to be extend to full list
|
||||
/// </remarks>
|
||||
private List<ListPickerItemModel> courseList;
|
||||
private ListPickerItemListModel courseList;
|
||||
|
||||
/// <summary>
|
||||
/// List of the degrees
|
||||
/// </summary>
|
||||
private List<ListPickerItemModel> degreeList;
|
||||
private ListPickerItemListModel degreeList;
|
||||
|
||||
/// <summary>
|
||||
/// List of the semester
|
||||
/// </summary>
|
||||
private List<ListPickerItemModel> semesterList;
|
||||
private ListPickerItemListModel semesterList;
|
||||
|
||||
/// <summary>
|
||||
/// List for the number of semester
|
||||
/// List for the number of semester (from)
|
||||
/// </summary>
|
||||
private List<ListPickerItemModel> numberList;
|
||||
private ListPickerItemListModel fromNumberList;
|
||||
|
||||
/// <summary>
|
||||
/// List for the number of semester (to)
|
||||
/// </summary>
|
||||
private ListPickerItemListModel toNumberList;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -52,6 +86,9 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// </summary>
|
||||
public LecturePageModel()
|
||||
{
|
||||
this.courseList = new CourseListPickerItemListModel();
|
||||
this.degreeList = new DegreeListPickerItemListModel();
|
||||
this.semesterList = new SemesterListPickerItemListModel();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -60,37 +97,102 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// <summary>
|
||||
/// Gets or sets the selected course index
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int SelectCourseIndex { get; set; }
|
||||
public int SelectCourseIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.selectCourseIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.selectCourseIndex && this.courseList != null && value < this.courseList.List.Count)
|
||||
{
|
||||
this.selectCourseIndex = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the selected degree index
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int SelectDegreeIndex { get; set; }
|
||||
public int SelectDegreeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.selectDegreeIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.selectDegreeIndex && this.degreeList != null && value < this.degreeList.List.Count)
|
||||
{
|
||||
this.selectDegreeIndex = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the selected semester-index
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int SelectSemesterIndex { get; set; }
|
||||
public int SelectSemesterIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.selectSemesterIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.selectSemesterIndex && this.semesterList != null && value < this.semesterList.List.Count)
|
||||
{
|
||||
this.selectSemesterIndex = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the selected from-index
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int SelectFromIndex { get; set; }
|
||||
public int SelectFromIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.selectFromIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.selectFromIndex && this.fromNumberList != null && value < this.fromNumberList.List.Count)
|
||||
{
|
||||
this.selectFromIndex = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the selected to-index
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int SelectToIndex { get; set; }
|
||||
public int SelectToIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.selectToIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.selectToIndex && this.toNumberList != null && value < this.toNumberList.List.Count)
|
||||
{
|
||||
this.selectToIndex = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets List for the courses of the BTU
|
||||
/// </summary>
|
||||
public List<ListPickerItemModel> CourseList
|
||||
public ListPickerItemListModel CourseList
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -101,7 +203,7 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// <summary>
|
||||
/// Gets List of the degrees
|
||||
/// </summary>
|
||||
public List<ListPickerItemModel> DegreeList
|
||||
public ListPickerItemListModel DegreeList
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -112,7 +214,7 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// <summary>
|
||||
/// Gets List of the semester
|
||||
/// </summary>
|
||||
public List<ListPickerItemModel> SemesterList
|
||||
public ListPickerItemListModel SemesterList
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -123,11 +225,22 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// <summary>
|
||||
/// Gets List for the number of semester
|
||||
/// </summary>
|
||||
public List<ListPickerItemModel> NumberList
|
||||
public ListPickerItemListModel FromNumberList
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.numberList;
|
||||
return this.fromNumberList;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the NumberList
|
||||
/// </summary>
|
||||
public ListPickerItemListModel ToNumberList
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.toNumberList;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -141,10 +254,12 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// </summary>
|
||||
public void LoadLists()
|
||||
{
|
||||
this.LoadCourseList();
|
||||
this.LoadDegreeList();
|
||||
this.LoadNumberList();
|
||||
this.LoadSemesterList();
|
||||
this.LoadFromNumberList();
|
||||
this.LoadToNumberList();
|
||||
UserProfilModel userModel = Settings.UserProfil.Model;
|
||||
this.selectCourseIndex = this.courseList.GetIndexOrDefault(((int)userModel.Course).ToString().PadLeft(3, '0'));
|
||||
this.selectDegreeIndex = this.degreeList.GetIndexOrDefault(((int)userModel.Degree).ToString());
|
||||
this.selectSemesterIndex = this.semesterList.GetIndexOrDefault(((int)userModel.Semester).ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -154,87 +269,56 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// <summary>
|
||||
/// Load the NumberList
|
||||
/// </summary>
|
||||
private void LoadNumberList()
|
||||
public void LoadFromNumberList()
|
||||
{
|
||||
this.numberList = new List<ListPickerItemModel>();
|
||||
this.numberList.Add(new ListPickerItemModel() { Text = "1", Value = "1" });
|
||||
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" });
|
||||
string selectValue = null;
|
||||
if (this.fromNumberList != null && this.fromNumberList.List.Count > 0)
|
||||
{
|
||||
selectValue = this.fromNumberList.List[this.SelectFromIndex].Value;
|
||||
}
|
||||
|
||||
this.fromNumberList = this.CreateNumberList(1, 10);
|
||||
this.SelectFromIndex = this.fromNumberList.GetIndexOrDefault(selectValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the SemesterList
|
||||
/// Load the NumberList
|
||||
/// </summary>
|
||||
private void LoadSemesterList()
|
||||
public void LoadToNumberList()
|
||||
{
|
||||
this.semesterList = new List<ListPickerItemModel>();
|
||||
this.semesterList.Add(new ListPickerItemModel() { Text = "SoSe 13", Value = "20131" });
|
||||
this.semesterList.Add(new ListPickerItemModel() { Text = "WiSe 13/14", Value = "20132" });
|
||||
this.semesterList.Add(new ListPickerItemModel() { Text = "SoSe 14", Value = "20131" });
|
||||
string selectValue = null;
|
||||
if (this.toNumberList != null && this.toNumberList.List.Count > 0)
|
||||
{
|
||||
selectValue = this.toNumberList.List[this.SelectToIndex].Value;
|
||||
}
|
||||
|
||||
this.toNumberList = this.CreateNumberList(this.SelectFromIndex + 1, 10);
|
||||
this.SelectToIndex = this.toNumberList.GetIndexOrDefault(selectValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the DegreeList
|
||||
/// Method create a NumberList
|
||||
/// </summary>
|
||||
private void LoadDegreeList()
|
||||
/// <param name="startvalue">startValue of the list</param>
|
||||
/// <param name="endvalue">endValue of the list</param>
|
||||
/// <returns>return list</returns>
|
||||
private ListPickerItemListModel CreateNumberList(int startvalue, int endvalue)
|
||||
{
|
||||
this.degreeList = new List<ListPickerItemModel>();
|
||||
this.degreeList.Add(new ListPickerItemModel() { Text = AppResources.Degree_Bachelor, Value = "82" });
|
||||
this.degreeList.Add(new ListPickerItemModel() { Text = AppResources.Degree_Master, Value = "88" });
|
||||
this.degreeList.Add(new ListPickerItemModel() { Text = AppResources.Degree_Diploma, Value = "11" });
|
||||
}
|
||||
ListPickerItemListModel list = new ListPickerItemListModel();
|
||||
string degree = this.DegreeList.List[this.SelectDegreeIndex].Value;
|
||||
|
||||
/// <summary>
|
||||
/// Load the DegreeList
|
||||
/// </summary>
|
||||
private void LoadCourseList()
|
||||
{
|
||||
this.courseList = new List<ListPickerItemModel>();
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Architektur", Value = "013" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Bauingenieurwesen", Value = "017" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Betriebswirtschaftslehre", Value = "021" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsrecht für Technologieunternehmen", Value = "042" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Elektrotechnik", Value = "048" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Informatik ", Value = "079" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Maschinenbau", Value = "104" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Mathematik", Value = "105" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Physik ", Value = "128" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsingenieurwesen", Value = "179" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftswissenschaften ", Value = "184" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Biomedizinische Gerätetechnik ", Value = "215" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Verfahrenstechnik", Value = "226" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Wirtschaftsmathematik ", Value = "276" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Kultur und Technik ", Value = "711" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Physik der Halbleiter-Technologie", Value = "744" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Angewandte Mathematik ", Value = "749" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Technologie- und Innovationsmanagement", Value = "764" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Stadt- und Regionalplanung", Value = "766" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Informations- und Medientechnik ", Value = "767" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "World Heritage Studies", Value = "768" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Umweltingenieurwesen und Verfahrenstechnik", Value = "770" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Environmental and Resource Management", Value = "771" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Landnutzung und Wasserbewirtschaftung", Value = "772" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Bauen und Erhalten", Value = "773" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Umweltingenieurwesen", Value = "774" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "eBusiness", Value = "794" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Civil Engineering", Value = "798" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Structural Engineering", Value = "799" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Electrical Power Engineering ", Value = "800" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Euro Hydroinformatics and Water Management", Value = "841" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Technologien Biogener Rohstoffe", Value = "842" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Environmental Technologies", Value = "843" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Process Engineering and Plant Design", Value = "844" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Architekturvermittlung", Value = "845" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Nachwachsende Rohstoffe und Erneuerbare Energien", Value = "851" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Energieträger aus Biomasse und Abfällen", Value = "852" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Power Engineering", Value = "853" });
|
||||
this.courseList.Add(new ListPickerItemModel() { Text = "Verfahrenstechnik - Prozess- und Anlagentechnik", Value = "857" });
|
||||
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" });
|
||||
}
|
||||
for (int i = startvalue; i <= endvalue; i++)
|
||||
{
|
||||
if ((i > 4 && "88".Equals(degree)) || (i > 6 && "82".Equals(degree)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
list.AddItem(i.ToString(), i.ToString());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
64
CampusAppWP8/CampusAppWP8/Model/Link/LinkListModel.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="LinkListModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>02.07.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.Link
|
||||
{
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Model for a list of links.
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class LinkListModel
|
||||
{
|
||||
#region Member
|
||||
|
||||
/// <summary>
|
||||
/// Time when the model was created.
|
||||
/// </summary>
|
||||
private readonly DateTime createTime;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LinkListModel" /> class.
|
||||
/// </summary>
|
||||
public LinkListModel()
|
||||
{
|
||||
this.createTime = DateTime.Now;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets feed information item list.
|
||||
/// </summary>
|
||||
[XmlArray("data")]
|
||||
[XmlArrayItem("link")]
|
||||
public ObservableCollection<LinkModel> Links { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the creation time of the model.
|
||||
/// </summary>
|
||||
public DateTime CreateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.createTime;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
173
CampusAppWP8/CampusAppWP8/Model/Link/LinkModel.cs
Normal file
@@ -0,0 +1,173 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="LinkModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>02.07.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.Link
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Model for menu
|
||||
/// </summary>
|
||||
public class LinkModel
|
||||
{
|
||||
#region Member
|
||||
|
||||
/// <summary>
|
||||
/// German version of the link title.
|
||||
/// </summary>
|
||||
private string titleDE;
|
||||
|
||||
/// <summary>
|
||||
/// English version of the link title.
|
||||
/// </summary>
|
||||
private string titleEN;
|
||||
|
||||
/// <summary>
|
||||
/// German version of the link.
|
||||
/// </summary>
|
||||
private string linkDE;
|
||||
|
||||
/// <summary>
|
||||
/// English version of the link.
|
||||
/// </summary>
|
||||
private string linkEN;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LinkModel" /> class.
|
||||
/// </summary>
|
||||
public LinkModel()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the german title of the link.
|
||||
/// </summary>
|
||||
[XmlAttribute("title_de")]
|
||||
public string Title_DE
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.titleDE;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.titleDE)
|
||||
{
|
||||
this.titleDE = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the english title of the link.
|
||||
/// </summary>
|
||||
[XmlAttribute("title_en")]
|
||||
public string Title_EN
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.titleEN;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.titleEN = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the german link.
|
||||
/// </summary>
|
||||
[XmlAttribute("link_de")]
|
||||
public string Link_DE
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.linkDE;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.linkDE)
|
||||
{
|
||||
this.linkDE = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the english link.
|
||||
/// </summary>
|
||||
[XmlAttribute("link_en")]
|
||||
public string Link_EN
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.linkEN;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.linkEN)
|
||||
{
|
||||
this.linkEN = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the localized title. If the phone is set to german language,
|
||||
/// the german title will be returned otherwise the english title.
|
||||
/// </summary>
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
{
|
||||
if (CultureInfo.CurrentUICulture.Name.StartsWith("de"))
|
||||
{
|
||||
return this.titleDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.titleEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the localized link. if the phone is set to german language,
|
||||
/// the german comment will be returned otherwise the english link.
|
||||
/// </summary>
|
||||
public string Link
|
||||
{
|
||||
get
|
||||
{
|
||||
if (CultureInfo.CurrentUICulture.Name.StartsWith("de"))
|
||||
{
|
||||
return this.Link_DE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Link_EN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
504
CampusAppWP8/CampusAppWP8/Model/MainModel.cs
Normal file
@@ -0,0 +1,504 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="MainModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>05.07.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using CampusAppWP8.Model.Utility;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Base model io handling class.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">model type</typeparam>
|
||||
public abstract class MainModel<T> : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Model io type.
|
||||
/// </summary>
|
||||
private ModelType modelType;
|
||||
|
||||
/// <summary>
|
||||
/// Model object.
|
||||
/// </summary>
|
||||
private T model = default(T);
|
||||
|
||||
/// <summary>
|
||||
/// File object.
|
||||
/// </summary>
|
||||
private CampusAppWP8.Utility.File file = null;
|
||||
|
||||
/// <summary>
|
||||
/// Web object.
|
||||
/// </summary>
|
||||
private HttpRequest api = null;
|
||||
|
||||
/// <summary>
|
||||
/// Filename of saved data.
|
||||
/// </summary>
|
||||
private string fileName = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Url of the feed data.
|
||||
/// </summary>
|
||||
private Uri httpApiUri = null;
|
||||
|
||||
/// <summary>
|
||||
/// Parameterized uri of the feed.
|
||||
/// </summary>
|
||||
private Uri paramizedUri = null;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MainModel{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="modelType">Model IO type</param>
|
||||
/// <param name="fileName">name of the file</param>
|
||||
/// <param name="url">url of the feed</param>
|
||||
public MainModel(ModelType modelType, string fileName, string url)
|
||||
{
|
||||
this.Init(modelType, fileName, url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MainModel{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="modelType">Model IO type</param>
|
||||
/// <param name="sourceName">name of the file or the url of the feed</param>
|
||||
public MainModel(ModelType modelType, string sourceName)
|
||||
{
|
||||
if (modelType == ModelType.File)
|
||||
{
|
||||
this.Init(modelType, sourceName, string.Empty);
|
||||
}
|
||||
else if (modelType == ModelType.Feed)
|
||||
{
|
||||
this.Init(modelType, string.Empty, sourceName);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("Wrong constructor was called for Feed and File support.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="MainModel{T}" /> class.
|
||||
/// </summary>
|
||||
~MainModel()
|
||||
{
|
||||
this.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delegate of the OnLoading callback function.
|
||||
/// </summary>
|
||||
public delegate void OnLoading();
|
||||
|
||||
/// <summary>
|
||||
/// Delegate of the OnLoaded callback function.
|
||||
/// </summary>
|
||||
public delegate void OnLoaded();
|
||||
|
||||
/// <summary>
|
||||
/// Delegate of the OnSaving callback function.
|
||||
/// </summary>
|
||||
public delegate void OnSaving();
|
||||
|
||||
/// <summary>
|
||||
/// Delegate of the OnSaved callback function.
|
||||
/// </summary>
|
||||
public delegate void OnSaved();
|
||||
|
||||
/// <summary>
|
||||
/// Delegate of the IsModelUpToDate callback function.
|
||||
/// </summary>
|
||||
/// <param name="model">data model</param>
|
||||
/// <returns>true, model is up to date</returns>
|
||||
public delegate bool IsModelUpToDate(T model);
|
||||
|
||||
/// <summary>
|
||||
/// Delegate of the IsFileUpToDate callback function.
|
||||
/// </summary>
|
||||
/// <param name="model">data model</param>
|
||||
/// <param name="fileInfo">info of the file</param>
|
||||
/// <returns>true, is file is up to date</returns>
|
||||
public delegate bool IsFileUpToDate(T model, FileInfo fileInfo);
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, called before loading.
|
||||
/// </summary>
|
||||
public event OnLoading onLoading = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, called after loading.
|
||||
/// </summary>
|
||||
public event OnLoaded onLoaded = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, called before saving.
|
||||
/// </summary>
|
||||
public event OnSaving onSaving = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, called after saving.
|
||||
/// </summary>
|
||||
public event OnSaved onSaved = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, for checking if file is up to date at loading.
|
||||
/// </summary>
|
||||
public event IsFileUpToDate isFileUpToDateOnLoad = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, for checking if file is up to date at saving.
|
||||
/// </summary>
|
||||
public event IsFileUpToDate isFileUpToDateOnSave = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, for checking if model is up to date at loading.
|
||||
/// </summary>
|
||||
public event IsModelUpToDate isModelUpToDateOnLoad = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, for checking if model is up to date at saving.
|
||||
/// (currently unused)
|
||||
/// </summary>
|
||||
public event IsModelUpToDate isModelUpToDateOnSave = null;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the I/O type of the model.
|
||||
/// </summary>
|
||||
public enum ModelType
|
||||
{
|
||||
/// <summary>
|
||||
/// Invalid/unset state.
|
||||
/// </summary>
|
||||
INVALID = 0,
|
||||
|
||||
/// <summary>
|
||||
/// File only (01).
|
||||
/// </summary>
|
||||
File = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Feed only (10).
|
||||
/// </summary>
|
||||
Feed = 2,
|
||||
|
||||
/// <summary>
|
||||
/// File and feed (11).
|
||||
/// </summary>
|
||||
FileAndFeed = 3
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Model.
|
||||
/// </summary>
|
||||
public T Model
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.model;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.model = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called before finalizing. Can maybe be removed.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
this.SaveData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Forces a update from web.
|
||||
/// </summary>
|
||||
public void ForceWebUpdate()
|
||||
{
|
||||
if (this.api != null)
|
||||
{
|
||||
if (this.onLoading != null)
|
||||
{
|
||||
this.onLoading();
|
||||
}
|
||||
|
||||
this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the data if necessary, from web or from file, regarding if
|
||||
/// the file data is up to date.
|
||||
/// </summary>
|
||||
public void LoadData()
|
||||
{
|
||||
bool loadFromFile = true;
|
||||
|
||||
if (this.onLoading != null)
|
||||
{
|
||||
this.onLoading();
|
||||
}
|
||||
|
||||
if (((this.isModelUpToDateOnLoad == null)
|
||||
|| (this.isModelUpToDateOnLoad(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.isFileUpToDateOnLoad != null) && (this.isFileUpToDateOnLoad(this.model, this.file.GetFileInfo()) == false))
|
||||
|| (this.isFileUpToDateOnLoad == null))
|
||||
{
|
||||
loadFromFile = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
loadFromFile = false;
|
||||
}
|
||||
|
||||
if (this.api == null)
|
||||
{
|
||||
loadFromFile = true;
|
||||
}
|
||||
|
||||
if (loadFromFile == false)
|
||||
{
|
||||
if (this.paramizedUri != null)
|
||||
{
|
||||
this.api.HttpGet(this.paramizedUri, this.OnLoadDataComplete);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string data = this.file.ReadFile();
|
||||
|
||||
if (data != null && !data.Equals(string.Empty))
|
||||
{
|
||||
this.DeserializeModel(Encoding.UTF8.GetBytes(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (loadFromFile == true)
|
||||
{
|
||||
if (this.onLoaded != null)
|
||||
{
|
||||
this.onLoaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save the model data if necessary.
|
||||
/// </summary>
|
||||
/// <param name="force">force saving. DEFAULT: false</param>
|
||||
public void SaveData(bool force = false)
|
||||
{
|
||||
if ((this.file != null)
|
||||
&& ((this.isFileUpToDateOnSave == null)
|
||||
|| (this.isFileUpToDateOnSave(this.model, this.file.GetFileInfo()) == false)
|
||||
|| (force == true)))
|
||||
{
|
||||
if (this.onSaving != null)
|
||||
{
|
||||
this.onSaving();
|
||||
}
|
||||
|
||||
byte[] data = this.SerializeModel();
|
||||
string test = Encoding.UTF8.GetString(data, 0, data.Length);
|
||||
this.file.WriteFile(data);
|
||||
|
||||
if (this.onSaved != null)
|
||||
{
|
||||
this.onSaved();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the model io type.
|
||||
/// </summary>
|
||||
/// <returns>model io type</returns>
|
||||
public ModelType GetModelType()
|
||||
{
|
||||
return this.modelType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the model.
|
||||
/// </summary>
|
||||
/// <returns>model object</returns>
|
||||
public T GetModel()
|
||||
{
|
||||
return this.model;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the parameterized uri.
|
||||
/// </summary>
|
||||
/// <param name="parameters">uri parameter list</param>
|
||||
public void SetUriParams(List<UrlParamModel> parameters)
|
||||
{
|
||||
if (this.api != null)
|
||||
{
|
||||
this.paramizedUri = this.api.CreateGetUrl(parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear the parameterized uri.
|
||||
/// </summary>
|
||||
public void ClearUriParams()
|
||||
{
|
||||
this.paramizedUri = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Abstract declaration of the model deserialize function.
|
||||
/// </summary>
|
||||
/// <param name="modelData">model data as byte array</param>
|
||||
/// <returns>true, is succeeded</returns>
|
||||
protected abstract bool DeserializeModel(byte[] modelData);
|
||||
|
||||
/// <summary>
|
||||
/// Abstract declaration of the model serialize function.
|
||||
/// </summary>
|
||||
/// <returns>model data as byte array</returns>
|
||||
protected abstract byte[] SerializeModel();
|
||||
|
||||
/// <summary>
|
||||
/// Check if the model io type is file.
|
||||
/// </summary>
|
||||
/// <returns>true, if the model io type has file.</returns>
|
||||
protected bool IsFile()
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
if ((this.modelType & ModelType.File) != 0)
|
||||
{
|
||||
retValue = true;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the model io type is feed.
|
||||
/// </summary>
|
||||
/// <returns>true if the model io type has feed.</returns>
|
||||
protected bool IsHttpApi()
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
if ((this.modelType & ModelType.Feed) != 0)
|
||||
{
|
||||
retValue = true;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the class. Is called by the constructors.
|
||||
/// </summary>
|
||||
/// <param name="modelType">model IO type</param>
|
||||
/// <param name="fileName">name of the data file</param>
|
||||
/// <param name="url">url of the feed data</param>
|
||||
private void Init(ModelType modelType, string fileName, string url)
|
||||
{
|
||||
this.modelType = modelType;
|
||||
|
||||
if ((url != null) && (url.Equals(string.Empty) == false))
|
||||
{
|
||||
this.httpApiUri = new Uri(url, UriKind.Absolute);
|
||||
}
|
||||
|
||||
this.fileName = fileName;
|
||||
|
||||
if ((this.IsFile() == true)
|
||||
&& (fileName.Equals(string.Empty) == false))
|
||||
{
|
||||
this.InitFile(CampusAppWP8.Utility.File.IOTypeRead.ReadSync, CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync);
|
||||
}
|
||||
|
||||
if ((this.IsHttpApi() == true)
|
||||
&& (url.Equals(string.Empty) == false))
|
||||
{
|
||||
this.InitHttpApi();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the file object.
|
||||
/// </summary>
|
||||
/// <param name="readType">read io type (Default: sync)</param>
|
||||
/// <param name="writeType">write io type (Default: async)</param>
|
||||
private void InitFile(CampusAppWP8.Utility.File.IOTypeRead readType = CampusAppWP8.Utility.File.IOTypeRead.ReadSync, CampusAppWP8.Utility.File.IOTypeWrite writeType = CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync)
|
||||
{
|
||||
if ((this.IsFile() == true)
|
||||
&& (this.file == null))
|
||||
{
|
||||
this.file = new CampusAppWP8.Utility.File(this.fileName, readType, writeType);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the web object.
|
||||
/// </summary>
|
||||
private void InitHttpApi()
|
||||
{
|
||||
if ((this.IsHttpApi() == true)
|
||||
&& (this.api == null))
|
||||
{
|
||||
this.api = new HttpRequest(this.httpApiUri);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is called after the loading from web is complete.
|
||||
/// </summary>
|
||||
/// <param name="sender">sending object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void OnLoadDataComplete(object sender, DownloadStringCompletedEventArgs e)
|
||||
{
|
||||
Exception downloadError = e.Error;
|
||||
if (downloadError != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string downloadResult = e.Result;
|
||||
if (downloadResult != null && !downloadResult.Equals(string.Empty))
|
||||
{
|
||||
this.DeserializeModel(Encoding.UTF8.GetBytes(downloadResult));
|
||||
}
|
||||
|
||||
if (this.onLoaded != null)
|
||||
{
|
||||
this.onLoaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
268
CampusAppWP8/CampusAppWP8/Model/Mensa/MealModel.cs
Normal file
@@ -0,0 +1,268 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MealModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>06.08.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Mensa
|
||||
{
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Model for a meal
|
||||
/// </summary>
|
||||
public class MealModel
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// Constant for the vegetarian icon
|
||||
/// </summary>
|
||||
private const string MealIconNameVegetarian = "CARROTTE";
|
||||
|
||||
/// <summary>
|
||||
/// Constant for the free icon
|
||||
/// </summary>
|
||||
private const string MealIconNameFree = "FREI";
|
||||
|
||||
/// <summary>
|
||||
/// Constant for the pig icon
|
||||
/// </summary>
|
||||
private const string MealIconNamePig = "SCHWEIN";
|
||||
|
||||
/// <summary>
|
||||
/// Constant for the cow icon
|
||||
/// </summary>
|
||||
private const string MealIconNameCow = "RIND";
|
||||
|
||||
/// <summary>
|
||||
/// Constant for the fowl icon
|
||||
/// </summary>
|
||||
private const string MealIconNameFowl = "GEFL";
|
||||
|
||||
/// <summary>
|
||||
/// Constant for the cow-pig icon
|
||||
/// </summary>
|
||||
private const string MealIconNameCowPig = "RINDSCHWEIN";
|
||||
|
||||
/// <summary>
|
||||
/// Constant for the fish icon
|
||||
/// </summary>
|
||||
private const string MealIconNameFish = "FISCH";
|
||||
|
||||
/// <summary>
|
||||
/// Constant for the wild icon
|
||||
/// </summary>
|
||||
private const string MealIconNameWild = "WILD";
|
||||
|
||||
/// <summary>
|
||||
/// Constant for the lamb icon
|
||||
/// </summary>
|
||||
private const string MealIconNameLamb = "LAMM";
|
||||
|
||||
/// <summary>
|
||||
/// Variable for the id of the meal
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// ValueRange : 0 - 7
|
||||
/// </remarks>
|
||||
private int mealId;
|
||||
|
||||
/// <summary>
|
||||
/// Name of the meal
|
||||
/// </summary>
|
||||
private string mealName;
|
||||
|
||||
/// <summary>
|
||||
/// Name of the icon
|
||||
/// </summary>
|
||||
private string iconName;
|
||||
|
||||
/// <summary>
|
||||
/// Url of the icon
|
||||
/// </summary>
|
||||
private string iconUrl;
|
||||
|
||||
/// <summary>
|
||||
/// Description of the meal
|
||||
/// </summary>
|
||||
private string mealDesc;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Proberty
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the mealId
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// ValueRange : 0 - 7
|
||||
/// </remarks>
|
||||
[XmlAttribute("id")]
|
||||
public int MealId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mealId;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value > -1 && value < 8)
|
||||
{
|
||||
this.mealId = value;
|
||||
this.CreateMealName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mealName
|
||||
/// </summary>
|
||||
public string MealName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mealName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the iconName
|
||||
/// </summary>
|
||||
[XmlAttribute("icon")]
|
||||
public string IconName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.iconName;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.iconName)
|
||||
{
|
||||
this.iconName = value;
|
||||
this.CreateIconUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the iconUrl
|
||||
/// </summary>
|
||||
public string IconUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.iconUrl;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the mealDescription
|
||||
/// </summary>
|
||||
[XmlAttribute("desc")]
|
||||
public string MealDesc
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mealDesc;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.mealDesc)
|
||||
{
|
||||
this.mealDesc = StringManager.StripHTML(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Method create depends of the mealId the mealName
|
||||
/// </summary>
|
||||
private void CreateMealName()
|
||||
{
|
||||
switch (this.mealId)
|
||||
{
|
||||
case 0:
|
||||
this.mealName = AppResources.MensaApp_Soup;
|
||||
break;
|
||||
case 1:
|
||||
this.mealName = AppResources.MensaApp_Dinner1;
|
||||
break;
|
||||
case 2:
|
||||
this.mealName = AppResources.MensaApp_Dinner2;
|
||||
break;
|
||||
case 3:
|
||||
this.mealName = AppResources.MensaApp_Dinner3;
|
||||
break;
|
||||
case 4:
|
||||
this.mealName = AppResources.MensaApp_Dinner4;
|
||||
break;
|
||||
case 5:
|
||||
this.mealName = AppResources.MensaApp_Dinner5;
|
||||
break;
|
||||
case 6:
|
||||
this.mealName = AppResources.MensaApp_Bio;
|
||||
break;
|
||||
case 7:
|
||||
this.mealName = AppResources.MensaApp_Action;
|
||||
break;
|
||||
default:
|
||||
this.mealName = string.Empty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method create depends of the iconUrl the iconName
|
||||
/// </summary>
|
||||
private void CreateIconUrl()
|
||||
{
|
||||
switch (this.iconName)
|
||||
{
|
||||
case MealModel.MealIconNameVegetarian:
|
||||
this.iconUrl = Icons.Info;
|
||||
break;
|
||||
case MealModel.MealIconNameFree:
|
||||
this.iconUrl = Icons.Info;
|
||||
break;
|
||||
case MealModel.MealIconNameCowPig:
|
||||
this.iconUrl = Icons.Info;
|
||||
break;
|
||||
case MealModel.MealIconNameFish:
|
||||
this.iconUrl = Icons.Info;
|
||||
break;
|
||||
case MealModel.MealIconNameFowl:
|
||||
this.iconUrl = Icons.Info;
|
||||
break;
|
||||
case MealModel.MealIconNameLamb:
|
||||
this.iconUrl = Icons.Info;
|
||||
break;
|
||||
case MealModel.MealIconNamePig:
|
||||
this.iconUrl = Icons.Info;
|
||||
break;
|
||||
case MealModel.MealIconNameWild:
|
||||
this.iconUrl = Icons.Info;
|
||||
break;
|
||||
case MealModel.MealIconNameCow:
|
||||
this.iconUrl = Icons.Info;
|
||||
break;
|
||||
default:
|
||||
this.iconUrl = string.Empty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
103
CampusAppWP8/CampusAppWP8/Model/Mensa/MenuModel.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MenuModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>04.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Mensa
|
||||
{
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
|
||||
/// <summary>
|
||||
/// Model for menu
|
||||
/// </summary>
|
||||
public class MenuModel
|
||||
{
|
||||
#region Member
|
||||
|
||||
/// <summary>
|
||||
/// Name of the day
|
||||
/// </summary>
|
||||
private string dayName;
|
||||
|
||||
/// <summary>
|
||||
/// DateTime of the day
|
||||
/// </summary>
|
||||
private string date;
|
||||
|
||||
/// <summary>
|
||||
/// DateTime of the monday
|
||||
/// </summary>
|
||||
private DateTime monday;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MenuModel" /> class.
|
||||
/// </summary>
|
||||
public MenuModel()
|
||||
{
|
||||
this.monday = MenuWeekModel.CalcFirstWeekDay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the menus for the week
|
||||
/// </summary>
|
||||
[XmlElement("Meal")]
|
||||
public ObservableCollection<MealModel> Meals { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WeekDay
|
||||
/// </summary>
|
||||
[XmlAttribute("day")]
|
||||
public string Day
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.dayName;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.dayName)
|
||||
{
|
||||
this.dayName = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets of Date
|
||||
/// </summary>
|
||||
[XmlAttribute("date")]
|
||||
public string Date
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.date.ToString();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.date)
|
||||
{
|
||||
this.date = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,11 @@ namespace CampusAppWP8.Model.Mensa
|
||||
/// Time when the model was created
|
||||
/// </summary>
|
||||
private readonly DateTime createTime;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MenuWeekModel" /> class.
|
||||
/// </summary>
|
||||
@@ -33,31 +37,28 @@ namespace CampusAppWP8.Model.Mensa
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
#region Proberty
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the menus for the week
|
||||
/// </summary>
|
||||
[XmlArray("BTU")]
|
||||
[XmlArrayItem("Tagesmenu")]
|
||||
[XmlArray("Mealplan")]
|
||||
[XmlArrayItem("Menu")]
|
||||
public ObservableCollection<MenuModel> Menus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Proberty
|
||||
/// <summary>
|
||||
/// Gets the creation time of the model
|
||||
/// </summary>
|
||||
public DateTime CreateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
public DateTime CreateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.createTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -28,9 +28,7 @@ namespace CampusAppWP8.Model.Openinghours
|
||||
/// <summary>
|
||||
/// Gets or sets feed information item list.
|
||||
/// </summary>
|
||||
[XmlArray("data")]
|
||||
[XmlArrayItem("institution")]
|
||||
public ObservableCollection<OpeninghoursInstitutionModel> institutions { get; set; }
|
||||
private ObservableCollection<OpeninghoursInstitutionModel> institutions;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -41,6 +39,7 @@ namespace CampusAppWP8.Model.Openinghours
|
||||
/// </summary>
|
||||
public OpeninghoursModel()
|
||||
{
|
||||
this.institutions = new ObservableCollection<OpeninghoursInstitutionModel>();
|
||||
this.createTime = DateTime.Now;
|
||||
}
|
||||
|
||||
@@ -60,20 +59,23 @@ namespace CampusAppWP8.Model.Openinghours
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Institutions.
|
||||
/// Gets or sets the Institutions.
|
||||
/// </summary>
|
||||
[XmlArray("data")]
|
||||
[XmlArrayItem("institution")]
|
||||
public ObservableCollection<OpeninghoursInstitutionModel> Institutions
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.institutions;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.institutions = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
70
CampusAppWP8/CampusAppWP8/Model/RSS/RSSChannelModel.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="RSSChannelModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.RSS
|
||||
{
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Channel Model, which contains the RSS feed item list.
|
||||
/// </summary>
|
||||
public class RSSChannelModel
|
||||
{
|
||||
/// <summary>
|
||||
/// RSS feed information item list.
|
||||
/// </summary>
|
||||
private ObservableCollection<RSSModel> item;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RSSChannelModel" /> class.
|
||||
/// </summary>
|
||||
public RSSChannelModel()
|
||||
{
|
||||
this.item = new ObservableCollection<RSSModel>();
|
||||
this.item.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RSS feed item list.
|
||||
/// </summary>
|
||||
[XmlElement("item")]
|
||||
public ObservableCollection<RSSModel> Item
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.item;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.item)
|
||||
{
|
||||
this.item = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is called when the item list has changed.
|
||||
/// Here used for the add event.
|
||||
/// Set the index of the last list element.
|
||||
/// </summary>
|
||||
/// <param name="sender">item list</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
ObservableCollection<RSSModel> list = sender as ObservableCollection<RSSModel>;
|
||||
|
||||
list[list.Count - 1].Index = list.Count - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
256
CampusAppWP8/CampusAppWP8/Model/RSS/RSSModel.cs
Normal file
@@ -0,0 +1,256 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="RSSModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.RSS
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Contains the RSS feed information.
|
||||
/// </summary>
|
||||
public class RSSModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Index of this object.
|
||||
/// </summary>
|
||||
private int index = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Title of the fees
|
||||
/// </summary>
|
||||
private string title;
|
||||
|
||||
/// <summary>
|
||||
/// Description text of the feed.
|
||||
/// </summary>
|
||||
private string text;
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp (publication date) of the event or news.
|
||||
/// </summary>
|
||||
private DateTime timestamp;
|
||||
|
||||
/// <summary>
|
||||
/// Url of the feed.
|
||||
/// </summary>
|
||||
private string link;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title of the feed.
|
||||
/// </summary>
|
||||
[XmlElement("title")]
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.title;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (this.title != value)
|
||||
{
|
||||
this.title = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the text of the feed.
|
||||
/// </summary>
|
||||
[XmlElement("description")]
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.text;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (this.text != this.HTMLUnicodeToString(value))
|
||||
{
|
||||
this.text = this.HTMLUnicodeToString(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp of the feed as string.
|
||||
/// </summary>
|
||||
[XmlElement("pubDate")]
|
||||
public string Timestamp
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.timestamp.ToString("R");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (this.timestamp != DateTime.Parse(value))
|
||||
{
|
||||
this.timestamp = DateTime.Parse(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp of the feed as DateTime object.
|
||||
/// </summary>
|
||||
public DateTime DTTimestamp
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.timestamp;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.timestamp = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date of the timestamp as string.
|
||||
/// example: Mon, 25.06.2013.
|
||||
/// </summary>
|
||||
public string Date
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0:ddd, dd.MM.yyyy}", this.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time of the timestamp as string.
|
||||
/// example: 12:56 Uhr.
|
||||
/// </summary>
|
||||
public string Time
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0:h:mm} Uhr", this.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the link/url of the feed.
|
||||
/// </summary>
|
||||
[XmlElement("link")]
|
||||
public string Link
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.link;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (this.link != value)
|
||||
{
|
||||
this.link = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ListIndex.
|
||||
/// </summary>
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.index;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.index = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Comparing function for DateTime timestamps.
|
||||
/// (currently unused)
|
||||
/// </summary>
|
||||
/// <param name="item1">first item</param>
|
||||
/// <param name="item2">second item</param>
|
||||
/// <returns>-1 if item2 is older then item1, otherwise 0</returns>
|
||||
public static int CompareTimeStamp(RSSModel item1, RSSModel item2)
|
||||
{
|
||||
if (item1.DTTimestamp > item2.DTTimestamp)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove or transform html-unicode specific tags into ASCII.
|
||||
/// </summary>
|
||||
/// <param name="htmluni">html string</param>
|
||||
/// <returns>ASCII string</returns>
|
||||
private string HTMLUnicodeToString(string htmluni)
|
||||
{
|
||||
StringBuilder retValue = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < htmluni.Length; i++)
|
||||
{
|
||||
switch (htmluni[i])
|
||||
{
|
||||
// beginning tag of the unicode
|
||||
case '&':
|
||||
int startOff = i + 2;
|
||||
//// sear closing tag of the unicode
|
||||
int endOff = htmluni.IndexOf(';', startOff);
|
||||
//// get and parse value inbetween
|
||||
string sub = htmluni.Substring(startOff, endOff - startOff);
|
||||
int charVal = int.Parse(sub);
|
||||
|
||||
switch (charVal)
|
||||
{
|
||||
// if the unicode value is 128 (€)
|
||||
case 128:
|
||||
retValue.Append('€');
|
||||
break;
|
||||
|
||||
default:
|
||||
retValue.Append((char)charVal);
|
||||
break;
|
||||
}
|
||||
|
||||
// set the current index to the end of the unicode tag
|
||||
i = endOff;
|
||||
break;
|
||||
|
||||
case '<':
|
||||
// ignoring <..> html tags
|
||||
i = htmluni.IndexOf('>', i);
|
||||
break;
|
||||
|
||||
case '\t':
|
||||
// removing tabs
|
||||
break;
|
||||
|
||||
default:
|
||||
// adding other characters to the return string
|
||||
retValue.Append(htmluni[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retValue.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
71
CampusAppWP8/CampusAppWP8/Model/RSS/RSSViewModel.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="RSSViewModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.RSS
|
||||
{
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel of the RSS feed, containing the feed/channel object.
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class RSSViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Object to store the time when the instance was created.
|
||||
/// </summary>
|
||||
private DateTime createTime;
|
||||
|
||||
/// <summary>
|
||||
/// Channel list for the RSS feeds.
|
||||
/// </summary>
|
||||
private ObservableCollection<RSSChannelModel> channel;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RSSViewModel" /> class.
|
||||
/// </summary>
|
||||
public RSSViewModel()
|
||||
{
|
||||
this.channel = new ObservableCollection<RSSChannelModel>();
|
||||
this.createTime = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the channel list.
|
||||
/// </summary>
|
||||
[XmlArray("rss")]
|
||||
[XmlArrayItem("channel")]
|
||||
public ObservableCollection<RSSChannelModel> Channel
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.channel)
|
||||
{
|
||||
this.channel = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the creation time.
|
||||
/// </summary>
|
||||
public DateTime CreateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.createTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
50
CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="AppSettings.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>08.08.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.Setting
|
||||
{
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Model for settings of the app
|
||||
/// </summary>
|
||||
public class AppSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the GeoWatch-Flag
|
||||
/// </summary>
|
||||
public bool GeoWatchEnable
|
||||
{
|
||||
get
|
||||
{
|
||||
return App.LoadFromAppState<bool>(Constants.AppSetting_GeoWatchEnable);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
App.SaveToAppState<bool>(Constants.AppSetting_GeoWatchEnable, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the InitializationApp-Flag
|
||||
/// </summary>
|
||||
public bool InitApp
|
||||
{
|
||||
get
|
||||
{
|
||||
return App.LoadFromAppState<bool>(Constants.AppSetting_GeoWatchEnable);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
App.SaveToAppState<bool>(Constants.AppSetting_GeoWatchEnable, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
258
CampusAppWP8/CampusAppWP8/Model/Setting/UserProfilModel.cs
Normal file
@@ -0,0 +1,258 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="UserProfilModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>23.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Setting
|
||||
{
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Model for the profile of an user
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class UserProfilModel
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// constant for the first validate semester
|
||||
/// </summary>
|
||||
private static readonly int FirstSemester = int.Parse(Constants.Valid_FirstSemseter);
|
||||
|
||||
/// <summary>
|
||||
/// constant for the last validate semester
|
||||
/// </summary>
|
||||
private static readonly int LastSemester = int.Parse(Constants.Valid_LastSemseter);
|
||||
|
||||
/// <summary>
|
||||
/// constant for the max. number of a validate course
|
||||
/// </summary>
|
||||
private static readonly int MaxCourseNumber = int.Parse(Constants.Valid_MaxCourseNumber);
|
||||
|
||||
/// <summary>
|
||||
/// constant for the default value of a semester
|
||||
/// </summary>
|
||||
private static readonly int DefaultSemester = int.Parse(Constants.Setting_DefaultSemester);
|
||||
|
||||
/// <summary>
|
||||
/// constant for the default value of a courseNumber
|
||||
/// </summary>
|
||||
private static readonly int DefaultCourseNumber = int.Parse(Constants.Setting_DefaultCourseNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Flag which indicates that any properties has been changed
|
||||
/// </summary>
|
||||
private bool changed = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the course of the user
|
||||
/// </summary>
|
||||
private int course = UserProfilModel.DefaultCourseNumber;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the role of the user
|
||||
/// </summary>
|
||||
private RoleType role = RoleType.STUDENT;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the degree of the user
|
||||
/// </summary>
|
||||
private DegreeType degree = DegreeType.BACHELOR;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the semester of the user
|
||||
/// </summary>
|
||||
private int semester = UserProfilModel.DefaultSemester;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Enums
|
||||
/// <summary>
|
||||
/// Specifies the degrees.
|
||||
/// </summary>
|
||||
public enum DegreeType
|
||||
{
|
||||
/// <summary>
|
||||
/// bachelor degree
|
||||
/// </summary>
|
||||
BACHELOR = 82,
|
||||
|
||||
/// <summary>
|
||||
/// master degree
|
||||
/// </summary>
|
||||
MASTER = 88,
|
||||
|
||||
/// <summary>
|
||||
/// diploma degree
|
||||
/// </summary>
|
||||
DIPLOM = 11
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the role of the user.
|
||||
/// </summary>
|
||||
public enum RoleType
|
||||
{
|
||||
/// <summary>
|
||||
/// for students (01).
|
||||
/// </summary>
|
||||
STUDENT = 1,
|
||||
|
||||
/// <summary>
|
||||
/// for staffs (10).
|
||||
/// </summary>
|
||||
STAFF = 2,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Proberties
|
||||
/// <summary>
|
||||
/// Gets or sets the course of the user
|
||||
/// </summary>
|
||||
[XmlElement("Course")]
|
||||
public int Course
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.course;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.course && this.ValditateCourse(value))
|
||||
{
|
||||
this.course = value;
|
||||
this.changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the role of the user
|
||||
/// </summary>
|
||||
[XmlElement("Role")]
|
||||
public RoleType Role
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.role;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.role)
|
||||
{
|
||||
this.role = value;
|
||||
this.changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the degree of the user
|
||||
/// </summary>
|
||||
[XmlElement("Degere")]
|
||||
public DegreeType Degree
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.degree;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.degree)
|
||||
{
|
||||
this.degree = value;
|
||||
this.changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the semester of the user
|
||||
/// </summary>
|
||||
[XmlElement("Semseter")]
|
||||
public int Semester
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.semester;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.semester && this.ValditateSemester(value))
|
||||
{
|
||||
this.semester = value;
|
||||
this.changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
#region public
|
||||
|
||||
/// <summary>
|
||||
/// Method return the changed flag
|
||||
/// </summary>
|
||||
/// <param name="reset"> if is true, set changed flag to false, otherwise do nothing (bypass)</param>
|
||||
/// <returns>return true, if any properties has changed, otherwise false</returns>
|
||||
public bool HasChanged(bool reset = true)
|
||||
{
|
||||
bool result = this.changed;
|
||||
|
||||
if (reset)
|
||||
{
|
||||
this.changed = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Methods check if a value could be a valid semester
|
||||
/// </summary>
|
||||
/// <param name="possibleSemester">value which has to be checked</param>
|
||||
/// <returns>true if it is an valid semester, otherwise false</returns>
|
||||
private bool ValditateSemester(int possibleSemester)
|
||||
{
|
||||
if (possibleSemester < UserProfilModel.FirstSemester || possibleSemester > UserProfilModel.LastSemester)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Methods check if a value could be a valid course
|
||||
/// </summary>
|
||||
/// <param name="possibleCourse">value which has to be checked</param>
|
||||
/// <returns>true if it is an valid course, otherwise false</returns>
|
||||
private bool ValditateCourse(int possibleCourse)
|
||||
{
|
||||
if (possibleCourse > UserProfilModel.MaxCourseNumber)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="StudentCouncilListModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>02.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.StudentCouncil
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Model for menus in one week
|
||||
/// </summary>
|
||||
[XmlRoot("root")]
|
||||
public class StudentCouncilListModel
|
||||
{
|
||||
#region Members
|
||||
/// <summary>
|
||||
/// Time when the model was created
|
||||
/// </summary>
|
||||
private readonly DateTime createTime;
|
||||
|
||||
#endregion
|
||||
#region Constructor
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StudentCouncilListModel" /> class.
|
||||
/// </summary>
|
||||
public StudentCouncilListModel()
|
||||
{
|
||||
this.createTime = DateTime.Now;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Proberty
|
||||
/// <summary>
|
||||
/// Gets or sets the StudentCouncils
|
||||
/// </summary>
|
||||
[XmlArray("data")]
|
||||
[XmlArrayItem("studentcouncil")]
|
||||
public ObservableCollection<StudentCouncilModel> StudentCouncils { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the creation time of the model
|
||||
/// </summary>
|
||||
public DateTime CreateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.createTime;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
/// <summary>
|
||||
/// Method group the StudentCouncilList by Faculty
|
||||
/// </summary>
|
||||
/// <returns>a Dictionary, where the Key is name of the Faculty und the value is a List of StudentCouncil</returns>
|
||||
public Dictionary<string, List<StudentCouncilModel>> GetStudentCouncilsGroupByFaculty()
|
||||
{
|
||||
List<IGrouping<string, StudentCouncilModel>> tmpList = this.StudentCouncils.GroupBy(p => p.Faculty).ToList();
|
||||
Dictionary<string, List<StudentCouncilModel>> itemMap = new Dictionary<string, List<StudentCouncilModel>>();
|
||||
foreach (IGrouping<string, StudentCouncilModel> group in tmpList)
|
||||
{
|
||||
Dictionary<string, List<StudentCouncilModel>> tempDic = new Dictionary<string, List<StudentCouncilModel>>();
|
||||
itemMap.Add(group.Key, group.ToList());
|
||||
}
|
||||
|
||||
return itemMap;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="StudentCouncilModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>02.07.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.StudentCouncil
|
||||
{
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Model for menu
|
||||
/// </summary>
|
||||
public class StudentCouncilModel
|
||||
{
|
||||
#region Member
|
||||
|
||||
/// <summary>
|
||||
/// name of the faculty.
|
||||
/// </summary>
|
||||
private string faculty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StudentCouncilModel" /> class.
|
||||
/// </summary>
|
||||
public StudentCouncilModel()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the faculty of the StudentCouncil.
|
||||
/// </summary>
|
||||
[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the StudentCouncil.
|
||||
/// </summary>
|
||||
[XmlAttribute("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the webpage-url of the StudentCouncil.
|
||||
/// </summary>
|
||||
[XmlAttribute("url")]
|
||||
public string Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the email-address of the StudentCouncil.
|
||||
/// </summary>
|
||||
[XmlAttribute("email")]
|
||||
public string Email { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="CleanUrlParamModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>06.08.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Utility
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is a Model for the URLParameter like GET-Parameter
|
||||
/// </summary>
|
||||
public class CleanUrlParamModel:UrlParamModel
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UrlParamModel" /> class.
|
||||
/// </summary>
|
||||
/// <param name="key">the key for the parameter</param>
|
||||
public CleanUrlParamModel(string key) :base(key)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UrlParamModel" /> class.
|
||||
/// </summary>
|
||||
/// <param name="key">the key for the parameter</param>>
|
||||
/// <param name="value">value of the parameter</param>
|
||||
public CleanUrlParamModel(string key, string value) : base(key,value)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Proberty
|
||||
|
||||
/// <summary>
|
||||
/// Gets the token, which indicate that the parameterList started
|
||||
/// </summary>
|
||||
public override string ParamToken
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Method return a formatted string like Key=Value
|
||||
/// </summary>
|
||||
/// <returns> return formatted string</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
if (!this.IsParamValid())
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return "/" + this.key + "/" + this.Value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
// <copyright file="CourseListPickerItemListModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.List
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>25.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Utility
|
||||
{
|
||||
using System.Linq;
|
||||
|
||||
/// <summary>
|
||||
/// This is a class for the courseList
|
||||
/// </summary>
|
||||
public class CourseListPickerItemListModel : ListPickerItemListModel
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CourseListPickerItemListModel" /> class.
|
||||
/// </summary>
|
||||
public CourseListPickerItemListModel()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the LoadList-Method <see cref="ListPickerItemListModel"/>
|
||||
/// </summary>
|
||||
protected override void LoadList()
|
||||
{
|
||||
this.AddItem(new ListPickerItemModel("013", "Architektur"));
|
||||
this.AddItem(new ListPickerItemModel("017", "Bauingenieurwesen"));
|
||||
this.AddItem(new ListPickerItemModel("021", "Betriebswirtschaftslehre"));
|
||||
this.AddItem(new ListPickerItemModel("042", "Wirtschaftsrecht für Technologieunternehmen"));
|
||||
this.AddItem(new ListPickerItemModel("048", "Elektrotechnik"));
|
||||
this.AddItem(new ListPickerItemModel("079", "Informatik "));
|
||||
this.AddItem(new ListPickerItemModel("104", "Maschinenbau"));
|
||||
this.AddItem(new ListPickerItemModel("105", "Mathematik"));
|
||||
this.AddItem(new ListPickerItemModel("128", "Physik "));
|
||||
this.AddItem(new ListPickerItemModel("179", "Wirtschaftsingenieurwesen"));
|
||||
this.AddItem(new ListPickerItemModel("184", "Wirtschaftswissenschaften "));
|
||||
this.AddItem(new ListPickerItemModel("215", "Biomedizinische Gerätetechnik "));
|
||||
this.AddItem(new ListPickerItemModel("226", "Verfahrenstechnik"));
|
||||
this.AddItem(new ListPickerItemModel("276", "Wirtschaftsmathematik "));
|
||||
this.AddItem(new ListPickerItemModel("711", "Kultur und Technik "));
|
||||
this.AddItem(new ListPickerItemModel("744", "Physik der Halbleiter-Technologie"));
|
||||
this.AddItem(new ListPickerItemModel("749", "Angewandte Mathematik "));
|
||||
this.AddItem(new ListPickerItemModel("764", "Technologie- und Innovationsmanagement"));
|
||||
this.AddItem(new ListPickerItemModel("766", "Stadt- und Regionalplanung"));
|
||||
this.AddItem(new ListPickerItemModel("767", "Informations- und Medientechnik "));
|
||||
this.AddItem(new ListPickerItemModel("768", "World Heritage Studies"));
|
||||
this.AddItem(new ListPickerItemModel("770", "Umweltingenieurwesen und Verfahrenstechnik"));
|
||||
this.AddItem(new ListPickerItemModel("771", "Environmental and Resource Management"));
|
||||
this.AddItem(new ListPickerItemModel("772", "Landnutzung und Wasserbewirtschaftung"));
|
||||
this.AddItem(new ListPickerItemModel("773", "Bauen und Erhalten"));
|
||||
this.AddItem(new ListPickerItemModel("774", "Umweltingenieurwesen"));
|
||||
this.AddItem(new ListPickerItemModel("794", "eBusiness"));
|
||||
this.AddItem(new ListPickerItemModel("798", "Civil Engineering"));
|
||||
this.AddItem(new ListPickerItemModel("799", "Structural Engineering"));
|
||||
this.AddItem(new ListPickerItemModel("800", "Electrical Power Engineering "));
|
||||
this.AddItem(new ListPickerItemModel("841", "Euro Hydroinformatics and Water Management"));
|
||||
this.AddItem(new ListPickerItemModel("842", "Technologien Biogener Rohstoffe"));
|
||||
this.AddItem(new ListPickerItemModel("843", "Environmental Technologies"));
|
||||
this.AddItem(new ListPickerItemModel("844", "Process Engineering and Plant Design"));
|
||||
this.AddItem(new ListPickerItemModel("845", "Architekturvermittlung"));
|
||||
this.AddItem(new ListPickerItemModel("851", "Nachwachsende Rohstoffe und Erneuerbare Energien"));
|
||||
this.AddItem(new ListPickerItemModel("852", "Energieträger aus Biomasse und Abfällen"));
|
||||
this.AddItem(new ListPickerItemModel("853", "Power Engineering"));
|
||||
this.AddItem(new ListPickerItemModel("857", "Verfahrenstechnik - Prozess- und Anlagentechnik"));
|
||||
this.AddItem(new ListPickerItemModel("858", "Architektur.Studium.Generale"));
|
||||
this.AddItem(new ListPickerItemModel("860", "Verarbeitungstechnologien der Werkstoffe"));
|
||||
this.AddItem(new ListPickerItemModel("871", "Forensic Sciences and Engineering"));
|
||||
this.List = this.List.OrderBy(o => o.Text).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// <copyright file="DegreeListPickerItemListModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.List
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>25.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Utility
|
||||
{
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// This Class creates a list of degrees
|
||||
/// </summary>
|
||||
public class DegreeListPickerItemListModel : ListPickerItemListModel
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DegreeListPickerItemListModel" /> class.
|
||||
/// </summary>
|
||||
public DegreeListPickerItemListModel()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the LoadList-Method <see cref="ListPickerItemListModel"/>
|
||||
/// </summary>
|
||||
protected override void LoadList()
|
||||
{
|
||||
this.AddItem(new ListPickerItemModel(((int)CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.BACHELOR).ToString(), AppResources.Degree_Bachelor));
|
||||
this.AddItem(new ListPickerItemModel(((int)CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.MASTER).ToString(), AppResources.Degree_Master));
|
||||
this.AddItem(new ListPickerItemModel(((int)CampusAppWP8.Model.Setting.UserProfilModel.DegreeType.DIPLOM).ToString(), AppResources.Degree_Diploma));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="ListPickerItemListModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.List
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>25.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Utility
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Class for a List of ListPickerItems
|
||||
/// </summary>
|
||||
public class ListPickerItemListModel
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// reference of the itemList
|
||||
/// </summary>
|
||||
private List<ListPickerItemModel> list;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ListPickerItemListModel" /> class.
|
||||
/// </summary>
|
||||
public ListPickerItemListModel()
|
||||
{
|
||||
this.list = new List<ListPickerItemModel>();
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ItemList
|
||||
/// </summary>
|
||||
public List<ListPickerItemModel> List
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.list;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.list)
|
||||
{
|
||||
this.list = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region public
|
||||
|
||||
/// <summary>
|
||||
/// Method return a the Index of an item which has a certain value
|
||||
/// </summary>
|
||||
/// <param name="value">a certain value</param>
|
||||
/// <returns>return index of value or default(0)</returns>
|
||||
public virtual int GetIndexOrDefault(string value)
|
||||
{
|
||||
int index = 0;
|
||||
int i = 0;
|
||||
foreach (ListPickerItemModel item in this.list)
|
||||
{
|
||||
if (item.Value.Equals(value))
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add an new item to the list
|
||||
/// </summary>
|
||||
/// <param name="value">value of the item</param>
|
||||
/// <param name="text">text of the item</param>
|
||||
public void AddItem(string value, string text)
|
||||
{
|
||||
this.AddItem(new ListPickerItemModel(value, text));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add an new item to the list
|
||||
/// </summary>
|
||||
/// <param name="item">new item of the list</param>
|
||||
public void AddItem(ListPickerItemModel item)
|
||||
{
|
||||
this.list.Add(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// remove an item
|
||||
/// </summary>
|
||||
/// <param name="value">value of the item</param>
|
||||
/// <param name="text">text of the item</param>
|
||||
/// <returns>true if removing was successful, otherwise false</returns>
|
||||
public bool RemoveItem(string value, string text)
|
||||
{
|
||||
return this.RemoveItem(new ListPickerItemModel(value, text));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// remove an item
|
||||
/// </summary>
|
||||
/// <param name="item">item which has to be remove</param>
|
||||
/// <returns>true if removing was successful, otherwise false</returns>
|
||||
public bool RemoveItem(ListPickerItemModel item)
|
||||
{
|
||||
return this.list.Remove(item);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Method load an default list
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// load an empty list
|
||||
/// </remarks>
|
||||
protected virtual void LoadList()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,24 @@ namespace CampusAppWP8.Model.Utility
|
||||
/// </summary>
|
||||
public class ListPickerItemModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ListPickerItemModel" /> class.
|
||||
/// </summary>
|
||||
public ListPickerItemModel()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ListPickerItemModel" /> class.
|
||||
/// </summary>
|
||||
/// <param name="value">string for the value property of an item</param>
|
||||
/// <param name="text">string for the text property of an item</param>
|
||||
public ListPickerItemModel(string value, string text)
|
||||
{
|
||||
this.Value = value;
|
||||
this.Text = text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Value of an Item
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// <copyright file="RoleListPickerItemListModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.List
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>25.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Utility
|
||||
{
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the RoleList
|
||||
/// </summary>
|
||||
public class RoleListPickerItemListModel : ListPickerItemListModel
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RoleListPickerItemListModel" /> class.
|
||||
/// </summary>
|
||||
public RoleListPickerItemListModel()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the LoadList-Method <see cref="ListPickerItemListModel"/>
|
||||
/// </summary>
|
||||
protected override void LoadList()
|
||||
{
|
||||
this.AddItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.RoleType.STUDENT.ToString(), AppResources.Setting_RoleStudent));
|
||||
this.AddItem(new ListPickerItemModel(CampusAppWP8.Model.Setting.UserProfilModel.RoleType.STAFF.ToString(), AppResources.Setting_RoleStaff));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// <copyright file="SemesterListPickerItemListModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.List
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>25.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Utility
|
||||
{
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the SemesterList
|
||||
/// </summary>
|
||||
public class SemesterListPickerItemListModel : ListPickerItemListModel
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SemesterListPickerItemListModel" /> class.
|
||||
/// </summary>
|
||||
public SemesterListPickerItemListModel()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the LoadList-Method <see cref="ListPickerItemListModel"/>
|
||||
/// </summary>
|
||||
protected override void LoadList()
|
||||
{
|
||||
this.AddItem(new ListPickerItemModel("20131", "SoSe 13"));
|
||||
this.AddItem(new ListPickerItemModel("20132", "WiSe 13/14"));
|
||||
this.AddItem(new ListPickerItemModel("20141", "SoSe 14"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace CampusAppWP8.Model.Utility
|
||||
/// <summary>
|
||||
/// Variable of the key
|
||||
/// </summary>
|
||||
private readonly string key;
|
||||
protected readonly string key;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace CampusAppWP8.Model.Utility
|
||||
this.Value = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Proberty
|
||||
|
||||
/// <summary>
|
||||
@@ -60,6 +61,17 @@ namespace CampusAppWP8.Model.Utility
|
||||
return this.key;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the token, which indicate that the parameterList started
|
||||
/// </summary>
|
||||
public virtual string ParamToken
|
||||
{
|
||||
get
|
||||
{
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
89
CampusAppWP8/CampusAppWP8/Model/XmlModel.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="XmlModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>05.07.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model
|
||||
{
|
||||
using System.Text;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Xml model io handler class.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">model type</typeparam>
|
||||
public class XmlModel<T> : MainModel<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="XmlModel{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="modelType">model io type</param>
|
||||
/// <param name="fileName">filename of the data file</param>
|
||||
/// <param name="url">url of the feed data</param>
|
||||
public XmlModel(ModelType modelType, string fileName, string url)
|
||||
: base(modelType, fileName, url)
|
||||
{
|
||||
this.ValidRootName = Constants.XMLRootElementName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="XmlModel{T}" /> class.
|
||||
/// Use only if the model io type is file or feed, not both.
|
||||
/// </summary>
|
||||
/// <param name="modelType">model io type</param>
|
||||
/// <param name="sourceName">name of the file or the url of the feed</param>
|
||||
public XmlModel(ModelType modelType, string sourceName)
|
||||
: base(modelType, sourceName)
|
||||
{
|
||||
this.ValidRootName = Constants.XMLRootElementName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets for the name of the root-tag
|
||||
/// </summary>
|
||||
protected string ValidRootName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create the model from a xml byte array.
|
||||
/// </summary>
|
||||
/// <param name="modelData">model data</param>
|
||||
/// <returns>true, if succeeded</returns>
|
||||
protected override bool DeserializeModel(byte[] modelData)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
string data = Encoding.UTF8.GetString(modelData, 0, modelData.Length);
|
||||
|
||||
T tempModel = XmlManager.DeserializationToModel<T>(data, this.ValidRootName);
|
||||
if (tempModel != null)
|
||||
{
|
||||
this.Model = tempModel;
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the model to a byte array.
|
||||
/// </summary>
|
||||
/// <returns>model data</returns>
|
||||
protected override byte[] SerializeModel()
|
||||
{
|
||||
byte[] retValue = null;
|
||||
|
||||
if (this.Model != null)
|
||||
{
|
||||
retValue = Encoding.UTF8.GetBytes(XmlManager.SerializationToString<T>(this.Model));
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Model.Campusmap;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using System.Windows.Media;
|
||||
using CampusAppWP8.Model.Campusmap;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace CampusAppWP8.Pages.Campusmap
|
||||
{
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.Pages.Departments.DepartmentFavoritePage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
|
||||
<StackPanel Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Favorites, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
|
||||
<ListBox x:Name="ContentPanel" ItemsSource="{Binding Chairs}" Grid.Row="1" Margin="12,0,12,0">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<!--chair main button-->
|
||||
<Button Tag="{Binding Url}" Click="ChairTB_Click" HorizontalContentAlignment="Left">
|
||||
<TextBlock Text="{Binding Name}" HorizontalAlignment="Stretch" TextWrapping="Wrap" FontSize="24"/>
|
||||
</Button>
|
||||
<StackPanel Visibility="Collapsed">
|
||||
<!--delete button-->
|
||||
<Button BorderBrush="Transparent" Tag="{Binding Name}" Click="DeleteBtn_Click" HorizontalContentAlignment="Left">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="64"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="0" Grid.Row="0" Height="32" Width="32" Source="{Binding Path=ThemelizedIcon.Delete, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=LocalizedResources.Delete, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Button>
|
||||
<!--info button-->
|
||||
<Button x:Name="InfoBtn" BorderBrush="Transparent" Tag="{Binding Url}" Click="InfoBtn_Click" HorizontalContentAlignment="Left">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="64"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="0" Grid.Row="0" Height="32" Width="32" Source="{Binding Path=ThemelizedIcon.Info, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=LocalizedResources.Info, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -0,0 +1,166 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="DepartmentFavoritePage.xaml.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>01.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Departments
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Model.Departments;
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Page to visualize the favorite department list.
|
||||
/// </summary>
|
||||
public partial class DepartmentFavoritePage : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Object to store the last clicked chair button.
|
||||
/// </summary>
|
||||
private FrameworkElement lastClickedBtn = null;
|
||||
|
||||
/// <summary>
|
||||
/// For checking if instance is back from tombstone.
|
||||
/// </summary>
|
||||
private bool isNewInstance = false;
|
||||
|
||||
/// <summary>
|
||||
/// For checking if the source of the list is set.
|
||||
/// </summary>
|
||||
private bool isSourceSet = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DepartmentFavoritePage" /> class.
|
||||
/// </summary>
|
||||
public DepartmentFavoritePage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
this.isNewInstance = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On navigation to this page.
|
||||
/// Initialize the list source.
|
||||
/// </summary>
|
||||
/// <param name="e">event args</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
if (this.isNewInstance)
|
||||
{
|
||||
if ((DepartmentIndexPage.FavoriteFeed == null) || (DepartmentIndexPage.FavoriteFeed.GetModel() == null))
|
||||
{
|
||||
DepartmentModel tempModel = null;
|
||||
|
||||
if ((tempModel = App.LoadFromIsolatedStorage<DepartmentModel>(Constants.IsolatedStorage_DepartmentFavoriteModel)) != null)
|
||||
{
|
||||
if (DepartmentIndexPage.FavoriteFeed == null)
|
||||
{
|
||||
DepartmentIndexPage.FavoriteFeed = new Feed.Departments.DepartmentFavoriteFeed(false);
|
||||
}
|
||||
|
||||
DepartmentIndexPage.FavoriteFeed.Model = tempModel;
|
||||
this.isSourceSet = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.isNewInstance = false;
|
||||
}
|
||||
|
||||
if (this.isSourceSet == false)
|
||||
{
|
||||
this.ContentPanel.ItemsSource = DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].Chairs;
|
||||
this.isSourceSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedFrom function.
|
||||
/// </summary>
|
||||
/// <param name="e">event args</param>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedFrom(e);
|
||||
|
||||
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
|
||||
{
|
||||
App.SaveToIsolatedStorage<DepartmentModel>(Constants.IsolatedStorage_DepartmentFavoriteModel, DepartmentIndexPage.FavoriteFeed.GetModel());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking on a chair button.
|
||||
/// Open or close the chair details.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void ChairTB_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FrameworkElement tempBtn = sender as FrameworkElement;
|
||||
StackPanel tempParent = null;
|
||||
|
||||
if (tempBtn == this.lastClickedBtn)
|
||||
{
|
||||
tempParent = this.lastClickedBtn.Parent as StackPanel;
|
||||
tempParent.Children[1].Visibility = Visibility.Collapsed;
|
||||
this.lastClickedBtn = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.lastClickedBtn != null)
|
||||
{
|
||||
tempParent = this.lastClickedBtn.Parent as StackPanel;
|
||||
tempParent.Children[1].Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
tempParent = tempBtn.Parent as StackPanel;
|
||||
tempParent.Children[1].Visibility = Visibility.Visible;
|
||||
|
||||
this.lastClickedBtn = tempBtn;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking on a delete button.
|
||||
/// Removes the chair from the favorite list.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void DeleteBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Button btn = this.lastClickedBtn as Button;
|
||||
TextBlock btnText = btn.Content as TextBlock;
|
||||
|
||||
if (DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].RemoveChair(btnText.Text) == true)
|
||||
{
|
||||
MessageBox.Show(AppResources.DeleteSucceeded);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(AppResources.DeleteFailed);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking on a info button.
|
||||
/// Open a department info page.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void InfoBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FrameworkElement infoBtn = sender as FrameworkElement;
|
||||
string chairName = ((this.lastClickedBtn as Button).Content as TextBlock).Text.ToString();
|
||||
|
||||
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentInfoPage + "?url=" + infoBtn.Tag.ToString() + "&name=" + chairName, UriKind.Relative));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.Pages.Departments.DepartmentIndexPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
|
||||
<StackPanel Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.DepartmentApp_Title, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
|
||||
<ListBox x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<!--favorite button-->
|
||||
<Button x:Name="Favorite" Click="FavoriteBtn_Click" HorizontalContentAlignment="Left">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="64"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Image Width="32" Height="32" Grid.Row="0" Grid.Column="0" Source="{Binding Path=ThemelizedIcon.Favorite, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=LocalizedResources.Favorites, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</ListBox>
|
||||
<!--faculty button list-->
|
||||
<ListBox x:Name="FacultyList" Grid.Row="2" Margin="12,0,12,0">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!--faculty button-->
|
||||
<Button Tag="{Binding Id}" Click="FacultyBtn_Click" HorizontalContentAlignment="Left">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="64"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Image Width="32" Height="32" Grid.Row="0" Grid.Column="0" Source="{Binding Path=ThemelizedIcon.Departments, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Name}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
<lui:UpdateButtonAppBar Click="DeptForceUpdate_Click"/>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -0,0 +1,209 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="DepartmentIndexPage.xaml.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Departments
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Feed.Departments;
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Page with a list of the faculties.
|
||||
/// </summary>
|
||||
public partial class DepartmentIndexPage : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Department/chair feed object, storing the model and data.
|
||||
/// </summary>
|
||||
private static DepartmentFeed feed = null;
|
||||
|
||||
/// <summary>
|
||||
/// Department feed object for storing the favorite list.
|
||||
/// </summary>
|
||||
private static DepartmentFavoriteFeed favorite = null;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DepartmentIndexPage" /> class.
|
||||
/// </summary>
|
||||
public DepartmentIndexPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
//// init feed objects
|
||||
if (DepartmentIndexPage.feed == null)
|
||||
{
|
||||
DepartmentIndexPage.feed = new DepartmentFeed(false);
|
||||
}
|
||||
|
||||
DepartmentIndexPage.feed.onLoaded += new DepartmentFeed.OnLoaded(this.SetupFacultyList);
|
||||
DepartmentIndexPage.feed.LoadData();
|
||||
|
||||
if (DepartmentIndexPage.favorite == null)
|
||||
{
|
||||
DepartmentIndexPage.favorite = new DepartmentFavoriteFeed(false);
|
||||
}
|
||||
|
||||
DepartmentIndexPage.favorite.onLoaded += new DepartmentFavoriteFeed.OnLoaded(this.CheckFavoriteFeed);
|
||||
DepartmentIndexPage.favorite.LoadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the feed object.
|
||||
/// </summary>
|
||||
public static DepartmentFeed Feed
|
||||
{
|
||||
get
|
||||
{
|
||||
return DepartmentIndexPage.feed;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != DepartmentIndexPage.feed)
|
||||
{
|
||||
DepartmentIndexPage.feed = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the favorite feed object.
|
||||
/// </summary>
|
||||
public static DepartmentFavoriteFeed FavoriteFeed
|
||||
{
|
||||
get
|
||||
{
|
||||
return DepartmentIndexPage.favorite;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (DepartmentIndexPage.favorite != value)
|
||||
{
|
||||
DepartmentIndexPage.favorite = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the feed object of the departments.
|
||||
/// </summary>
|
||||
/// <returns>feed object</returns>
|
||||
public static DepartmentFeed GetFeed()
|
||||
{
|
||||
return DepartmentIndexPage.feed; // DepartmentIndexPage.feed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the feed object of the favorite departments.
|
||||
/// </summary>
|
||||
/// <returns>feed object</returns>
|
||||
public static DepartmentFavoriteFeed GetFavoriteFeed()
|
||||
{
|
||||
return DepartmentIndexPage.favorite; // DepartmentIndexPage.favorite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On navigation to this page.
|
||||
/// Initialize the feed loading.
|
||||
/// </summary>
|
||||
/// <param name="e">event args</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
if (NavigationMode.Back != e.NavigationMode)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On navigation from this page.
|
||||
/// Store the favorite list.
|
||||
/// </summary>
|
||||
/// <param name="e">event args</param>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
if (NavigationMode.Back == e.NavigationMode)
|
||||
{
|
||||
DepartmentIndexPage.favorite.SaveData();
|
||||
}
|
||||
|
||||
base.OnNavigatedFrom(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On orientation changed.
|
||||
/// </summary>
|
||||
/// <param name="sender">sender object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup the faculty list.
|
||||
/// </summary>
|
||||
private void SetupFacultyList()
|
||||
{
|
||||
this.FacultyList.ItemsSource = DepartmentIndexPage.feed.GetModel().Faculties;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the favorite feed is valid.
|
||||
/// </summary>
|
||||
private void CheckFavoriteFeed()
|
||||
{
|
||||
if (DepartmentIndexPage.favorite.GetModel() == null)
|
||||
{
|
||||
DepartmentIndexPage.favorite.Model = new Model.Departments.DepartmentModel();
|
||||
}
|
||||
|
||||
if (DepartmentIndexPage.favorite.GetModel().Faculties.Count() == 0)
|
||||
{
|
||||
DepartmentIndexPage.favorite.Model.Faculties.Add(new Model.Departments.FacultyModel("favorites"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking on the favorite button.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void FavoriteBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentFavoritePage, UriKind.Relative));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking on a faculty button.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void FacultyBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FrameworkElement tempElem = sender as FrameworkElement;
|
||||
|
||||
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentPage + "?pivotindex=" + tempElem.Tag, UriKind.Relative));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking the update button in the ApplicationBar.
|
||||
/// Force a data update from the web.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void DeptForceUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
DepartmentIndexPage.feed.ForceWebUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.Pages.Departments.DepartmentInfoPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
|
||||
OrientationChanged="PhoneApplicationPage_OrientationChanged"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--title-->
|
||||
<StackPanel Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.DepartmentApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
<TextBlock x:Name="PageHeadline" Text="Seitenname" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontSize="36" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--webbrowser-->
|
||||
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
|
||||
<phone:WebBrowser x:Name="WebBrowser" Grid.Row="0" IsScriptEnabled="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -0,0 +1,56 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="DepartmentInfoPage.xaml.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>01.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Departments
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Info page of a chair.
|
||||
/// </summary>
|
||||
public partial class DepartmentInfoPage : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DepartmentInfoPage" /> class.
|
||||
/// </summary>
|
||||
public DepartmentInfoPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On navigation to this page.
|
||||
/// Initialize the page headline text.
|
||||
/// </summary>
|
||||
/// <param name="e">event args</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
string url = string.Empty;
|
||||
string chairName = string.Empty;
|
||||
|
||||
if (NavigationContext.QueryString.TryGetValue("url", out url)
|
||||
&& NavigationContext.QueryString.TryGetValue("name", out chairName))
|
||||
{
|
||||
this.PageHeadline.Text = chairName;
|
||||
this.WebBrowser.Navigate(new Uri(url, UriKind.Absolute));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On orientation changed.
|
||||
/// </summary>
|
||||
/// <param name="sender">sender object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,13 +15,10 @@
|
||||
OrientationChanged="PhoneApplicationPage_OrientationChanged"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<phone:PhoneApplicationPage.Resources>
|
||||
<viewModel:DepartmentViewModel x:Key="DepartmentViewModel" x:Name="DepartmentView" />
|
||||
</phone:PhoneApplicationPage.Resources>
|
||||
<!-- LayoutRoot -->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.DataContext>
|
||||
<viewModel:DepartmentViewModel />
|
||||
<viewModel:DepartmentModel />
|
||||
</Grid.DataContext>
|
||||
<!-- Pivot -->
|
||||
<phone:Pivot x:Name="DepartmentPivot" Title="{Binding Path=LocalizedResources.DepartmentApp_Title, Source={StaticResource LocalizedStrings}}" ItemsSource="{Binding Faculties}">
|
||||
@@ -33,30 +30,50 @@
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!-- TEMPORARILY REMOVED, will be abck in soon
|
||||
<phone:LongListSelector ItemsSource="{Binding Faculties}">
|
||||
<phone:LongListSelector.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<Button x:Name="DepartmentBtn" Content="{Binding Name}" Background="Gray" BorderBrush="Gray" Foreground="Black" Click="DepartmentBtn_Click"/>
|
||||
<phone:LongListSelector Tag="{Binding Name}" Visibility="{Binding Visible}" ItemsSource="{Binding Chairs}">
|
||||
-->
|
||||
<ListBox ItemsSource="{Binding Chairs}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock x:Name="ChairTB" Tag="{Binding Url}" Text="{Binding Name_DE}" MouseLeftButtonDown="ChairTB_Click" Margin="12,6,12,6" Padding="0,0,0,0" HorizontalAlignment="Stretch" TextWrapping="Wrap" FontSize="24"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<!--
|
||||
<ListBox ItemsSource="{Binding Chairs}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<!--chair button-->
|
||||
<Button Tag="{Binding Url}" Click="ChairTB_Click" HorizontalContentAlignment="Left">
|
||||
<TextBlock Text="{Binding Name}" HorizontalAlignment="Stretch" TextWrapping="Wrap" FontSize="24"/>
|
||||
</Button>
|
||||
<StackPanel Visibility="Collapsed">
|
||||
<!--add to favorite button-->
|
||||
<Button BorderBrush="Transparent" Tag="{Binding Name}" Click="AddBtn_Click" HorizontalContentAlignment="Left">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="64"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="0" Grid.Row="0" Height="32" Width="32" Source="{Binding Path=ThemelizedIcon.Add, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=LocalizedResources.Add, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Button>
|
||||
<!--info button-->
|
||||
<Button x:Name="InfoBtn" BorderBrush="Transparent" Tag="{Binding Url}" Click="InfoBtn_Click" HorizontalContentAlignment="Left">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="64"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="0" Grid.Row="0" Height="32" Width="32" Source="{Binding Path=ThemelizedIcon.Info, Source={StaticResource ThemelizedIcons}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=LocalizedResources.Info, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</phone:LongListSelector.ItemTemplate>
|
||||
</phone:LongListSelector>
|
||||
-->
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -1,130 +1,192 @@
|
||||
using CampusAppWP8.Api.Departments;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Tasks;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="DepartmentPage.xaml.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Departments
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Model.Departments;
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Pivot page with list of the chairs of the facultis.
|
||||
/// Pivot page with list of the chairs of the faculties.
|
||||
/// </summary>
|
||||
public partial class DepartmentPage : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores the last visible department panel.
|
||||
/// For checking, if the source of the list is already set.
|
||||
/// </summary>
|
||||
private UIElement lastVisibleUIElem = null;
|
||||
private bool isSourceSet = false;
|
||||
|
||||
/// <summary>
|
||||
/// department/chair feed object, storing the model and data.
|
||||
/// Last clicked button object.
|
||||
/// </summary>
|
||||
private DepartmentFeed feed { get; set; }
|
||||
|
||||
private FrameworkElement lastClickedBtn = null;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// For checking of the instance is back from tombstone.
|
||||
/// </summary>
|
||||
private bool isNewInstance = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DepartmentPage" /> class.
|
||||
/// </summary>
|
||||
public DepartmentPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
// init feed object
|
||||
this.feed = new DepartmentFeed();
|
||||
this.InitializeComponent();
|
||||
|
||||
this.isNewInstance = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On naviagtion to this page.
|
||||
/// Init the feed loading.
|
||||
/// On navigation to this page.
|
||||
/// Initialize the feed loading.
|
||||
/// </summary>
|
||||
/// <param name="e">event args</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(SetupDepartmentPivot);
|
||||
this.feed.LoadFeed();
|
||||
if (this.isNewInstance)
|
||||
{
|
||||
if ((DepartmentIndexPage.Feed == null) || (DepartmentIndexPage.Feed.GetModel() == null))
|
||||
{
|
||||
DepartmentModel tempModel = null;
|
||||
|
||||
if ((tempModel = App.LoadFromIsolatedStorage<DepartmentModel>(Constants.IsolatedStorage_DepartmentModel)) != null)
|
||||
{
|
||||
if (DepartmentIndexPage.Feed == null)
|
||||
{
|
||||
DepartmentIndexPage.Feed = new Feed.Departments.DepartmentFeed(false);
|
||||
}
|
||||
|
||||
DepartmentIndexPage.Feed.Model = tempModel;
|
||||
this.isSourceSet = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.isNewInstance = false;
|
||||
}
|
||||
|
||||
if (this.isSourceSet == false)
|
||||
{
|
||||
this.DepartmentPivot.ItemsSource = DepartmentIndexPage.GetFeed().GetModel().Faculties;
|
||||
this.isSourceSet = true;
|
||||
}
|
||||
|
||||
string pivotIndex = string.Empty;
|
||||
|
||||
// Navigate to the selected pivotitem
|
||||
if (NavigationContext.QueryString.TryGetValue("pivotindex", out pivotIndex))
|
||||
{
|
||||
int pivotIndexInt = int.Parse(pivotIndex) - 1;
|
||||
|
||||
// if the index is in the range of the array
|
||||
if ((pivotIndexInt >= 0) && (pivotIndexInt < DepartmentIndexPage.GetFeed().GetModel().Faculties.Count()))
|
||||
{
|
||||
DepartmentPivot.SelectedIndex = pivotIndexInt;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("ERROR: pivotIndex out of range!!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called after the feeds are loaded.
|
||||
/// Set the pivotitem source of this page.
|
||||
/// Override the OnNavigatedFrom function.
|
||||
/// </summary>
|
||||
private void SetupDepartmentPivot()
|
||||
/// <param name="e">event args</param>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
DepartmentPivot.ItemsSource = feed.Model._faculties;
|
||||
base.OnNavigatedFrom(e);
|
||||
|
||||
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
|
||||
{
|
||||
App.SaveToIsolatedStorage<DepartmentModel>(Constants.IsolatedStorage_DepartmentModel, DepartmentIndexPage.Feed.GetModel());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On orientation changed.
|
||||
/// </summary>
|
||||
/// <param name="sender">unused</param>
|
||||
/// <param name="e">unused</param>
|
||||
/// <param name="sender">sender object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called at clicking on the department headline buttons.
|
||||
/// Collapses all visible department panels and open (set to visible)
|
||||
/// the clicked department list.
|
||||
/// On clicking a chair TextBlock.
|
||||
/// Open the browser with the url of the chair.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked department button</param>
|
||||
/// <param name="e">unused</param>
|
||||
private void DepartmentBtn_Click(object sender, RoutedEventArgs e)
|
||||
/// <param name="sender">clicked chair TextBlock</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void ChairTB_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// if the sender was a button
|
||||
if(sender is Button)
|
||||
FrameworkElement tempBtn = sender as FrameworkElement;
|
||||
StackPanel tempParent = null;
|
||||
|
||||
if (this.lastClickedBtn != tempBtn)
|
||||
{
|
||||
Button btn = sender as Button;
|
||||
|
||||
// if the parent is a stackpanel
|
||||
if(btn.Parent is StackPanel)
|
||||
if (this.lastClickedBtn != null)
|
||||
{
|
||||
StackPanel pan = (StackPanel)btn.Parent;
|
||||
|
||||
// if there is a child after the clicked button in the parent panel
|
||||
if ((pan.Children.Count() > 1) && (pan.Children[1] != null))
|
||||
{
|
||||
// if the clicked department wasn't the one clicked before
|
||||
if (pan.Children[1] != this.lastVisibleUIElem)
|
||||
{
|
||||
// collapse the last visible chair list
|
||||
if (this.lastVisibleUIElem != null)
|
||||
this.lastVisibleUIElem.Visibility = Visibility.Collapsed;
|
||||
|
||||
// open the choosen chair list
|
||||
pan.Children[1].Visibility = Visibility.Visible;
|
||||
this.lastVisibleUIElem = pan.Children[1];
|
||||
}
|
||||
}
|
||||
tempParent = this.lastClickedBtn.Parent as StackPanel;
|
||||
tempParent.Children[1].Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
tempParent = tempBtn.Parent as StackPanel;
|
||||
tempParent.Children[1].Visibility = Visibility.Visible;
|
||||
|
||||
this.lastClickedBtn = tempBtn;
|
||||
}
|
||||
else
|
||||
{
|
||||
tempParent = this.lastClickedBtn.Parent as StackPanel;
|
||||
tempParent.Children[1].Visibility = Visibility.Collapsed;
|
||||
this.lastClickedBtn = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking a chair textbolock.
|
||||
/// Open the browser with the url of the chair.
|
||||
/// On clicking on a add button.
|
||||
/// Add the chair to the favorite list.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked chair textblock</param>
|
||||
/// <param name="e"></param>
|
||||
private void ChairTB_Click(object sender, RoutedEventArgs e)
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void AddBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is FrameworkElement)
|
||||
{
|
||||
FrameworkElement btn = sender as FrameworkElement;
|
||||
Button btn = this.lastClickedBtn as Button;
|
||||
TextBlock btnText = btn.Content as TextBlock;
|
||||
|
||||
// if the chair has a url in the tag element
|
||||
if ((btn.Tag != null) && ((btn.Tag as string).Length > 0))
|
||||
{
|
||||
// open browser with the url
|
||||
WebBrowserTask task = new WebBrowserTask();
|
||||
task.Uri = new Uri(btn.Tag.ToString(), UriKind.Absolute);
|
||||
task.Show();
|
||||
}
|
||||
Model.Departments.ChairModel tempModel = DepartmentIndexPage.GetFeed().GetModel().Faculties[this.DepartmentPivot.SelectedIndex].GetChairModel(btnText.Text);
|
||||
|
||||
if (tempModel != null)
|
||||
{
|
||||
DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].AddChair(tempModel);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking on a info button.
|
||||
/// Open the info page to this chair.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void InfoBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FrameworkElement infoBtn = sender as FrameworkElement;
|
||||
string chairName = ((this.lastClickedBtn as Button).Content as TextBlock).Text.ToString();
|
||||
|
||||
NavigationService.Navigate(new Uri(Constants.PathDepartment_DepartmentInfoPage + "?url=" + infoBtn.Tag.ToString() + "&name=" + chairName, UriKind.Relative));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,27 @@
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.EventApp_Title, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
|
||||
</StackPanel>
|
||||
<!-- Content -->
|
||||
<ListBox x:Name="ButtonPanel" Grid.Row="1">
|
||||
<ListBox x:Name="EventList" Grid.Row="1">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="{StaticResource PhoneContrastBackgroundBrush}" Style="{StaticResource ListButtonBorder}">
|
||||
<lui:NavigateButton Name="EventItem" QuerryStringValue="{Binding Index}" Url="{Binding Path=Constants.PathEvent_EventPage, Source={StaticResource Const}}" QuerryStringName="{Binding Path=Constants.ParamPivotIndex, Source={StaticResource Const}}" Style="{StaticResource ListButtonNoneBorder}" HorizontalContentAlignment="Left">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding Title}"/>
|
||||
</lui:NavigateButton>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -8,26 +8,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.Utility;
|
||||
using CampusAppWP8.Feed.Events;
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// Overview page of all events.
|
||||
/// </summary>
|
||||
public partial class EventIndexPage : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets Event Feed object, which contains the RSS models and data.
|
||||
/// Event Feed object, which contains the RSS models and data.
|
||||
/// </summary>
|
||||
public static EventFeed eventFeed { get; set; }
|
||||
private static EventFeed eventFeed = null;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EventIndexPage" /> class.
|
||||
@@ -35,7 +30,48 @@ namespace CampusAppWP8.Pages.Events
|
||||
public EventIndexPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
EventIndexPage.eventFeed = new EventFeed();
|
||||
|
||||
ApplicationBarIconButton updateBtn = new ApplicationBarIconButton();
|
||||
updateBtn.IconUri = new Uri(Icons.Update, UriKind.Relative);
|
||||
updateBtn.Text = AppResources.UpdateBtn;
|
||||
updateBtn.Click += new EventHandler(this.EventForceUpdate_Click);
|
||||
ApplicationBar.Buttons.Add(updateBtn);
|
||||
|
||||
if (EventIndexPage.eventFeed == null)
|
||||
{
|
||||
EventIndexPage.eventFeed = new EventFeed(false);
|
||||
}
|
||||
|
||||
EventIndexPage.eventFeed.onLoaded += new EventFeed.OnLoaded(this.SetupEventPageList);
|
||||
EventIndexPage.eventFeed.LoadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the feed object.
|
||||
/// </summary>
|
||||
public static EventFeed Feed
|
||||
{
|
||||
get
|
||||
{
|
||||
return EventIndexPage.eventFeed;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (EventIndexPage.eventFeed != value)
|
||||
{
|
||||
EventIndexPage.eventFeed = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the eventFeed object.
|
||||
/// </summary>
|
||||
/// <returns>event feed object</returns>
|
||||
public static EventFeed GetEventFeed()
|
||||
{
|
||||
return EventIndexPage.eventFeed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -45,17 +81,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();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -65,53 +90,18 @@ namespace CampusAppWP8.Pages.Events
|
||||
/// </summary>
|
||||
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<RSSModel> tempList = EventIndexPage.eventFeed.Model.Channel[0].item.OrderByDescending(e => e.DTTimestamp);
|
||||
EventIndexPage.eventFeed.Model.Channel[0].item = new ObservableCollection<RSSModel>(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);
|
||||
}
|
||||
}
|
||||
this.EventList.ItemsSource = EventIndexPage.eventFeed.Model.Channel[0].Item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the eventFeed object.
|
||||
/// On clicking the update button in the ApplicationBar.
|
||||
/// Force a data update from the web.
|
||||
/// </summary>
|
||||
public static EventFeed GetEventFeed
|
||||
{
|
||||
get { return EventIndexPage.eventFeed; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is called on clicking on a feed button.
|
||||
/// Navigates to the event pivot page with the information of the
|
||||
/// selected feed index.
|
||||
/// </summary>
|
||||
/// <param name="sender">pressed button object</param>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void EventRowAppButton_Click(object sender, RoutedEventArgs e)
|
||||
private void EventForceUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
FrameworkElement tempElem = sender as FrameworkElement;
|
||||
|
||||
NavigationService.Navigate(new Uri("/pages/events/EventPage.xaml?pivotindex=" + tempElem.Tag, UriKind.Relative));
|
||||
EventIndexPage.eventFeed.ForceWebUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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">
|
||||
|
||||
<phone:PhoneApplicationPage.Resources>
|
||||
@@ -20,7 +20,7 @@
|
||||
<!-- LayoutRoot -->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<!-- Pivotpage -->
|
||||
<phone:Pivot x:Name="EventPivot" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:Pivot x:Name="EventPivot" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" SelectionChanged="OnPivotSelectionChange">
|
||||
<!-- Pivotitem template -->
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
@@ -29,11 +29,10 @@
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid x:Name="EventParentGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<!--<RowDefinition Height="100"/>-->
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="90"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid x:Name="EventTextGrid" Grid.Row="0">
|
||||
@@ -41,20 +40,22 @@
|
||||
<RowDefinition Height="100" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<TextBlock x:Name="EventHeadline" Text="{Binding Path=Title, Mode=OneWay}" Grid.Row="0" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="42"/>
|
||||
<ScrollViewer x:Name="EventTextScroll" Grid.Row="1">
|
||||
<TextBlock x:Name="EventText" Text="{Binding Path=Text, Mode=OneWay}" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="24" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<phone:WebBrowser x:Name="WebBrowser" Grid.Row="0" IsScriptEnabled="True" Visibility="Collapsed"/>
|
||||
|
||||
<Button Name="EventHome" Content="{Binding Path=LocalizedResources.NewsHomeBtn, Source={StaticResource LocalizedStrings}}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="EventHome_Click"/>
|
||||
<Button Name="EventLink" Tag="{Binding Path=Link, Mode=OneWay}" Content="{Binding Path=LocalizedResources.NewsLinkBtn, Source={StaticResource LocalizedStrings}}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Click="EventLink_Click"/>
|
||||
<phone:WebBrowser x:Name="EventWebBrowser" Source="{Binding Path=Link, Mode=OneWay}" Grid.Row="0" IsScriptEnabled="True" Visibility="Collapsed"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Default" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -5,16 +5,19 @@
|
||||
// <author>fiedlchr</author>
|
||||
// <sience>03.05.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Pages.Events
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Model.RSS;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Tasks;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// EventPage, where every event fees has his own PivotItem.
|
||||
@@ -22,16 +25,34 @@ namespace CampusAppWP8.Pages.Events
|
||||
public partial class EventPage : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>
|
||||
/// for checking if the feed source is already set or not.
|
||||
/// To checking if the feed source is already set or not.
|
||||
/// </summary>
|
||||
private bool isSourceSet = false;
|
||||
|
||||
/// <summary>
|
||||
/// To store the last selected pivot index.
|
||||
/// </summary>
|
||||
private int lastSelectedIndex = -1;
|
||||
|
||||
/// <summary>
|
||||
/// For checking if the instance is back from tombstone.
|
||||
/// </summary>
|
||||
private bool isNewInstance = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EventPage" /> class.
|
||||
/// </summary>
|
||||
public EventPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
ApplicationBarIconButton linkBtn = new ApplicationBarIconButton();
|
||||
linkBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
|
||||
linkBtn.Text = AppResources.NewsLinkBtn;
|
||||
linkBtn.Click += new EventHandler(this.EventLink_Click);
|
||||
ApplicationBar.Buttons.Add(linkBtn);
|
||||
|
||||
this.isNewInstance = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -44,47 +65,91 @@ namespace CampusAppWP8.Pages.Events
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
if (this.isNewInstance)
|
||||
{
|
||||
if ((EventIndexPage.GetEventFeed() == null) || (EventIndexPage.GetEventFeed().GetModel() == null))
|
||||
{
|
||||
RSSViewModel tempModel = null;
|
||||
|
||||
if ((tempModel = App.LoadFromIsolatedStorage<RSSViewModel>(Constants.IsolatedStorage_EventRSSModel)) != null)
|
||||
{
|
||||
if (EventIndexPage.GetEventFeed() == null)
|
||||
{
|
||||
EventIndexPage.Feed = new Feed.Events.EventFeed(false);
|
||||
}
|
||||
|
||||
EventIndexPage.Feed.Model = tempModel;
|
||||
this.isSourceSet = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.isNewInstance = false;
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
// Navigate to the selected pivotitem
|
||||
if (NavigationContext.QueryString.TryGetValue("pivotindex", out pivotIndex))
|
||||
if (NavigationContext.QueryString.TryGetValue(Constants.ParamPivotIndex, out pivotIndex))
|
||||
{
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("ERROR: pivotIndex out of range!!!");
|
||||
string o = string.Empty;
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in NavigationContext.QueryString)
|
||||
{
|
||||
o += string.Format("Key = {0}, Value = {1}", kvp.Key, kvp.Value) + "\n";
|
||||
}
|
||||
|
||||
MessageBox.Show("ERROR: pivotIndex out of range!!! (" + o + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking the home button (lower left).
|
||||
/// Navigate back to the event index page.
|
||||
/// Override the OnNavigatedFrom function.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void EventHome_Click(object sender, RoutedEventArgs e)
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
// Navigate back to the event index page
|
||||
NavigationService.GoBack();
|
||||
base.OnNavigatedFrom(e);
|
||||
|
||||
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
|
||||
{
|
||||
App.SaveToIsolatedStorage<RSSViewModel>(Constants.IsolatedStorage_EventRSSModel, EventIndexPage.GetEventFeed().GetModel());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the index of the selected PivotItem is changed.
|
||||
/// Set the text Grid to visible and the WebBrowser to collapsed.
|
||||
/// </summary>
|
||||
/// <param name="sender">parent pivot object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void OnPivotSelectionChange(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
int selIndex = (sender as Pivot).SelectedIndex;
|
||||
|
||||
if (this.lastSelectedIndex > -1)
|
||||
{
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventWebBrowser", Visibility.Collapsed, this.lastSelectedIndex);
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventTextGrid", Visibility.Visible, this.lastSelectedIndex);
|
||||
}
|
||||
|
||||
this.lastSelectedIndex = selIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -94,41 +159,17 @@ namespace CampusAppWP8.Pages.Events
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void EventLink_Click(object sender, RoutedEventArgs e)
|
||||
private void EventLink_Click(object sender, EventArgs e)
|
||||
{
|
||||
FrameworkElement fe = sender as FrameworkElement;
|
||||
|
||||
// Open the webbrowser
|
||||
Grid grfe = fe.Parent as Grid;
|
||||
FrameworkElement eventTextGrid = null;
|
||||
FrameworkElement eventWeb = null;
|
||||
|
||||
foreach (FrameworkElement tempElem in grfe.Children)
|
||||
if (Visibility.Visible == Utilities.GetElementVisibility(this.EventPivot, "EventParentGrid", "EventTextGrid", this.EventPivot.SelectedIndex))
|
||||
{
|
||||
if (tempElem.Name == "EventTextGrid")
|
||||
{
|
||||
eventTextGrid = tempElem;
|
||||
}
|
||||
else if (tempElem.Name == "WebBrowser")
|
||||
{
|
||||
eventWeb = tempElem;
|
||||
}
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventTextGrid", Visibility.Collapsed, this.EventPivot.SelectedIndex);
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventWebBrowser", Visibility.Visible, this.EventPivot.SelectedIndex);
|
||||
}
|
||||
|
||||
if ((eventTextGrid != null)
|
||||
&& (eventWeb != null))
|
||||
else
|
||||
{
|
||||
if (eventTextGrid.Visibility == Visibility.Visible)
|
||||
{
|
||||
eventTextGrid.Visibility = Visibility.Collapsed;
|
||||
eventWeb.Visibility = Visibility.Visible;
|
||||
(eventWeb as WebBrowser).Navigate(new Uri(fe.Tag.ToString(), UriKind.Absolute));
|
||||
}
|
||||
else
|
||||
{
|
||||
eventWeb.Visibility = Visibility.Collapsed;
|
||||
eventTextGrid.Visibility = Visibility.Visible;
|
||||
}
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventWebBrowser", Visibility.Collapsed, this.EventPivot.SelectedIndex);
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventTextGrid", Visibility.Visible, this.EventPivot.SelectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
@@ -22,11 +22,12 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
|
||||
<ProgressBar Name="ProgressBar" Visibility="Collapsed" IsIndeterminate="True"/>
|
||||
<ProgressBar Name="ProgressBar" Grid.Row="1" Visibility="Collapsed" IsIndeterminate="True"/>
|
||||
|
||||
<StackPanel Grid.Row="0" Margin="12,17,0,28">
|
||||
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,0,0,2" >
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Title, Source={StaticResource LocalizedStrings}}"/>
|
||||
</Border>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextTitle2Style}"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -53,8 +54,8 @@
|
||||
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="1">
|
||||
<StackPanel >
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Course, Source={StaticResource LocalizedStrings}}"/>
|
||||
<!-- Listpicket of courses -->
|
||||
<toolkit:ListPicker Name="Course" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.LectureApp_ListPickerHeaderCourse, Source={StaticResource LocalizedStrings}}" >
|
||||
<!-- Listpicket of courses -->
|
||||
<toolkit:ListPicker Name="Course" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderCourse, Source={StaticResource LocalizedStrings}}" >
|
||||
<toolkit:ListPicker.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
@@ -64,9 +65,9 @@
|
||||
</toolkit:ListPicker.ItemTemplate>
|
||||
<toolkit:ListPicker.FullModeItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Text}"/>
|
||||
</StackPanel>
|
||||
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.FullModeItemTemplate>
|
||||
</toolkit:ListPicker>
|
||||
@@ -76,7 +77,7 @@
|
||||
<StackPanel >
|
||||
<!-- Listpicket of degree-->
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Degree, Source={StaticResource LocalizedStrings}}"/>
|
||||
<toolkit:ListPicker Name="Degree">
|
||||
<toolkit:ListPicker Name="Degree" ExpansionMode="FullScreenOnly" SelectionChanged="DegreeSelectionChanged" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderDegree, Source={StaticResource LocalizedStrings}}">
|
||||
<toolkit:ListPicker.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
@@ -86,12 +87,12 @@
|
||||
</toolkit:ListPicker.ItemTemplate>
|
||||
<toolkit:ListPicker.FullModeItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Text}"/>
|
||||
</StackPanel>
|
||||
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.FullModeItemTemplate>
|
||||
</toolkit:ListPicker>
|
||||
</toolkit:ListPicker>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="3">
|
||||
@@ -99,7 +100,7 @@
|
||||
<!-- Listpicket of semesters(from to) -->
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Term, Source={StaticResource LocalizedStrings}}"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<toolkit:ListPicker Width="60" Name="From" >
|
||||
<toolkit:ListPicker Width="60" Name="From" ExpansionMode="FullScreenOnly" SelectionChanged="FromSelectionChanged" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderSemester, Source={StaticResource LocalizedStrings}}">
|
||||
<toolkit:ListPicker.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
@@ -109,14 +110,14 @@
|
||||
</toolkit:ListPicker.ItemTemplate>
|
||||
<toolkit:ListPicker.FullModeItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Text}"/>
|
||||
</StackPanel>
|
||||
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.FullModeItemTemplate>
|
||||
</toolkit:ListPicker>
|
||||
<TextBlock Text="bis" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<toolkit:ListPicker Width="60" Name="To">
|
||||
<toolkit:ListPicker Width="60" Name="To" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderSemester, Source={StaticResource LocalizedStrings}}">
|
||||
<toolkit:ListPicker.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
@@ -126,11 +127,12 @@
|
||||
</toolkit:ListPicker.ItemTemplate>
|
||||
<toolkit:ListPicker.FullModeItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Text}"/>
|
||||
</StackPanel>
|
||||
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.FullModeItemTemplate>
|
||||
|
||||
</toolkit:ListPicker>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
@@ -139,7 +141,7 @@
|
||||
<StackPanel>
|
||||
<!-- Listpicket of semster -->
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Semester, Source={StaticResource LocalizedStrings}}"/>
|
||||
<toolkit:ListPicker Name="Semester">
|
||||
<toolkit:ListPicker Name="Semester" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderSemester, Source={StaticResource LocalizedStrings}}">
|
||||
<toolkit:ListPicker.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
@@ -149,9 +151,9 @@
|
||||
</toolkit:ListPicker.ItemTemplate>
|
||||
<toolkit:ListPicker.FullModeItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Text}"/>
|
||||
</StackPanel>
|
||||
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.FullModeItemTemplate>
|
||||
</toolkit:ListPicker>
|
||||
@@ -159,7 +161,7 @@
|
||||
</Border>
|
||||
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="5">
|
||||
<Button Name="SearchButton" Click="SendRequest">
|
||||
<Image Name="SearchButtonImg" Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="100" />
|
||||
<Image Name="SearchButtonImg" Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="60" />
|
||||
</Button>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
@@ -10,13 +10,11 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
@@ -39,6 +37,11 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
/// </remarks>
|
||||
private LecturePageModel pageModel;
|
||||
|
||||
/// <summary>
|
||||
/// flag for initialed page
|
||||
/// </summary>
|
||||
private bool init;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
@@ -48,8 +51,10 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
public LecturePage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.init = false;
|
||||
this.LoadPageModel();
|
||||
this.SetupListPickers();
|
||||
this.init = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -96,11 +101,11 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
/// </summary>
|
||||
private void SetupListPickers()
|
||||
{
|
||||
this.Course.ItemsSource = this.pageModel.CourseList;
|
||||
this.Degree.ItemsSource = this.pageModel.DegreeList;
|
||||
this.From.ItemsSource = this.pageModel.NumberList;
|
||||
this.To.ItemsSource = this.pageModel.NumberList;
|
||||
this.Semester.ItemsSource = this.pageModel.SemesterList;
|
||||
this.Course.ItemsSource = this.pageModel.CourseList.List;
|
||||
this.Degree.ItemsSource = this.pageModel.DegreeList.List;
|
||||
this.From.ItemsSource = this.pageModel.FromNumberList.List;
|
||||
this.To.ItemsSource = this.pageModel.ToNumberList.List;
|
||||
this.Semester.ItemsSource = this.pageModel.SemesterList.List;
|
||||
|
||||
// load values from last request
|
||||
LecturePageModel lastPageModel = App.LoadFromIsolatedStorage<LecturePageModel>(Constants.IsolatedStorage_LecturePageModel);
|
||||
@@ -160,10 +165,11 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
private void SendRequest(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.api = new LectureApi();
|
||||
this.api.EventHandler.ApiIsReadyEvent += new ApiEventHandler.ApiReadyHandler(this.ApiIsReady);
|
||||
this.api.onLoaded += new LectureApi.OnLoaded(this.ApiIsReady);
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
List<UrlParamModel> parameterList = this.CreateUrlParameter();
|
||||
this.api.ApiGet(parameterList);
|
||||
this.api.SetUriParams(parameterList);
|
||||
this.api.LoadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -198,6 +204,41 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EventHandler for changed degree selection
|
||||
/// </summary>
|
||||
/// <param name="sender">sender object</param>
|
||||
/// <param name="e">some args</param>
|
||||
private void DegreeSelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!this.init)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.pageModel.SelectDegreeIndex = this.Degree.SelectedIndex;
|
||||
this.pageModel.LoadFromNumberList();
|
||||
this.From.ItemsSource = this.pageModel.FromNumberList.List;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EventHandler for changed from selection
|
||||
/// </summary>
|
||||
/// <param name="sender">sender object</param>
|
||||
/// <param name="e">some args</param>
|
||||
private void FromSelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!this.init)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.pageModel.SelectDegreeIndex = this.Degree.SelectedIndex;
|
||||
this.pageModel.SelectFromIndex = this.From.SelectedIndex;
|
||||
this.pageModel.LoadToNumberList();
|
||||
this.To.ItemsSource = this.pageModel.ToNumberList.List;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
|
||||
<StackPanel Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_DetailsHeader, Source={StaticResource LocalizedStrings}}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_DetailsHeader, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextTitle2Style}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
|
||||
|
||||
@@ -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">
|
||||
|
||||
<phone:PhoneApplicationPage.Resources>
|
||||
<DataTemplate x:Key="LectureItemTemplate">
|
||||
|
||||
<Border Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,0,0,0">
|
||||
<StackPanel>
|
||||
<Button Click="ToggleOptions" BorderBrush="{x:Null}">
|
||||
<Grid>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Type}" Grid.Column="0" Grid.Row="0"/>
|
||||
|
||||
<TextBlock Text=" : " Grid.Column="1" Grid.Row="0"/>
|
||||
<TextBlock Text="{Binding Title}" TextWrapping="Wrap" Grid.Column="2" Grid.Row="0"/>
|
||||
</Grid>
|
||||
</Button>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
|
||||
<Button Name="Link" Visibility="Collapsed" Content="Link" Tag="{Binding Modul.Number}" Click="ShowModulWebPage"/>
|
||||
<Button Name="Details" Visibility="Collapsed" Content="Details" Tag="{Binding Id}" Click="ShowDetailPage"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</phone:PhoneApplicationPage.Resources>
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
@@ -55,16 +24,51 @@
|
||||
|
||||
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
|
||||
<StackPanel Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Title, Source={StaticResource LocalizedStrings}}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextTitle2Style}" />
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
|
||||
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
|
||||
<ScrollViewer>
|
||||
<phone:LongListSelector Name="ResultList" ItemTemplate="{StaticResource LectureItemTemplate}" HorizontalContentAlignment="Left" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<ListBox x:Name="ResultList" Grid.Row="1">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="{StaticResource PhoneContrastBackgroundBrush}" Style="{StaticResource ListButtonBorder}">
|
||||
<StackPanel>
|
||||
<lui:ToggleButton ToggleContentTag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}" Style="{StaticResource ListButtonNoneBorder}" HorizontalContentAlignment="Left" >
|
||||
<Grid HorizontalAlignment="Left">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left">
|
||||
<TextBlock Text="{Binding Type}" TextAlignment="Left" HorizontalAlignment="Left" />
|
||||
<TextBlock Text=" : "/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding Title}" TextWrapping="Wrap" Grid.Column="1" Grid.Row="0"/>
|
||||
</Grid>
|
||||
</lui:ToggleButton>
|
||||
<StackPanel Tag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}" Visibility="Collapsed">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<lui:NavigateButton toolkit:TiltEffect.IsTiltEnabled="True" Name="Link" Url="{Binding Path=Constants.PathLecture_ModulWebPage, Source={StaticResource Const}}" QuerryStringValue="{Binding Modul.Number}" QuerryStringName="{Binding Path=Constants.ParamModelLecture_ModulNumber, Source={StaticResource Const}}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Link, Source={StaticResource ThemelizedIcons}}" Height="60"/>
|
||||
</lui:NavigateButton>
|
||||
<lui:NavigateButton toolkit:TiltEffect.IsTiltEnabled="True" Name="Details" Url="{Binding Path=Constants.PathLecture_ResultDetailPage, Source={StaticResource Const}}" QuerryStringValue="{Binding Id}" QuerryStringName="{Binding Path=Constants.ParamModelLecture_ActivityId, Source={StaticResource Const}}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Info, Source={StaticResource ThemelizedIcons}}" Height="60"/>
|
||||
</lui:NavigateButton>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
namespace CampusAppWP8.Pages.Lecture
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Linq;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Model.Lecture;
|
||||
using CampusAppWP8.Resources;
|
||||
@@ -42,113 +41,8 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
return;
|
||||
}
|
||||
|
||||
this.ResultList.ItemsSource = list.Activities;
|
||||
base.OnNavigatedTo(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method toggle the Visibility of the Link- and Details-Buttons
|
||||
/// </summary>
|
||||
/// <param name="sender">Caller of the function</param>
|
||||
/// <param name="e">some EventArgs</param>
|
||||
private void ToggleOptions(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Button button = (Button)sender;
|
||||
StackPanel parent = (StackPanel)button.Parent;
|
||||
|
||||
Button link = (Button)parent.FindName("Link");
|
||||
Button details = (Button)parent.FindName("Details");
|
||||
if (link.Tag == null)
|
||||
{
|
||||
link.IsEnabled = false;
|
||||
}
|
||||
|
||||
this.ToogleVisibility(link);
|
||||
this.ToogleVisibility(details);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method shows the Link- and Details-Buttons
|
||||
/// </summary>
|
||||
/// <param name="parent">Reference of the StackPanel which include the buttons </param>
|
||||
private void ShowOptions(StackPanel parent)
|
||||
{
|
||||
Button link = (Button)parent.FindName("Link");
|
||||
Button details = (Button)parent.FindName("Details");
|
||||
this.ShowVisibility(link);
|
||||
this.ShowVisibility(details);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method hide the Link- and Details-Buttons
|
||||
/// </summary>
|
||||
/// <param name="parent">Reference of the StackPanel which include the buttons </param>
|
||||
private void HideOptions(StackPanel parent)
|
||||
{
|
||||
UIElement link = (UIElement)parent.FindName("Link");
|
||||
UIElement details = (UIElement)parent.FindName("Details");
|
||||
this.HideVisibility(link);
|
||||
this.HideVisibility(details);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method toggle the Visibility of an UIElement
|
||||
/// </summary>
|
||||
/// <param name="element">UIElement which Visibility has to be toggle</param>
|
||||
private void ToogleVisibility(UIElement element)
|
||||
{
|
||||
if (System.Windows.Visibility.Visible.Equals(element.Visibility))
|
||||
{
|
||||
this.HideVisibility(element);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ShowVisibility(element);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method set the Visibility=true of an UIElement
|
||||
/// </summary>
|
||||
/// <param name="element">UIElement which Visibility has to been true</param>
|
||||
private void ShowVisibility(UIElement element)
|
||||
{
|
||||
element.Visibility = System.Windows.Visibility.Visible;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method set the Visibility=false of an UIElement
|
||||
/// </summary>
|
||||
/// <param name="element">UIElement which Visibility has to been false</param>
|
||||
private void HideVisibility(UIElement element)
|
||||
{
|
||||
element.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method navigate to ModuleWebPage
|
||||
/// </summary>
|
||||
/// <param name="sender">Caller of the function</param>
|
||||
/// <param name="e">some EventArgs</param>
|
||||
private void ShowModulWebPage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Button btn = (Button)sender;
|
||||
HideOptions((StackPanel)btn.Parent);
|
||||
Uri url = new Uri(Constants.PathLecture_ModulWebPage + "?" + Constants.ParamModelLecture_ModulNumber + "=" + btn.Tag, UriKind.Relative);
|
||||
NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method navigate to DetailPage
|
||||
/// </summary>
|
||||
/// <param name="sender">Caller of the function</param>
|
||||
/// <param name="e">some EventArgs</param>
|
||||
private void ShowDetailPage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Button btn = (Button)sender;
|
||||
HideOptions((StackPanel)btn.Parent);
|
||||
Uri url = new Uri(Constants.PathLecture_ResultDetailPage + "?" + Constants.ParamModelLecture_ActivityId + "=" + btn.Tag, UriKind.Relative);
|
||||
NavigationService.Navigate(url);
|
||||
this.ResultList.ItemsSource = list.Activities.OrderByDescending(o => o.Type).ThenBy(o => o.Title).ToList();
|
||||
base.OnNavigatedTo(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
66
CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml
Normal file
@@ -0,0 +1,66 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.Pages.Links.LinkPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<ProgressBar Name="ProgressBar" Visibility="Collapsed" IsIndeterminate="True"/>
|
||||
<!--Pivotsteuerelement-->
|
||||
<phone:Pivot Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}">
|
||||
<!--Pivotelement eins-->
|
||||
<phone:PivotItem Header="{Binding Path=LocalizedResources.LinkApp_CommonLinks, Source={StaticResource LocalizedStrings}}">
|
||||
<ListBox x:Name="CommonLinkPanel">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<lui:LinkButton Style="{StaticResource ListButtonStyle}" Content="{Binding Title}" Url="{Binding Link}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</phone:PivotItem>
|
||||
|
||||
<!--Pivotelement zwei-->
|
||||
<phone:PivotItem Header="{Binding Path=LocalizedResources.LinkApp_ClubLinks, Source={StaticResource LocalizedStrings}}">
|
||||
<ListBox x:Name="ClubLinkPanel">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<lui:LinkButton Style="{StaticResource ListButtonStyle}" Content="{Binding Title}" Url="{Binding Link}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</phone:PivotItem>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
<lui:UpdateButtonAppBar Click="LinkForceUpdate_Click"/>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
177
CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml.cs
Normal file
@@ -0,0 +1,177 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="LinkPage.xaml.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>02.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Links
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Feed.Link;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the LinkPage
|
||||
/// </summary>
|
||||
public partial class LinkPage : PhoneApplicationPage
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// the feed of the CommonLinks
|
||||
/// </summary>
|
||||
private CommonLinkFeed commonLinkFeed;
|
||||
|
||||
/// <summary>
|
||||
/// the feed of the ClubLinks
|
||||
/// </summary>
|
||||
private ClubLinkFeed clubLinkFeed;
|
||||
|
||||
/// <summary>
|
||||
/// how many feeds are currently loading
|
||||
/// </summary>
|
||||
private int loadingFeeds;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LinkPage" /> class.
|
||||
/// </summary>
|
||||
public LinkPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region protected
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedTo method
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
this.InitializeFeeds();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
this.loadingFeeds = 2;
|
||||
this.commonLinkFeed.LoadData();
|
||||
this.clubLinkFeed.LoadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedFrom method
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
this.clubLinkFeed.SaveData();
|
||||
this.commonLinkFeed.SaveData();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Method initialize the Feeds
|
||||
/// </summary>
|
||||
private void InitializeFeeds()
|
||||
{
|
||||
if (this.commonLinkFeed == null)
|
||||
{
|
||||
this.InitializeCommonLinkFeed();
|
||||
}
|
||||
|
||||
if (this.clubLinkFeed == null)
|
||||
{
|
||||
this.InitializeClubLinkFeed();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method initialize the CommonLinkFeed
|
||||
/// </summary>
|
||||
private void InitializeCommonLinkFeed()
|
||||
{
|
||||
this.commonLinkFeed = new CommonLinkFeed();
|
||||
this.commonLinkFeed.onLoaded += new CommonLinkFeed.OnLoaded(this.CommonLinkFeedIsReady);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method initialize the ClubLinkFeed
|
||||
/// </summary>
|
||||
private void InitializeClubLinkFeed()
|
||||
{
|
||||
this.clubLinkFeed = new ClubLinkFeed();
|
||||
this.clubLinkFeed.onLoaded += new ClubLinkFeed.OnLoaded(this.ClubLinkFeedIsReady);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method will be execute if the CommonLinkFeed is ready
|
||||
/// </summary>
|
||||
private void CommonLinkFeedIsReady()
|
||||
{
|
||||
this.SetupCommonPivot();
|
||||
this.loadingFeeds--;
|
||||
|
||||
if (this.loadingFeeds < 1)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method will be execute if the ClubLinkFeed is ready
|
||||
/// </summary>
|
||||
private void ClubLinkFeedIsReady()
|
||||
{
|
||||
this.SetupClubPivot();
|
||||
this.loadingFeeds--;
|
||||
if (this.loadingFeeds < 1)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method set ItemSource for the CommonLinkPanel
|
||||
/// </summary>
|
||||
private void SetupCommonPivot()
|
||||
{
|
||||
this.CommonLinkPanel.ItemsSource = this.commonLinkFeed.Model.Links;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method set ItemSource for the ClubLinkPanel
|
||||
/// </summary>
|
||||
private void SetupClubPivot()
|
||||
{
|
||||
this.ClubLinkPanel.ItemsSource = this.clubLinkFeed.Model.Links;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking the update button in the ApplicationBar.
|
||||
/// Force a data update from the web.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void LinkForceUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.loadingFeeds = 2;
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
this.commonLinkFeed.ForceWebUpdate();
|
||||
this.clubLinkFeed.ForceWebUpdate();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
66
CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml
Normal file
@@ -0,0 +1,66 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.Pages.Mensa.MensaPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<ProgressBar Name="ProgressBar" Visibility="Collapsed" IsIndeterminate="True"/>
|
||||
<!--Pivotsteuerelement-->
|
||||
<phone:Pivot Name="MensaPivot" Title="{Binding Path=LocalizedResources.MensaApp_Title, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Day}" />
|
||||
<TextBlock Text="{Binding Date}" FontSize="34" Margin="6,0,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ScrollViewer>
|
||||
<ItemsControl x:Name="MenuPanel" ItemsSource="{Binding Meals}" ScrollViewer.VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="0" Margin="0,0,0,12" Width="100">
|
||||
<TextBlock Text="{Binding MealName}" FontWeight="Bold"/>
|
||||
<TextBlock Text=" : "/>
|
||||
</StackPanel>
|
||||
<Image Source="{Binding IconUrl}" Width="100" Margin="-25,-25,-25,-21"></Image>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding MealDesc}" TextWrapping="Wrap" Grid.Column="1"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
</ScrollViewer>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
<!-- <Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" /> -->
|
||||
</Grid>
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" >
|
||||
<lui:UpdateButtonAppBar Click="MensaForceUpdate_Click"/>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -3,15 +3,14 @@
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>03.05.2013</sience>
|
||||
// <sience>04.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Mensa
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Api.Mensa;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using CampusAppWP8.Feed.Mensa;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the MensaPage
|
||||
@@ -25,6 +24,8 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// </summary>
|
||||
private MensaFeed feed;
|
||||
|
||||
// private SpsApi spsApi;
|
||||
|
||||
/// <summary>
|
||||
/// Index representing the weekday of today
|
||||
/// 0 - Monday(Default)
|
||||
@@ -35,6 +36,11 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// </summary>
|
||||
private int selectedIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Flag indicate that the feed was refreshed
|
||||
/// </summary>
|
||||
private bool refreshed = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
@@ -65,10 +71,45 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
{
|
||||
this.InitializeFeed();
|
||||
}
|
||||
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
this.feed.LoadFeed();
|
||||
this.feed.LoadData();
|
||||
|
||||
// this.determinCurrentPosition();
|
||||
}
|
||||
|
||||
/* need for later feature (#147)
|
||||
private void determinCurrentPosition()
|
||||
{
|
||||
Utilities.DetermineAndStoreCurrentPosition();
|
||||
string lat = App.LoadFromAppState<string>("CurrentPosition.Lat");
|
||||
string log = App.LoadFromAppState<string>("CurrentPosition.Long");
|
||||
|
||||
this.spsApi = new SpsApi();
|
||||
this.spsApi.onLoaded += new SpsApi.OnLoaded(this.ApiIsReady);
|
||||
List<UrlParamModel> parameterList = new List<UrlParamModel>();
|
||||
parameterList.Add(new CleanUrlParamModel("latitude", lat));
|
||||
parameterList.Add(new CleanUrlParamModel("longitude", log));
|
||||
parameterList.Add(new CleanUrlParamModel("domain", "3"));
|
||||
this.spsApi.SetUriParams(parameterList);
|
||||
this.spsApi.LoadData();
|
||||
}
|
||||
|
||||
private void ApiIsReady()
|
||||
{
|
||||
string i = this.spsApi.Model.Places[0].PlaceId;
|
||||
}*/
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedFrom method
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
this.feed.SaveData(this.refreshed);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
@@ -77,10 +118,9 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
private void InitializeFeed()
|
||||
{
|
||||
this.feed = new MensaFeed();
|
||||
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady);
|
||||
this.feed.onLoaded += new MensaFeed.OnLoaded(this.FeedIsReady);
|
||||
this.CalcSelectedIndex();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Method will be execute if the feed is ready
|
||||
@@ -98,7 +138,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
{
|
||||
this.MensaPivot.ItemsSource = this.feed.Model.Menus;
|
||||
this.MensaPivot.SelectedIndex = this.selectedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method calculate which pivot has to be selected
|
||||
@@ -131,6 +171,20 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
|
||||
this.selectedIndex = todayIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking the update button in the ApplicationBar.
|
||||
/// Force a data update from the web.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void MensaForceUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
this.feed.ForceWebUpdate();
|
||||
this.refreshed = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
@@ -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,8 +27,27 @@
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.NewsApp_Title, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
|
||||
</StackPanel>
|
||||
<!-- Content -->
|
||||
<ListBox x:Name="ButtonPanel" Grid.Row="1">
|
||||
<ListBox x:Name="NewsList" Grid.Row="1">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="{StaticResource PhoneContrastBackgroundBrush}" Style="{StaticResource ListButtonBorder}">
|
||||
<lui:NavigateButton Name="NewsItem" QuerryStringValue="{Binding Index}" Url="{Binding Path=Constants.PathNews_NewsPage, Source={StaticResource Const}}" QuerryStringName="{Binding Path=Constants.ParamPivotIndex, Source={StaticResource Const}}" Style="{StaticResource ListButtonNoneBorder}" HorizontalContentAlignment="Left">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding Title}" />
|
||||
</lui:NavigateButton>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -8,16 +8,11 @@
|
||||
namespace CampusAppWP8.Pages.News
|
||||
{
|
||||
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.News;
|
||||
using CampusAppWP8.Model.events_news;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Feed.News;
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// Overview page of all news.
|
||||
@@ -25,9 +20,9 @@ namespace CampusAppWP8.Pages.News
|
||||
public partial class NewsIndexPage : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets News Feed object, which contains the RSS models and data.
|
||||
/// News Feed object, which contains the RSS models and data.
|
||||
/// </summary>
|
||||
public static NewsFeed newsFeed { get; set; }
|
||||
private static NewsFeed newsFeed = null;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NewsIndexPage" /> class.
|
||||
@@ -35,7 +30,48 @@ namespace CampusAppWP8.Pages.News
|
||||
public NewsIndexPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
NewsIndexPage.newsFeed = new NewsFeed();
|
||||
|
||||
ApplicationBarIconButton updateBtn = new ApplicationBarIconButton();
|
||||
updateBtn.IconUri = new Uri(Icons.Update, UriKind.Relative);
|
||||
updateBtn.Text = AppResources.UpdateBtn;
|
||||
updateBtn.Click += new EventHandler(this.NewsForceUpdate_Click);
|
||||
ApplicationBar.Buttons.Add(updateBtn);
|
||||
|
||||
if (NewsIndexPage.newsFeed == null)
|
||||
{
|
||||
NewsIndexPage.newsFeed = new NewsFeed(false);
|
||||
}
|
||||
|
||||
NewsIndexPage.newsFeed.onLoaded += new NewsFeed.OnLoaded(this.SetupNewsPageList);
|
||||
NewsIndexPage.newsFeed.LoadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the feed object.
|
||||
/// </summary>
|
||||
public static NewsFeed Feed
|
||||
{
|
||||
get
|
||||
{
|
||||
return NewsIndexPage.newsFeed;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (NewsIndexPage.newsFeed != value)
|
||||
{
|
||||
NewsIndexPage.newsFeed = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the newsFeed object.
|
||||
/// </summary>
|
||||
/// <returns>news feed object</returns>
|
||||
public static NewsFeed GetNewsFeed()
|
||||
{
|
||||
return NewsIndexPage.newsFeed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -45,17 +81,6 @@ namespace CampusAppWP8.Pages.News
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
if ((NewsIndexPage.newsFeed.Model == null)
|
||||
|| (NewsIndexPage.newsFeed.Model.Channel == null)
|
||||
|| (NewsIndexPage.newsFeed.Model.Channel.Count() == 0)
|
||||
|| (NewsIndexPage.newsFeed.Model.Channel[0].item == null)
|
||||
|| (NewsIndexPage.newsFeed.Model.Channel[0].item.Count() == 0))
|
||||
{
|
||||
// Set handler and load the fees informations.
|
||||
NewsIndexPage.newsFeed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.SetupNewsPageList);
|
||||
NewsIndexPage.newsFeed.LoadFeed();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -65,53 +90,18 @@ namespace CampusAppWP8.Pages.News
|
||||
/// </summary>
|
||||
private void SetupNewsPageList()
|
||||
{
|
||||
if ((NewsIndexPage.newsFeed.Model != null)
|
||||
&& (NewsIndexPage.newsFeed.Model.Channel != null)
|
||||
&& (NewsIndexPage.newsFeed.Model.Channel.Count() >= 1)
|
||||
&& (this.ButtonPanel.Items.Count() == 0))
|
||||
{
|
||||
// Sort the list of rssfeeds.
|
||||
IEnumerable<RSSModel> tempList = NewsIndexPage.newsFeed.Model.Channel[0].item.OrderByDescending(e => e.DTTimestamp);
|
||||
NewsIndexPage.newsFeed.Model.Channel[0].item = new ObservableCollection<RSSModel>(tempList);
|
||||
|
||||
// Create the buttons for the fees selection and add it to the buttonpanel.
|
||||
for (int i = 0; i < NewsIndexPage.newsFeed.Model.Channel[0].item.Count(); i++)
|
||||
{
|
||||
Button tempBtn = new Button();
|
||||
tempBtn.Name = "NewsRowAppButton";
|
||||
tempBtn.Content = NewsIndexPage.newsFeed.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.NewsRowAppButton_Click;
|
||||
tempBtn.Tag = i;
|
||||
|
||||
this.ButtonPanel.Items.Add(tempBtn);
|
||||
}
|
||||
}
|
||||
this.NewsList.ItemsSource = NewsIndexPage.newsFeed.Model.Channel[0].Item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the newsFeed object.
|
||||
/// On clicking the update button in the ApplicationBar.
|
||||
/// Force a data update from the web.
|
||||
/// </summary>
|
||||
public static NewsFeed GetNewsFeed
|
||||
{
|
||||
get { return NewsIndexPage.newsFeed; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is called on clicking on a feed button.
|
||||
/// Navigates to the news pivot page with the information of the
|
||||
/// selected feed index.
|
||||
/// </summary>
|
||||
/// <param name="sender">pressed button object</param>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void NewsRowAppButton_Click(object sender, RoutedEventArgs e)
|
||||
private void NewsForceUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
FrameworkElement tempElem = sender as FrameworkElement;
|
||||
|
||||
NavigationService.Navigate(new Uri("/pages/news/NewsPage.xaml?pivotindex=" + tempElem.Tag, UriKind.Relative));
|
||||
NewsIndexPage.newsFeed.ForceWebUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
<phone:PhoneApplicationPage.Resources>
|
||||
@@ -20,7 +20,7 @@
|
||||
<!-- LayoutRoot -->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<!-- Pivotpage -->
|
||||
<phone:Pivot x:Name="NewsPivot" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:Pivot x:Name="NewsPivot" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" SelectionChanged="OnPivotSelectionChange">
|
||||
<!-- Pivotitem template -->
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
@@ -29,10 +29,9 @@
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid x:Name="NewsParentGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="90"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid x:Name="NewsTextGrid" Grid.Row="0">
|
||||
@@ -40,20 +39,22 @@
|
||||
<RowDefinition Height="100" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<TextBlock x:Name="NewsHeadline" Text="{Binding Path=Title, Mode=OneWay}" Grid.Row="0" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="42"/>
|
||||
<ScrollViewer Grid.Row="1">
|
||||
<TextBlock x:Name="NewsText" Text="{Binding Path=Text, Mode=OneWay}" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="24" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<phone:WebBrowser x:Name="WebBrowser" Grid.Row="0" IsScriptEnabled="True" Visibility="Collapsed"/>
|
||||
|
||||
<Button Name="NewsHome" Content="{Binding Path=LocalizedResources.NewsHomeBtn, Source={StaticResource LocalizedStrings}}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="NewsHome_Click"/>
|
||||
<Button Name="NewsLink" Tag="{Binding Path=Link, Mode=OneWay}" Content="{Binding Path=LocalizedResources.NewsLinkBtn, Source={StaticResource LocalizedStrings}}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Click="NewsLink_Click"/>
|
||||
<phone:WebBrowser x:Name="NewsWebBrowser" Source="{Binding Path=Link, Mode=OneWay}" Grid.Row="0" IsScriptEnabled="True" Visibility="Collapsed"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Default" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
|
||||
@@ -13,8 +13,11 @@ namespace CampusAppWP8.Pages.News
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Model.RSS;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Tasks;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// EventPage, where every news fees has his own PivotItem.
|
||||
@@ -26,12 +29,30 @@ namespace CampusAppWP8.Pages.News
|
||||
/// </summary>
|
||||
private bool isSourceSet = false;
|
||||
|
||||
/// <summary>
|
||||
/// To store the index of the last selected PivotItem.
|
||||
/// </summary>
|
||||
private int lastSelectedIndex = -1;
|
||||
|
||||
/// <summary>
|
||||
/// For checking if the instance is back from tombstone.
|
||||
/// </summary>
|
||||
private bool isNewInstance = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NewsPage" /> class.
|
||||
/// </summary>
|
||||
public NewsPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
ApplicationBarIconButton linkBtn = new ApplicationBarIconButton();
|
||||
linkBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
|
||||
linkBtn.Text = AppResources.NewsLinkBtn;
|
||||
linkBtn.Click += new EventHandler(this.NewsLink_Click);
|
||||
ApplicationBar.Buttons.Add(linkBtn);
|
||||
|
||||
this.isNewInstance = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -43,29 +64,44 @@ namespace CampusAppWP8.Pages.News
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
|
||||
if (this.isNewInstance)
|
||||
{
|
||||
if ((NewsIndexPage.Feed == null) || (NewsIndexPage.Feed.GetModel() == null))
|
||||
{
|
||||
RSSViewModel tempModel = null;
|
||||
|
||||
if ((tempModel = App.LoadFromIsolatedStorage<RSSViewModel>(Constants.IsolatedStorage_NewsRSSModel)) != null)
|
||||
{
|
||||
if (NewsIndexPage.Feed == null)
|
||||
{
|
||||
NewsIndexPage.Feed = new Feed.News.NewsFeed(false);
|
||||
}
|
||||
|
||||
NewsIndexPage.Feed.Model = tempModel;
|
||||
this.isSourceSet = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.isNewInstance = false;
|
||||
}
|
||||
|
||||
// Set pivotitem Source
|
||||
if (this.isSourceSet == false)
|
||||
{
|
||||
if ((NewsIndexPage.GetNewsFeed.Model != null)
|
||||
&& (NewsIndexPage.GetNewsFeed.Model.Channel != null)
|
||||
&& (NewsIndexPage.GetNewsFeed.Model.Channel.Count() >= 1)
|
||||
&& (this.NewsPivot.Items.Count() == 0))
|
||||
{
|
||||
this.NewsPivot.ItemsSource = NewsIndexPage.GetNewsFeed.Model.Channel[0].item;
|
||||
this.isSourceSet = true;
|
||||
}
|
||||
this.NewsPivot.ItemsSource = NewsIndexPage.GetNewsFeed().Model.Channel[0].Item;
|
||||
this.isSourceSet = true;
|
||||
}
|
||||
|
||||
string pivotIndex = string.Empty;
|
||||
|
||||
// Navigate to the selected pivotitem
|
||||
if (NavigationContext.QueryString.TryGetValue("pivotindex", out pivotIndex))
|
||||
if (NavigationContext.QueryString.TryGetValue(Constants.ParamPivotIndex, out pivotIndex))
|
||||
{
|
||||
int pivotIndexInt = int.Parse(pivotIndex);
|
||||
|
||||
// if the index is in the range of the array
|
||||
if ((pivotIndexInt >= 0) && (pivotIndexInt < NewsIndexPage.GetNewsFeed.Model.Channel[0].item.Count()))
|
||||
if ((pivotIndexInt >= 0) && (pivotIndexInt < NewsIndexPage.GetNewsFeed().Model.Channel[0].Item.Count()))
|
||||
{
|
||||
NewsPivot.SelectedIndex = pivotIndexInt;
|
||||
}
|
||||
@@ -77,15 +113,36 @@ namespace CampusAppWP8.Pages.News
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking the home button (lower left).
|
||||
/// Navigate back to the news index page.
|
||||
/// Overrides the OnNavigatedFrom function.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void NewsHome_Click(object sender, RoutedEventArgs e)
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
// Navigate back to the news index page
|
||||
NavigationService.GoBack();
|
||||
base.OnNavigatedFrom(e);
|
||||
|
||||
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
|
||||
{
|
||||
App.SaveToIsolatedStorage<RSSViewModel>(Constants.IsolatedStorage_NewsRSSModel, NewsIndexPage.GetNewsFeed().GetModel());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the index of the selected PivotItem is changed.
|
||||
/// Set the text Grid to visible and the WebBrowser to collapsed.
|
||||
/// </summary>
|
||||
/// <param name="sender">parent pivot object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void OnPivotSelectionChange(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
int selIndex = (sender as Pivot).SelectedIndex;
|
||||
|
||||
if (this.lastSelectedIndex > -1)
|
||||
{
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsWebBrowser", Visibility.Collapsed, this.lastSelectedIndex);
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsTextGrid", Visibility.Visible, this.lastSelectedIndex);
|
||||
}
|
||||
|
||||
this.lastSelectedIndex = selIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -95,41 +152,17 @@ namespace CampusAppWP8.Pages.News
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void NewsLink_Click(object sender, RoutedEventArgs e)
|
||||
private void NewsLink_Click(object sender, EventArgs e)
|
||||
{
|
||||
FrameworkElement fe = sender as FrameworkElement;
|
||||
|
||||
// Open the webbrowser
|
||||
Grid grfe = fe.Parent as Grid;
|
||||
FrameworkElement newsTextGrid = null;
|
||||
FrameworkElement newsWeb = null;
|
||||
|
||||
foreach (FrameworkElement tempElem in grfe.Children)
|
||||
if (Visibility.Visible == Utilities.GetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsTextGrid", this.NewsPivot.SelectedIndex))
|
||||
{
|
||||
if (tempElem.Name == "NewsTextGrid")
|
||||
{
|
||||
newsTextGrid = tempElem;
|
||||
}
|
||||
else if (tempElem.Name == "WebBrowser")
|
||||
{
|
||||
newsWeb = tempElem;
|
||||
}
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsTextGrid", Visibility.Collapsed, this.NewsPivot.SelectedIndex);
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsWebBrowser", Visibility.Visible, this.NewsPivot.SelectedIndex);
|
||||
}
|
||||
|
||||
if ((newsTextGrid != null)
|
||||
&& (newsWeb != null))
|
||||
else
|
||||
{
|
||||
if (newsTextGrid.Visibility == Visibility.Visible)
|
||||
{
|
||||
newsTextGrid.Visibility = Visibility.Collapsed;
|
||||
newsWeb.Visibility = Visibility.Visible;
|
||||
(newsWeb as WebBrowser).Navigate(new Uri(fe.Tag.ToString(), UriKind.Absolute));
|
||||
}
|
||||
else
|
||||
{
|
||||
newsWeb.Visibility = Visibility.Collapsed;
|
||||
newsTextGrid.Visibility = Visibility.Visible;
|
||||
}
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsWebBrowser", Visibility.Collapsed, this.NewsPivot.SelectedIndex);
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsTextGrid", Visibility.Visible, this.NewsPivot.SelectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
@@ -37,8 +38,8 @@
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<Button Content="{Binding Title}" Background="Gray" BorderBrush="Gray" Foreground="Black" Margin="-10,-10,-10,-10" Click="InstitutionBtn_Click"/>
|
||||
<StackPanel Visibility="Collapsed">
|
||||
<lui:ToggleButton Content="{Binding Title}" ToggleContentTag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}" Style="{StaticResource ListButtonStyle}"/>
|
||||
<StackPanel Visibility="Collapsed" Tag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<!--day-->
|
||||
@@ -94,7 +95,7 @@
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<!--building-->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=LocalizedResources.Building, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleBuilding}" Padding="10,3,10,0"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Building}" Visibility="{Binding VisibleBuilding}" HorizontalAlignment="Left" Padding="10,3,10,0"/>
|
||||
@@ -111,19 +112,13 @@
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<!--mail button-->
|
||||
<Button Grid.Column="0" Tag="{Binding EMailTitle}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisibleEMail}" Click="EMailBtn_Click" Padding="0" Margin="-10">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.WebMail, Source={StaticResource ThemelizedIcons}}"/>
|
||||
</Button>
|
||||
<lui:EmailButton Grid.Column="0" EmailAddress="{Binding EMail}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisibleEMail}" Padding="0" Margin="-10"/>
|
||||
<!--phone button-->
|
||||
<Button Grid.Column="1" Tag="{Binding PhoneTitle}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisiblePhone}" Click="PhoneBtn_Click" Padding="0" Margin="-10">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Phone, Source={StaticResource ThemelizedIcons}}"/>
|
||||
</Button>
|
||||
<!--location button-->
|
||||
<Button Grid.Column="2" Tag="{Binding Building}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisibleBuilding}" Click="LocationBtn_Click" Padding="0" Margin="-10">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Campus, Source={StaticResource ThemelizedIcons}}"/>
|
||||
</Button>
|
||||
<lui:PhoneButton Grid.Column="1" Number="{Binding Phone}" DisplayName="{Binding Title}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisiblePhone}" Padding="0" Margin="-10"/>
|
||||
<!--location button -->
|
||||
<lui:GoToMapButton Grid.Column="2" SearchTerm="{Binding Building}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisibleBuilding}" Padding="0" Margin="-10" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
@@ -131,5 +126,9 @@
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
<lui:UpdateButtonAppBar Click="OpenHoursForceUpdate_Click"/>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -7,15 +7,13 @@
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Openinghours
|
||||
{
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Feed.Openinghours;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Model.Openinghours;
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Tasks;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Opening hours page.
|
||||
/// </summary>
|
||||
@@ -29,9 +27,9 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
private OpeninghoursFeed feed = null;
|
||||
|
||||
/// <summary>
|
||||
/// last visible UI element.
|
||||
/// for checking if the instance is new or a tombstone.
|
||||
/// </summary>
|
||||
private UIElement lastOpenUIElem = null;
|
||||
private bool isNewInstance = false;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -43,7 +41,15 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
public OpeninghoursPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.InitializeFeed();
|
||||
|
||||
if (this.feed == null)
|
||||
{
|
||||
this.feed = new OpeninghoursFeed();
|
||||
this.feed.onLoaded += new OpeninghoursFeed.OnLoaded(this.FeedIsReady);
|
||||
this.feed.LoadData();
|
||||
}
|
||||
|
||||
this.isNewInstance = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -59,17 +65,41 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
if (this.feed == null)
|
||||
/*
|
||||
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
}
|
||||
*/
|
||||
if (this.isNewInstance)
|
||||
{
|
||||
this.InitializeFeed();
|
||||
if ((this.feed == null) || (this.feed.GetModel() == null))
|
||||
{
|
||||
OpeninghoursModel tempModel = null;
|
||||
|
||||
if ((tempModel = App.LoadFromIsolatedStorage<OpeninghoursModel>(Constants.IsolatedStorage_OpeninghoursModel)) != null)
|
||||
{
|
||||
this.feed.Model = tempModel;
|
||||
this.FeedIsReady();
|
||||
}
|
||||
}
|
||||
|
||||
this.isNewInstance = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedFrom method
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
this.feed.SaveData();
|
||||
|
||||
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
App.SaveToIsolatedStorage<OpeninghoursModel>(Constants.IsolatedStorage_OpeninghoursModel, this.feed.GetModel());
|
||||
}
|
||||
|
||||
this.feed.LoadFeed();
|
||||
}
|
||||
|
||||
// protected
|
||||
@@ -77,119 +107,32 @@ namespace CampusAppWP8.Pages.Openinghours
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the opening hours feed.
|
||||
/// </summary>
|
||||
private void InitializeFeed()
|
||||
{
|
||||
this.feed = new OpeninghoursFeed();
|
||||
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will be execute if the feed is ready.
|
||||
/// </summary>
|
||||
private void FeedIsReady()
|
||||
{
|
||||
this.SetupInstitutionList();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup the institution list.
|
||||
/// </summary>
|
||||
private void SetupInstitutionList()
|
||||
{
|
||||
this.InstitutionPanel.ItemsSource = this.feed.Model.Institutions;
|
||||
|
||||
// this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
// this.feed.SaveData(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called on clicking on a institution.
|
||||
/// On clicking the update button in the ApplicationBar.
|
||||
/// Force a data update from the web.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void InstitutionBtn_Click(object sender, RoutedEventArgs e)
|
||||
private void OpenHoursForceUpdate_Click(object sender, EventArgs 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called on clicking on a mail button.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called on clicking on a phone button.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called on clicking on a location button.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void LocationBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FrameworkElement tempUIElem = sender as FrameworkElement;
|
||||
|
||||
// TODO: open campusmap
|
||||
// this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
this.feed.ForceWebUpdate();
|
||||
}
|
||||
|
||||
// private
|
||||
#endregion
|
||||
|
||||
// Method
|
||||
#endregion
|
||||
}
|
||||
|
||||
134
CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml
Normal file
@@ -0,0 +1,134 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.Pages.Setting.UserProfil"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
|
||||
<ProgressBar Name="ProgressBar" Grid.Row="1" Visibility="Collapsed" IsIndeterminate="True"/>
|
||||
|
||||
<StackPanel Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Setting_User, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextTitle2Style}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
|
||||
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="0">
|
||||
<StackPanel >
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Setting_UserCourse, Source={StaticResource LocalizedStrings}}"/>
|
||||
<!-- Listpicket of courses -->
|
||||
<toolkit:ListPicker Name="Course" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderCourse, Source={StaticResource LocalizedStrings}}" >
|
||||
<toolkit:ListPicker.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Text}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.ItemTemplate>
|
||||
<toolkit:ListPicker.FullModeItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.FullModeItemTemplate>
|
||||
</toolkit:ListPicker>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="1">
|
||||
<StackPanel >
|
||||
<!-- Listpicket of degree-->
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Setting_UserDegree, Source={StaticResource LocalizedStrings}}"/>
|
||||
<toolkit:ListPicker Name="Degree" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderDegree, Source={StaticResource LocalizedStrings}}">
|
||||
<toolkit:ListPicker.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Text}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.ItemTemplate>
|
||||
<toolkit:ListPicker.FullModeItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.FullModeItemTemplate>
|
||||
</toolkit:ListPicker>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="2">
|
||||
<StackPanel >
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Setting_UserSemester, Source={StaticResource LocalizedStrings}}"/>
|
||||
<!-- Listpicket of courses -->
|
||||
<toolkit:ListPicker Name="Semster" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderSemester, Source={StaticResource LocalizedStrings}}" >
|
||||
<toolkit:ListPicker.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Text}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.ItemTemplate>
|
||||
<toolkit:ListPicker.FullModeItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.FullModeItemTemplate>
|
||||
</toolkit:ListPicker>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="3">
|
||||
<StackPanel >
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.Setting_UserRole, Source={StaticResource LocalizedStrings}}"/>
|
||||
<!-- Listpicket of courses -->
|
||||
<toolkit:ListPicker Name="Role" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderRole, Source={StaticResource LocalizedStrings}}" >
|
||||
<toolkit:ListPicker.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Text}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.ItemTemplate>
|
||||
<toolkit:ListPicker.FullModeItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</toolkit:ListPicker.FullModeItemTemplate>
|
||||
</toolkit:ListPicker>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</phone:PhoneApplicationPage>
|
||||
90
CampusAppWP8/CampusAppWP8/Pages/Setting/UserProfil.xaml.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="UserProfil.xaml.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>23.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Setting
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.File.Setting;
|
||||
using CampusAppWP8.Model.Utility;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the UserProfilePage
|
||||
/// </summary>
|
||||
public partial class UserProfil : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference of the profileFile
|
||||
/// </summary>
|
||||
private UserProfilFile userFile;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserProfil" /> class.
|
||||
/// </summary>
|
||||
public UserProfil()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.userFile = Settings.UserProfil;
|
||||
|
||||
this.SetupListPickers();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedFrom method
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
if (NavigationMode.Back == e.NavigationMode)
|
||||
{
|
||||
this.SaveProfile();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method sets the ItemSource of the ListPickers
|
||||
/// </summary>
|
||||
private void SetupListPickers()
|
||||
{
|
||||
CourseListPickerItemListModel courseList = new CourseListPickerItemListModel();
|
||||
DegreeListPickerItemListModel degreeList = new DegreeListPickerItemListModel();
|
||||
SemesterListPickerItemListModel semesterList = new SemesterListPickerItemListModel();
|
||||
RoleListPickerItemListModel roleList = new RoleListPickerItemListModel();
|
||||
|
||||
this.Course.ItemsSource = courseList.List;
|
||||
this.Degree.ItemsSource = degreeList.List;
|
||||
this.Semster.ItemsSource = semesterList.List;
|
||||
this.Role.ItemsSource = roleList.List;
|
||||
|
||||
this.Course.SelectedIndex = courseList.GetIndexOrDefault(this.userFile.Model.Course.ToString().PadLeft(3, '0'));
|
||||
this.Degree.SelectedIndex = degreeList.GetIndexOrDefault(((int)this.userFile.Model.Degree).ToString());
|
||||
this.Semster.SelectedIndex = semesterList.GetIndexOrDefault(this.userFile.Model.Semester.ToString());
|
||||
this.Role.SelectedIndex = roleList.GetIndexOrDefault(this.userFile.Model.Role.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method save the current profile
|
||||
/// </summary>
|
||||
private void SaveProfile()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.userFile.Model.Course = int.Parse(((ListPickerItemModel)this.Course.SelectedItem).Value);
|
||||
this.userFile.Model.Degree = (CampusAppWP8.Model.Setting.UserProfilModel.DegreeType)Enum.Parse(typeof(CampusAppWP8.Model.Setting.UserProfilModel.DegreeType), ((ListPickerItemModel)this.Degree.SelectedItem).Value);
|
||||
this.userFile.Model.Semester = int.Parse(((ListPickerItemModel)this.Semster.SelectedItem).Value);
|
||||
this.userFile.Model.Role = (CampusAppWP8.Model.Setting.UserProfilModel.RoleType)Enum.Parse(typeof(CampusAppWP8.Model.Setting.UserProfilModel.RoleType), ((ListPickerItemModel)this.Role.SelectedItem).Value);
|
||||
this.userFile.SaveData();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
147
CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml
Normal file
@@ -0,0 +1,147 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.Pages.StartPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
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="PortraitOrLandscape" Orientation="Portrait"
|
||||
OrientationChanged="PhoneApplicationPage_OrientationChanged"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
|
||||
<StackPanel Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
|
||||
<Grid x:Name="ContentPanel" Margin="12,0,12,12" Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Row 0 -->
|
||||
<lui:NavigateButton Name="TimeTableAppButton" Grid.Row="0" Grid.Column="0" Style="{StaticResource StartPageButton}" IsEnabled="False">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Schedule, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.TimeTableApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="NewsAppButton" Grid.Row="0" Grid.Column="1" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathNews_NewsIndexPage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.News, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.NewsApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="LectureAppButton" Grid.Row="0" Grid.Column="2" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathLecture_LecturePage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Lectures, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<!-- Row 1 -->
|
||||
|
||||
<lui:NavigateButton Name="HomeworkAppButton" Grid.Row="1" Grid.Column="0" Style="{StaticResource StartPageButton}" IsEnabled="False">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Homework, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Name="HomeworkAppButtonText" Text="{Binding Path=LocalizedResources.HomeworkApp_Title2, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="EventAppButton" Grid.Row="1" Grid.Column="1" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathEvents_EventsIndexPage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.News, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.EventApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="CampusMapAppButton" Grid.Row="1" Grid.Column="2" Style="{StaticResource StartPageButton}" IsEnabled="False">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Campus, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.CampusMapApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<!-- Row 2 -->
|
||||
<lui:NavigateButton Name="DepartmentAppButton" Grid.Row="2" Grid.Column="0" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathDepartment_DepartmentIndexPage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Departments, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.DepartmentApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="MensaAppButton" Grid.Row="2" Grid.Column="1" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathMensa_MensaPage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Mensa, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="MailAppButton" Grid.Row="2" Grid.Column="2" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathMail_WebMailPage, Source={StaticResource Const}}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.WebMail, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MailApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<!-- Row 3 -->
|
||||
<lui:NavigateButton Name="OpenHoursAppButton" Url="{Binding Path=Constants.PathOpeninghours_OpeninghoursPage, Source={StaticResource Const}}" Grid.Row="3" Grid.Column="0" Style="{StaticResource StartPageButton}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Openhours, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Name="OpenHoursAppButtonText" Text="{Binding Path=LocalizedResources.OpenHoursApp_Title2, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="LinkAppButton" Url="{Binding Path=Constants.PathLinks_LinkPage, Source={StaticResource Const}}" Grid.Row="3" Grid.Column="1" Style="{StaticResource StartPageButton}">
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Link, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LinkApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
|
||||
<lui:NavigateButton Name="OSAAppButton" Url="{Binding Path=Constants.PathStudentCouncil_StudentCouncilPage, Source={StaticResource Const}}" Grid.Row="3" Grid.Column="2" Style="{StaticResource StartPageButton}">
|
||||
<lui:NavigateButton.RenderTransform>
|
||||
<CompositeTransform/>
|
||||
</lui:NavigateButton.RenderTransform>
|
||||
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.StudentCouncil, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.OSAApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>
|
||||
</StackPanel>
|
||||
</lui:NavigateButton>
|
||||
</Grid>
|
||||
|
||||
<!-- <Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" /> -->
|
||||
</Grid>
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized" StateChanged="ApplicationBar_StateChanged" Opacity="0.5" >
|
||||
<shell:ApplicationBar.MenuItems>
|
||||
<shell:ApplicationBarMenuItem Text="Setting" Click="ApplicationBarMenuItem_Click"/>
|
||||
</shell:ApplicationBar.MenuItems>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -12,7 +12,9 @@ namespace CampusAppWP8.Pages
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the StartPage
|
||||
@@ -25,9 +27,17 @@ namespace CampusAppWP8.Pages
|
||||
public StartPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ApplicationBarMenuItem menuItem1 = ApplicationBar.MenuItems[0] as ApplicationBarMenuItem;
|
||||
if (menuItem1 != null)
|
||||
{
|
||||
menuItem1.Text = AppResources.Setting_UserProfilAppBarTitle;
|
||||
}
|
||||
|
||||
// if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible)
|
||||
// this.SetIconThemeToDark();
|
||||
if (Settings.AppSetting.InitApp)
|
||||
{
|
||||
this.ShowOptIns();
|
||||
Settings.AppSetting.InitApp = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -42,93 +52,93 @@ namespace CampusAppWP8.Pages
|
||||
{
|
||||
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);
|
||||
ContentPanel.Margin = new Thickness(12, 0, 0, 0);
|
||||
|
||||
HomeworkAppButtonText.Text = AppResources.HomeworkApp_Title2;
|
||||
|
||||
ContentPanel.RowDefinitions[3].Height = new GridLength(1, GridUnitType.Star);
|
||||
ContentPanel.ColumnDefinitions[3].Width = GridLength.Auto;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// start the LectureApp
|
||||
/// Method Navigate to <see cref="Setting/UserProfil"/>
|
||||
/// </summary>
|
||||
/// <param name="sender">Caller of the function</param>
|
||||
/// <param name="e">some EventArgs</param>
|
||||
private void OpenLectureApp(object sender, RoutedEventArgs e)
|
||||
private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Uri url = new Uri(Constants.PathLecture_LecturePage, UriKind.Relative);
|
||||
Uri url = new Uri(Constants.PathSetting_User, UriKind.Relative);
|
||||
NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// start the NewsApp
|
||||
/// Method change the Opacity of the ApplicationBar
|
||||
/// </summary>
|
||||
/// <param name="sender">Caller of the function</param>
|
||||
/// <param name="e">some EventArgs</param>
|
||||
private void OpenNewsApp(object sender, RoutedEventArgs e)
|
||||
private void ApplicationBar_StateChanged(object sender, ApplicationBarStateChangedEventArgs e)
|
||||
{
|
||||
Uri url = new Uri(Constants.PathNews_NewsIndexPage, UriKind.Relative);
|
||||
NavigationService.Navigate(url);
|
||||
if (e.IsMenuVisible)
|
||||
{
|
||||
ApplicationBar.Opacity = 0.99;
|
||||
}
|
||||
else
|
||||
{
|
||||
ApplicationBar.Opacity = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// start the EventsApp
|
||||
/// Method show all OptIns
|
||||
/// </summary>
|
||||
/// <param name="sender">Caller of the function</param>
|
||||
/// <param name="e">some EventArgs</param>
|
||||
private void OpenEventsApp(object sender, RoutedEventArgs e)
|
||||
private void ShowOptIns()
|
||||
{
|
||||
Uri url = new Uri(Constants.PathEvents_EventsIndexPage, UriKind.Relative);
|
||||
NavigationService.Navigate(url);
|
||||
this.GeoWatchOptIN();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// start the MensaApp
|
||||
/// Method show the GeoWatchOptIn in a MessageBox
|
||||
/// </summary>
|
||||
/// <param name="sender">Caller of the function</param>
|
||||
/// <param name="e">some EventArgs</param>
|
||||
private void OpenMensaApp(object sender, RoutedEventArgs e)
|
||||
private void GeoWatchOptIN()
|
||||
{
|
||||
Uri url = new Uri(Constants.PathMensa_MensaPage, UriKind.Relative);
|
||||
NavigationService.Navigate(url);
|
||||
}
|
||||
MessageBoxResult result = MessageBox.Show(AppResources.GeoWatch_OptInText, AppResources.GeoWatch_OptInHeader, MessageBoxButton.OKCancel);
|
||||
|
||||
/// <summary>
|
||||
/// start the WebmailApp
|
||||
/// </summary>
|
||||
/// <param name="sender">Caller of the function</param>
|
||||
/// <param name="e">some EventArgs</param>
|
||||
private void OpenWebMailApp(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Uri url = new Uri(Constants.PathMail_WebMailPage, UriKind.Relative);
|
||||
NavigationService.Navigate(url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the opening hours page.
|
||||
/// </summary>
|
||||
/// <param name="sender">opening hours button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void OpenOpeninghoursApp(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Uri url = new Uri(Constants.PathOpeninghours_OpeninghoursPage, UriKind.Relative);
|
||||
NavigationService.Navigate(url);
|
||||
if (result == MessageBoxResult.OK)
|
||||
{
|
||||
Settings.AppSetting.GeoWatchEnable = true;
|
||||
Utilities.DetermineAndStoreCurrentPosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.AppSetting.GeoWatchEnable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||