76 Commits

Author SHA1 Message Date
stubbfel
4a309ad980 Merge branch 'release/r#141' into develmaster 2013-08-08 13:56:34 +02:00
stubbfel
c301f908ad Merge branch 'feature/#141' into develop 2013-08-08 13:55:03 +02:00
stubbfel
6ce158dc41 add optin and doku 2013-08-08 13:51:20 +02:00
stubbfel
e8fe0bb041 new gitignore 2013-08-07 15:17:36 +02:00
stubbfel
b337eefc8c add geowatcher 2013-08-07 15:16:13 +02:00
stubbfel
70d92c7a3b add test access 2013-08-07 11:38:02 +02:00
stubbfel
363baad60c add spsapi 2013-08-06 16:13:29 +02:00
stubbfel
2606e089df Merge branch 'release/r#138#139' into develmaster 2013-08-06 14:53:31 +02:00
stubbfel
a99ff5526c Merge branch 'feature/#138' into develop 2013-08-06 14:11:18 +02:00
stubbfel
64fc09f622 finish 138 2013-08-06 14:11:01 +02:00
stubbfel
a9a96b6ffc instert new mensapp 2013-08-06 14:07:43 +02:00
stubbfel
f79cd5836e add mealmodel 2013-08-06 11:04:43 +02:00
stubbfel
d414e4df47 add fullheaders 2013-08-06 09:46:50 +02:00
stubbfel
4652b82885 Merge branch 'release/#r133' into develmaster 2013-08-05 13:02:56 +02:00
stubbfel
7637b62271 Merge branch 'release/#r133' into develop 2013-08-05 13:02:56 +02:00
stubbfel
55e426f6c2 release fixes 2013-08-05 13:02:39 +02:00
stubbfel
2eea814558 Merge branch 'feature/#133' into develop
Conflicts:
	CampusAppWP8/CampusAppWP8/App.xaml.cs
	CampusAppWP8/CampusAppWP8/Model/Lecture/LecturePageModel.cs
2013-08-05 12:40:14 +02:00
stubbfel
121c728df7 fixes 2013-08-05 11:58:19 +02:00
stubbfel
9a84f847d1 add list to lecture 2013-08-05 11:56:45 +02:00
stubbfel
fa7a84661e finish profilsite 2013-08-05 11:18:32 +02:00
stubbfel
75b6b4501f update20130725 2013-07-25 15:24:24 +02:00
stubbfel
a3014d04c8 add settings to appload 2013-07-25 12:45:56 +02:00
stubbfel
bcceaaaa53 Merge branch 'release/r' into develmaster 2013-07-25 11:08:52 +02:00
stubbfel
6f5496a006 Merge branch 'feature/#refactor' into develop 2013-07-25 11:08:22 +02:00
stubbfel
a366d0e949 formated classes 2013-07-25 11:08:08 +02:00
stubbfel
88320657e9 delete default role and degrre 2013-07-25 10:20:40 +02:00
stubbfel
1136e29034 update gitzignore 2013-07-24 14:00:59 +02:00
stubbfel
759f0a8859 Merge branch 'hotfix/#137' into develop 2013-07-24 12:18:41 +02:00
stubbfel
bf9a612de5 Merge branch 'hotfix/#137' into develmaster 2013-07-24 12:18:14 +02:00
stubbfel
00fb9ca637 update gitzignore 2013-07-24 12:17:58 +02:00
stubbfel
49151c0714 add arrayindex assert 2013-07-24 12:16:48 +02:00
stubbfel
5eedf70604 update gitzignore 2013-07-24 12:12:44 +02:00
stubbfel
c2871bb3d1 add validation userprofile 2013-07-24 11:00:55 +02:00
Christian Fiedler
9abb7de1ec Merge branch 'hotfix/#129' into develop
Conflicts:
	CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs
2013-07-23 16:03:06 +02:00
Christian Fiedler
854dc8b46e Merge branch 'hotfix/#129' into develmaster 2013-07-23 16:02:03 +02:00
Christian Fiedler
96cd4bccb4 #129 2013-07-23 16:01:40 +02:00
stubbfel
6338caea9c add userprofil 2013-07-23 15:35:41 +02:00
Christian Fiedler
3874f2ef06 Merge branch 'hotfix/#123' into develop
Conflicts:
	CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs
2013-07-23 12:39:15 +02:00
Christian Fiedler
c12c76c5ae Merge branch 'hotfix/#123' into develmaster
Conflicts:
	CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs
2013-07-23 12:38:00 +02:00
Christian Fiedler
a3c8f3b9fc #123 2013-07-23 12:35:22 +02:00
stubbfel
dadcc2e965 Merge branch 'release/#r128#130#131' into develmaster 2013-07-23 11:55:23 +02:00
stubbfel
175b871005 Merge branch 'feature/#132' into develop 2013-07-23 11:53:44 +02:00
stubbfel
af57bad869 rm api und xmlapi 2013-07-23 11:53:31 +02:00
stubbfel
932842aebb change to XMLModel 2013-07-23 11:40:59 +02:00
stubbfel
125587f99c Merge branch 'hotfix/#131' into develop 2013-07-23 10:57:19 +02:00
stubbfel
1b52f87950 Merge branch 'hotfix/#131' into develmaster 2013-07-23 10:57:18 +02:00
stubbfel
6b8ec1e8b0 fix #131 2013-07-23 10:57:01 +02:00
stubbfel
5788889ae7 add ifnoimmage 2013-07-23 10:32:57 +02:00
stubbfel
6b5341d1ac finish #128 2013-07-23 10:20:10 +02:00
stubbfel
900cb9111a Merge branch 'release/R#125#127' into develmaster 2013-07-22 18:47:22 +02:00
stubbfel
0df8f72c53 finish #127 2013-07-22 18:45:41 +02:00
stubbfel
970c6ce8e8 finish #125 2013-07-22 18:32:01 +02:00
stubbfel
9662be5632 add updatebutton 2013-07-22 17:18:59 +02:00
stubbfel
6a69aec6eb Merge branch 'feature/#121' into develop 2013-07-22 16:30:39 +02:00
stubbfel
dd7ef6e82e rmfile onsaved 2013-07-22 16:26:03 +02:00
Christian Fiedler
3e3b082463 Merge branch 'hotfix/#122' into develmaster 2013-07-22 16:09:15 +02:00
Christian Fiedler
4a5253c25c Merge branch 'hotfix/#122' into develop 2013-07-22 16:09:15 +02:00
Christian Fiedler
a375fe9008 #122 2013-07-22 16:08:52 +02:00
stubbfel
1d434a394f finish #121 2013-07-22 16:01:25 +02:00
Christian Fiedler
5aee5e266a Merge branch 'release/#109' into develmaster 2013-07-22 15:29:58 +02:00
Christian Fiedler
666b6c9730 Merge branch 'feature/#109' into develop 2013-07-22 15:29:30 +02:00
Christian Fiedler
59503f2d23 #109 2013-07-22 15:27:58 +02:00
stubbfel
43cfeea2d7 Merge branch 'release/r#119' into develmaster 2013-07-22 15:09:11 +02:00
stubbfel
d17b4b7e33 Merge branch 'feature/#119' into develop 2013-07-22 15:08:41 +02:00
stubbfel
b78250401c finish #119 2013-07-22 14:46:44 +02:00
Christian Fiedler
d167dbfb9e Merge branch 'release/#120' into develmaster 2013-07-22 13:48:53 +02:00
Christian Fiedler
0072df1186 #120 2013-07-22 13:48:05 +02:00
Christian Fiedler
218353393e Merge branch 'hotfix/#118' into develop 2013-07-22 11:46:46 +02:00
Christian Fiedler
de91ac2d76 Merge branch 'hotfix/#118' into develmaster 2013-07-22 11:46:45 +02:00
Christian Fiedler
74224a4fc5 #118 2013-07-22 11:46:22 +02:00
Christian Fiedler
0ceb0584d1 #115 2013-07-19 17:45:16 +02:00
Christian Fiedler
88b664284f #115 2013-07-19 17:42:55 +02:00
Christian Fiedler
92614e7128 Merge branch 'release/#103' into develmaster 2013-07-19 17:18:45 +02:00
Christian Fiedler
9eff5be228 Merge branch 'feature/#103' into develop 2013-07-19 17:17:12 +02:00
Christian Fiedler
9ebeaa8147 const 2013-07-19 17:16:36 +02:00
Christian Fiedler
b9f268d594 #103 and fixes in events and news 2013-07-19 17:15:47 +02:00
97 changed files with 3814 additions and 1078 deletions

31
.gitignore vendored
View File

@@ -161,3 +161,34 @@ winphone/
*.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

View 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)
{
}
}
}

View File

@@ -7,10 +7,9 @@
//----------------------------------------------------------------------
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.Feed.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;
}

View File

@@ -23,7 +23,7 @@
<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>

View File

@@ -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)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -93,11 +93,29 @@
<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" />
@@ -204,18 +222,12 @@
<DesignTime>True</DesignTime>
<DependentUpon>Constants.resx</DependentUpon>
</Compile>
<Compile Include="Resources\Icons.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Icons.resx</DependentUpon>
</Compile>
<Compile Include="ThemelizedIcons.cs" />
<Compile Include="Utility\Api.cs" />
<Compile Include="Utility\ApiEventHandler.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" />
@@ -224,7 +236,6 @@
<Compile Include="Utility\Utilities.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Utility\XmlApi.cs" />
<Compile Include="Utility\XmlManager.cs" />
</ItemGroup>
<ItemGroup>
@@ -296,6 +307,10 @@
<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>
@@ -338,6 +353,7 @@
<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" />
@@ -366,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">
@@ -383,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" />
@@ -401,16 +421,29 @@
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Icons.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Icons.Designer.cs</LastGenOutput>
<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" />

View File

@@ -7,13 +7,11 @@
//----------------------------------------------------------------------using System;
namespace CampusAppWP8.Feed.Departments
{
using System;
using System.IO;
using CampusAppWP8.Model;
using CampusAppWP8.Model.Departments;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// Feed object to handle favorite department feeds.
/// </summary>
@@ -28,7 +26,8 @@ namespace CampusAppWP8.Feed.Departments
public DepartmentFavoriteFeed(bool autoLoad = true)
: base(ModelType.File, Constants.FileDepartment_Favorite_Name, string.Empty)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
if (autoLoad == true)
{
@@ -68,7 +67,7 @@ namespace CampusAppWP8.Feed.Departments
/// <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 CheckIsFileUpToDate(DepartmentModel model, FileInfo info)
private bool CheckIsFileUpToDateOnLoad(DepartmentModel model, FileInfo info)
{
bool retValue = false;
@@ -76,11 +75,22 @@ namespace CampusAppWP8.Feed.Departments
{
retValue = true;
}
else
{
retValue = (model.HasChanged() == false) ? true : 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 CheckIsFileUpToDateOnSave(DepartmentModel model, FileInfo info)
{
bool retValue = false;
retValue = (model.HasChanged() == false) ? true : false;
return retValue;
}

View File

@@ -27,8 +27,9 @@ namespace CampusAppWP8.Feed.Departments
public DepartmentFeed(bool autoLoad = true)
: base(ModelType.FileAndFeed, Constants.FileDepartment_Name, Constants.UrlDepartment_Addr)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
if (autoLoad == true)
{
@@ -70,7 +71,7 @@ namespace CampusAppWP8.Feed.Departments
/// <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 CheckIsFileUpToDate(DepartmentModel model, FileInfo info)
private bool CheckIsFileUpToDateOnLoad(DepartmentModel model, FileInfo info)
{
bool retValue = true;
@@ -82,19 +83,30 @@ namespace CampusAppWP8.Feed.Departments
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 7.0);
}
}
else
{
// at saving
if ((info.Exists == false)
|| (info.Length == 0))
{
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 CheckIsFileUpToDateOnSave(DepartmentModel model, FileInfo info)
{
bool retValue = true;
// at saving
if ((info.Exists == false)
|| (info.Length == 0))
{
retValue = false;
}
return retValue;
}
// Protedted
#endregion

View File

@@ -25,8 +25,9 @@ namespace CampusAppWP8.Feed.Events
public EventFeed(bool autoLoad = true)
: base(ModelType.FileAndFeed, Constants.FileEvents_Name, Constants.UrlEvents_Addr)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
if (autoLoad == true)
{
@@ -61,7 +62,7 @@ namespace CampusAppWP8.Feed.Events
/// <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 CheckIsFileUpToDate(RSSViewModel model, FileInfo info)
private bool CheckIsFileUpToDateOnLoad(RSSViewModel model, FileInfo info)
{
bool retValue = true;
@@ -73,16 +74,26 @@ namespace CampusAppWP8.Feed.Events
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0);
}
}
else
{
// at saving
if ((info.Exists == false)
|| (info.Length == 0))
{
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 CheckIsFileUpToDateOnSave(RSSViewModel model, FileInfo info)
{
bool retValue = true;
if ((info.Exists == false)
|| (info.Length == 0))
{
retValue = false;
}
return retValue;
}
}

View File

@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.Link
using CampusAppWP8.Model;
using CampusAppWP8.Model.Link;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// This Class is for ClubLinkFeeds
@@ -26,8 +27,9 @@ namespace CampusAppWP8.Feed.Link
public ClubLinkFeed()
: base(ModelType.FileAndFeed, Constants.FileLink_ClubLinks, Constants.UrlLink_ClubLinks)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
}
#endregion
@@ -60,6 +62,11 @@ namespace CampusAppWP8.Feed.Link
/// <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);
}
@@ -71,16 +78,7 @@ namespace CampusAppWP8.Feed.Link
/// <returns>true, if is up-to-date, otherwise false</returns>
private bool CheckIsUpToDate(DateTime lastModified)
{
DateTime temp = lastModified.AddDays(1);
int diff = temp.CompareTo(DateTime.Now);
if (diff < 0)
{
return false;
}
return true;
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
}
#endregion

View File

@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.Link
using CampusAppWP8.Model;
using CampusAppWP8.Model.Link;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// This Class is for CommonLinkFeeds
@@ -26,8 +27,9 @@ namespace CampusAppWP8.Feed.Link
public CommonLinkFeed()
: base(ModelType.FileAndFeed, Constants.FileLink_CommonLinks, Constants.UrlLink_CommonLinks)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
}
#endregion
@@ -60,6 +62,11 @@ namespace CampusAppWP8.Feed.Link
/// <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);
}
@@ -71,16 +78,7 @@ namespace CampusAppWP8.Feed.Link
/// <returns>true, if is up-to-date, otherwise false</returns>
private bool CheckIsUpToDate(DateTime lastModified)
{
DateTime temp = lastModified.AddDays(1);
int diff = temp.CompareTo(DateTime.Now);
if (diff < 0)
{
return false;
}
return true;
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
}
#endregion

View File

@@ -26,8 +26,9 @@ namespace CampusAppWP8.Feed.Mensa
public MensaFeed()
: base(ModelType.FileAndFeed, Constants.FileMensa_Shedule, Constants.UrlMensa_Week)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
}
#endregion
@@ -60,6 +61,11 @@ namespace CampusAppWP8.Feed.Mensa
/// <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);
}

View File

@@ -25,8 +25,9 @@ namespace CampusAppWP8.Feed.News
public NewsFeed(bool autoLoad = true)
: base(ModelType.FileAndFeed, Constants.FileNews_Name, Constants.UrlNews_Addr)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
if (autoLoad == true)
{
@@ -61,28 +62,37 @@ namespace CampusAppWP8.Feed.News
/// <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 CheckIsFileUpToDate(RSSViewModel model, FileInfo info)
private bool CheckIsFileUpToDateOnLoad(RSSViewModel model, FileInfo info)
{
bool retValue = true;
if (model == null)
{
// at loading
if (info.Exists == true)
{
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0);
}
}
else
{
// at saving
if ((info.Exists == false)
|| (info.Length == 0))
{
retValue = false;
}
}
return retValue;
}
/// <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;
}
}

View File

@@ -7,12 +7,12 @@
//----------------------------------------------------------------------
namespace CampusAppWP8.Feed.Openinghours
{
using System;
using System.IO;
using CampusAppWP8.Model;
using CampusAppWP8.Model.Openinghours;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// This Class is for MesaFeeds
/// </summary>
@@ -26,8 +26,9 @@ namespace CampusAppWP8.Feed.Openinghours
public OpeninghoursFeed()
: base(ModelType.FileAndFeed, Constants.FileOpeningHours_OpeningHours, Constants.UrlOpeningHours_OpeningHours)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
}
#endregion
@@ -43,35 +44,58 @@ namespace CampusAppWP8.Feed.Openinghours
/// <returns>true, if model is up-to-date, otherwise false</returns>
private bool CheckIsModelUpToDate(OpeninghoursModel model)
{
bool retValue = true;
if (model == null)
{
return false;
retValue = false;
}
else
{
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 7.0);
}
DateTime lastModified = model.CreateTime;
return this.CheckIsUpToDate(lastModified);
return retValue;
}
/// <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>
/// <param name="info">info about the file</param>
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDate(OpeninghoursModel model, FileInfo fileInfo)
private bool CheckIsFileUpToDateOnLoad(OpeninghoursModel model, FileInfo info)
{
DateTime lastModified = fileInfo.LastWriteTime;
return this.CheckIsUpToDate(lastModified);
bool retValue = true;
if (model == null)
{
if (info.Exists == true)
{
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 7.0);
}
}
return retValue;
}
/// <summary>
/// Check if the model or file is up-to-date.
/// Method check if the FeedFile 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>
/// <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)
{
return true;
bool retValue = true;
if ((info.Exists == false)
|| (info.Length == 0))
{
retValue = false;
}
return retValue;
}
#endregion

View File

@@ -12,6 +12,7 @@ namespace CampusAppWP8.Feed.StudentCouncil
using CampusAppWP8.Model;
using CampusAppWP8.Model.StudentCouncil;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
/// <summary>
/// This Class is for StudentCouncilFeed
@@ -26,8 +27,9 @@ namespace CampusAppWP8.Feed.StudentCouncil
public StudentCouncilFeed()
: base(ModelType.FileAndFeed, Constants.FileStudentCouncil_StudentCouncils, Constants.UrlStudentCouncil_StudentCouncils)
{
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
}
#endregion
@@ -60,6 +62,11 @@ namespace CampusAppWP8.Feed.StudentCouncil
/// <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);
}
@@ -71,16 +78,7 @@ namespace CampusAppWP8.Feed.StudentCouncil
/// <returns>true, if is up-to-date, otherwise false</returns>
private bool CheckIsUpToDate(DateTime lastModified)
{
DateTime temp = lastModified.AddDays(1);
int diff = temp.CompareTo(DateTime.Now);
if (diff < 0)
{
return false;
}
return true;
return Utilities.DayDifference(Utilities.DifferenceType.Less, lastModified, 7.0);
}
#endregion

View 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;
}
}
}

View File

@@ -72,7 +72,7 @@ namespace CampusAppWP8.Model.Departments
/// Check if the content of the faculty lists hast changed since the
/// last call of this function.
/// </summary>
/// <returns>true, if changes happend since last request, otherwise false</returns>
/// <returns>true, if changes happen since last request, otherwise false</returns>
public bool HasChanged()
{
bool retValue = false;

View File

@@ -221,7 +221,7 @@ namespace CampusAppWP8.Model.Departments
/// <summary>
/// Return true if there were changes in the chair list, otherwise false.
/// </summary>
/// <param name="reset">when true, the hasChanged flag will be reseted</param>
/// <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)
{

View 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; }
}
}

View 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; }
}
}

View File

@@ -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);

View File

@@ -62,6 +62,5 @@ namespace CampusAppWP8.Model.Lecture
/// </summary>
[XmlElement("enddatum")]
public string EndDate { get; set; }
}
}

View File

@@ -7,11 +7,9 @@
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Lecture
{
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using CampusAppWP8.Model.Setting;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Resources;
/// <summary>
/// Model for the LecturePage
@@ -21,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
@@ -53,6 +86,9 @@ namespace CampusAppWP8.Model.Lecture
/// </summary>
public LecturePageModel()
{
this.courseList = new CourseListPickerItemListModel();
this.degreeList = new DegreeListPickerItemListModel();
this.semesterList = new SemesterListPickerItemListModel();
}
#endregion
@@ -61,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
{
@@ -102,7 +203,7 @@ namespace CampusAppWP8.Model.Lecture
/// <summary>
/// Gets List of the degrees
/// </summary>
public List<ListPickerItemModel> DegreeList
public ListPickerItemListModel DegreeList
{
get
{
@@ -113,7 +214,7 @@ namespace CampusAppWP8.Model.Lecture
/// <summary>
/// Gets List of the semester
/// </summary>
public List<ListPickerItemModel> SemesterList
public ListPickerItemListModel SemesterList
{
get
{
@@ -124,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
@@ -142,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
@@ -155,95 +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" });
this.numberList.Add(new ListPickerItemModel() { Text = "5", Value = "5" });
this.numberList.Add(new ListPickerItemModel() { Text = "5", Value = "6" });
this.numberList.Add(new ListPickerItemModel() { Text = "7", Value = "7" });
this.numberList.Add(new ListPickerItemModel() { Text = "8", Value = "8" });
this.numberList.Add(new ListPickerItemModel() { Text = "9", Value = "9" });
this.numberList.Add(new ListPickerItemModel() { Text = "10", Value = "10" });
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" });
this.courseList = this.courseList.OrderBy(o => o.Text).ToList();
}
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

View File

@@ -8,11 +8,13 @@
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>
@@ -49,6 +51,11 @@ namespace CampusAppWP8
/// </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>
@@ -57,25 +64,27 @@ namespace CampusAppWP8
/// <param name="url">url of the feed</param>
public MainModel(ModelType modelType, string fileName, string url)
{
this.modelType = modelType;
this.Init(modelType, fileName, url);
}
if ((url != null) && (url.Equals(string.Empty) == false))
/// <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.httpApiUri = new Uri(url, UriKind.Absolute);
this.Init(modelType, sourceName, string.Empty);
}
this.fileName = fileName;
if ((this.IsFile() == true)
&& (fileName.Equals(string.Empty) == false))
else if (modelType == ModelType.Feed)
{
this.InitFile(CampusAppWP8.Utility.File.IOTypeRead.ReadSync, CampusAppWP8.Utility.File.IOTypeWrite.WriteAsync);
this.Init(modelType, string.Empty, sourceName);
}
if ((this.IsHttpApi() == true)
&& (url.Equals(string.Empty) == false))
else
{
this.InitHttpApi();
throw new NotSupportedException("Wrong constructor was called for Feed and File support.");
}
}
@@ -143,14 +152,25 @@ namespace CampusAppWP8
public event OnSaved onSaved = null;
/// <summary>
/// Callback pointer, for checking if file is up to date.
/// Callback pointer, for checking if file is up to date at loading.
/// </summary>
public event IsFileUpToDate isFileUpToDate = null;
public event IsFileUpToDate isFileUpToDateOnLoad = null;
/// <summary>
/// Callback pointer, for checking if model is up to date.
/// Callback pointer, for checking if file is up to date at saving.
/// </summary>
public event IsModelUpToDate isModelUpToDate = null;
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.
@@ -216,7 +236,6 @@ namespace CampusAppWP8
this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete);
}
}
/// <summary>
@@ -232,8 +251,8 @@ namespace CampusAppWP8
this.onLoading();
}
if (((this.isModelUpToDate == null)
|| (this.isModelUpToDate(this.model) == false))
if (((this.isModelUpToDateOnLoad == null)
|| (this.isModelUpToDateOnLoad(this.model) == false))
&& ((this.file != null) || this.api != null))
{
if (this.file != null)
@@ -244,8 +263,8 @@ namespace CampusAppWP8
loadFromFile = false;
}
if (((this.isFileUpToDate != null) && (this.isFileUpToDate(this.model, this.file.GetFileInfo()) == false))
|| (this.isFileUpToDate == null))
if (((this.isFileUpToDateOnLoad != null) && (this.isFileUpToDateOnLoad(this.model, this.file.GetFileInfo()) == false))
|| (this.isFileUpToDateOnLoad == null))
{
loadFromFile = false;
}
@@ -262,7 +281,14 @@ namespace CampusAppWP8
if (loadFromFile == false)
{
this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete);
if (this.paramizedUri != null)
{
this.api.HttpGet(this.paramizedUri, this.OnLoadDataComplete);
}
else
{
this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete);
}
}
else
{
@@ -287,10 +313,13 @@ namespace CampusAppWP8
/// <summary>
/// Save the model data if necessary.
/// </summary>
public void SaveData()
/// <param name="force">force saving. DEFAULT: false</param>
public void SaveData(bool force = false)
{
if ((this.file != null)
&& ((this.isFileUpToDate == null) || (this.isFileUpToDate(this.model, this.file.GetFileInfo()) == false)))
&& ((this.isFileUpToDateOnSave == null)
|| (this.isFileUpToDateOnSave(this.model, this.file.GetFileInfo()) == false)
|| (force == true)))
{
if (this.onSaving != null)
{
@@ -298,6 +327,7 @@ namespace CampusAppWP8
}
byte[] data = this.SerializeModel();
string test = Encoding.UTF8.GetString(data, 0, data.Length);
this.file.WriteFile(data);
if (this.onSaved != null)
@@ -325,6 +355,26 @@ namespace CampusAppWP8
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>
@@ -370,6 +420,36 @@ namespace CampusAppWP8
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>
@@ -392,7 +472,7 @@ namespace CampusAppWP8
if ((this.IsHttpApi() == true)
&& (this.api == null))
{
this.api = new HttpRequest();
this.api = new HttpRequest(this.httpApiUri);
}
}

View 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
}
}

View File

@@ -11,6 +11,8 @@ namespace CampusAppWP8.Model.Mensa
using System.Xml.Serialization;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using System.Collections.ObjectModel;
using System.Globalization;
/// <summary>
/// Model for menu
@@ -19,36 +21,6 @@ namespace CampusAppWP8.Model.Mensa
{
#region Member
/// <summary>
/// Name for bio dinner
/// </summary>
private string bio = AppResources.MensaApp_NotToday;
/// <summary>
/// Name for 1. dinner
/// </summary>
private string dinner1 = AppResources.MensaApp_NotToday;
/// <summary>
/// Name for 2. dinner
/// </summary>
private string dinner2 = AppResources.MensaApp_NotToday;
/// <summary>
/// Name for 3. dinner
/// </summary>
private string dinner3 = AppResources.MensaApp_NotToday;
/// <summary>
/// Name for 4. dinner
/// </summary>
private string dinner4 = AppResources.MensaApp_NotToday;
/// <summary>
/// Name for action dinner
/// </summary>
private string action = AppResources.MensaApp_NotToday;
/// <summary>
/// Name of the day
/// </summary>
@@ -57,7 +29,7 @@ namespace CampusAppWP8.Model.Mensa
/// <summary>
/// DateTime of the day
/// </summary>
private DateTime date;
private string date;
/// <summary>
/// DateTime of the monday
@@ -80,10 +52,16 @@ namespace CampusAppWP8.Model.Mensa
#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>
[XmlElement("Wochentag")]
[XmlAttribute("day")]
public string Day
{
get
@@ -93,19 +71,22 @@ namespace CampusAppWP8.Model.Mensa
set
{
this.SetValue(value, ref this.dayName);
this.CalcDateOfDay();
if (value != this.dayName)
{
this.dayName = value;
}
}
}
/// <summary>
/// Gets or sets of Date
/// </summary>
public DateTime Date
[XmlAttribute("date")]
public string Date
{
get
{
return this.date;
return this.date.ToString();
}
set
@@ -117,153 +98,6 @@ namespace CampusAppWP8.Model.Mensa
}
}
/// <summary>
/// Gets or sets dinner 1
/// </summary>
[XmlElement("Essen1")]
public string Dinner1
{
get
{
return this.dinner1;
}
set
{
this.SetValue(value, ref this.dinner1);
}
}
/// <summary>
/// Gets or sets dinner 2
/// </summary>
[XmlElement("Essen2")]
public string Dinner2
{
get
{
return this.dinner2;
}
set
{
this.SetValue(value, ref this.dinner2);
}
}
/// <summary>
/// Gets or sets dinner 3
/// </summary>
[XmlElement("Essen3")]
public string Dinner3
{
get
{
return this.dinner3;
}
set
{
this.SetValue(value, ref this.dinner3);
}
}
/// <summary>
/// Gets or sets dinner 4
/// </summary>
[XmlElement("Essen4")]
public string Dinner4
{
get
{
return this.dinner4;
}
set
{
this.SetValue(value, ref this.dinner4);
}
}
/// <summary>
/// Gets or sets dinner bio
/// </summary>
[XmlElement("Bio")]
public string Bio
{
get
{
return this.bio;
}
set
{
this.SetValue(value, ref this.bio);
}
}
/// <summary>
/// Gets or sets dinner action
/// </summary>
[XmlElement("Aktionstag")]
public string Action
{
get
{
return this.action;
}
set
{
this.SetValue(value, ref this.action);
}
}
#endregion
#region Method
/// <summary>
/// Methods sets the property
/// </summary>
/// <remarks> maybe move to base class</remarks>
/// <param name="value">new property value</param>
/// <param name="property">name of the property</param>
private void SetValue(string value, ref string property)
{
if (value != null && !string.Empty.Equals(value) && !value.Equals(property))
{
property = StringManager.StripHTML(value);
}
}
/// <summary>
/// Method calculate the DateTime of the MenuDay
/// </summary>
private void CalcDateOfDay()
{
switch (this.dayName)
{
case "Montag":
this.date = this.monday;
break;
case "Diensttag":
this.date = this.monday.AddDays(1);
break;
case "Mittwoch":
this.date = this.monday.AddDays(2);
break;
case "Donnerstag":
this.date = this.monday.AddDays(3);
break;
case "Freitag":
this.date = this.monday.AddDays(4);
break;
default:
this.date = this.monday;
break;
}
}
#endregion
}
}

View File

@@ -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>

View File

@@ -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
}
}

View File

@@ -8,6 +8,7 @@
namespace CampusAppWP8.Model.RSS
{
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Xml.Serialization;
/// <summary>
@@ -26,6 +27,7 @@ namespace CampusAppWP8.Model.RSS
public RSSChannelModel()
{
this.item = new ObservableCollection<RSSModel>();
this.item.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
}
/// <summary>
@@ -44,13 +46,25 @@ namespace CampusAppWP8.Model.RSS
if (value != this.item)
{
this.item = value;
int i = 0;
foreach (RSSModel rssItem in this.item)
{
rssItem.Index = i++;
}
}
}
}
/// <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;
}
}
}
}

View 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);
}
}
}
}

View 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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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>

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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

View File

@@ -26,8 +26,26 @@ namespace CampusAppWP8.Model
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>
@@ -39,7 +57,7 @@ namespace CampusAppWP8.Model
string data = Encoding.UTF8.GetString(modelData, 0, modelData.Length);
T tempModel = XmlManager.DeserializationToModel<T>(data, Constants.XMLRootElementName);
T tempModel = XmlManager.DeserializationToModel<T>(data, this.ValidRootName);
if (tempModel != null)
{
this.Model = tempModel;

View File

@@ -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
{

View File

@@ -11,6 +11,7 @@ namespace CampusAppWP8.Pages.Departments
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Model.Departments;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
@@ -24,12 +25,24 @@ namespace CampusAppWP8.Pages.Departments
/// </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>
@@ -39,7 +52,48 @@ namespace CampusAppWP8.Pages.Departments
/// <param name="e">event args</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
this.ContentPanel.ItemsSource = DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].Chairs;
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>

View File

@@ -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}"
@@ -65,7 +66,7 @@
<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>
@@ -74,4 +75,9 @@
</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>

View File

@@ -55,6 +55,44 @@ namespace CampusAppWP8.Pages.Departments
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>
@@ -156,5 +194,16 @@ namespace CampusAppWP8.Pages.Departments
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();
}
}
}

View File

@@ -54,7 +54,7 @@
</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>
</Grid>
</Button>
<!--info button-->
<Button x:Name="InfoBtn" BorderBrush="Transparent" Tag="{Binding Url}" Click="InfoBtn_Click" HorizontalContentAlignment="Left">

View File

@@ -12,6 +12,7 @@ namespace CampusAppWP8.Pages.Departments
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Model.Departments;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
@@ -30,12 +31,19 @@ namespace CampusAppWP8.Pages.Departments
/// </summary>
private FrameworkElement lastClickedBtn = null;
/// <summary>
/// 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()
{
this.InitializeComponent();
this.isNewInstance = true;
}
/// <summary>
@@ -47,6 +55,27 @@ namespace CampusAppWP8.Pages.Departments
{
base.OnNavigatedTo(e);
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;
@@ -72,6 +101,20 @@ namespace CampusAppWP8.Pages.Departments
}
}
/// <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_DepartmentModel, DepartmentIndexPage.Feed.GetModel());
}
}
/// <summary>
/// On orientation changed.
/// </summary>

View File

@@ -36,11 +36,18 @@
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<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 ListButtonStyle}">
<TextBlock TextWrapping="Wrap" Text="{Binding Title}" />
</lui:NavigateButton>
<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>

View File

@@ -7,11 +7,12 @@
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Pages.Events
{
using System.Linq;
using System;
using System.Windows.Navigation;
using CampusAppWP8.Feed.Events;
using CampusAppWP8.Utility;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
/// <summary>
/// Overview page of all events.
@@ -30,6 +31,12 @@ namespace CampusAppWP8.Pages.Events
{
this.InitializeComponent();
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);
@@ -39,6 +46,25 @@ namespace CampusAppWP8.Pages.Events
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>
@@ -66,5 +92,16 @@ namespace CampusAppWP8.Pages.Events
{
this.EventList.ItemsSource = EventIndexPage.eventFeed.Model.Channel[0].Item;
}
/// <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 EventForceUpdate_Click(object sender, EventArgs e)
{
EventIndexPage.eventFeed.ForceWebUpdate();
}
}
}

View File

@@ -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>

View File

@@ -8,28 +8,51 @@
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.Shell;
/// <summary>
/// EventPage, where every event fees has his own PivotItem.
/// </summary>
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>
@@ -42,6 +65,27 @@ 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)
{
@@ -52,7 +96,7 @@ namespace CampusAppWP8.Pages.Events
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);
@@ -63,21 +107,49 @@ namespace CampusAppWP8.Pages.Events
}
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>
@@ -87,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);
}
}
}

View File

@@ -55,7 +55,7 @@
<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}}" >
<toolkit:ListPicker Name="Course" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderCourse, Source={StaticResource LocalizedStrings}}" >
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
@@ -77,7 +77,7 @@
<StackPanel >
<!-- Listpicket of degree-->
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Degree, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker Name="Degree" ExpansionMode="FullScreenOnly">
<toolkit:ListPicker Name="Degree" ExpansionMode="FullScreenOnly" SelectionChanged="DegreeSelectionChanged" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderDegree, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
@@ -100,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" ExpansionMode="FullScreenOnly">
<toolkit:ListPicker Width="60" Name="From" ExpansionMode="FullScreenOnly" SelectionChanged="FromSelectionChanged" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderSemester, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
@@ -117,7 +117,7 @@
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<TextBlock Text="bis" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<toolkit:ListPicker Width="60" Name="To" ExpansionMode="FullScreenOnly">
<toolkit:ListPicker Width="60" Name="To" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderSemester, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
@@ -132,7 +132,7 @@
</Border>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
</StackPanel>
</StackPanel>
@@ -141,7 +141,7 @@
<StackPanel>
<!-- Listpicket of semster -->
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Semester, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker Name="Semester" ExpansionMode="FullScreenOnly">
<toolkit:ListPicker Name="Semester" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeaderSemester, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>

View File

@@ -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.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

View File

@@ -57,9 +57,11 @@
<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="50"/>
<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>
<lui:NavigateButton toolkit:TiltEffect.IsTiltEnabled="True" Name="Details" Content="Details" Url="{Binding Path=Constants.PathLecture_ResultDetailPage, Source={StaticResource Const}}" QuerryStringValue="{Binding Id}" QuerryStringName="{Binding Path=Constants.ParamModelLecture_ActivityId, Source={StaticResource Const}}"/>
</StackPanel>
</StackPanel>
</StackPanel>

View File

@@ -9,8 +9,6 @@ namespace CampusAppWP8.Pages.Lecture
{
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Model.Lecture;
using CampusAppWP8.Resources;

View File

@@ -58,5 +58,9 @@
</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>

View File

@@ -7,6 +7,7 @@
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Links
{
using System;
using System.Windows.Navigation;
using CampusAppWP8.Feed.Link;
using Microsoft.Phone.Controls;
@@ -66,6 +67,16 @@ namespace CampusAppWP8.Pages.Links
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
@@ -113,7 +124,7 @@ namespace CampusAppWP8.Pages.Links
if (this.loadingFeeds < 1)
{
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
}
}
@@ -127,7 +138,7 @@ namespace CampusAppWP8.Pages.Links
if (this.loadingFeeds < 1)
{
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
}
}
}
/// <summary>
@@ -146,6 +157,19 @@ namespace CampusAppWP8.Pages.Links
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

View File

@@ -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"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
@@ -18,123 +19,48 @@
<!--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 Day}" />
<TextBlock Text="{Binding Date}" FontSize="34" Margin="6,0,0,0"/>
</StackPanel>
</DataTemplate>
</phone:Pivot.HeaderTemplate>
<phone:Pivot.ItemTemplate>
<DataTemplate>
<StackPanel Margin="12,0,12,0">
<TextBlock Text="{Binding Date, StringFormat='{}{0:dd.MM.yyyy}'}"/>
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<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>
<!-- Dinner 1 -->
<Border Grid.Row="0" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,0,0,0" Padding="0,12,0,12">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Dinner1, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
<TextBlock Text=" : "/>
</StackPanel>
<TextBlock Grid.Column="1" Text="{Binding Dinner1}" TextWrapping="Wrap"/>
</Grid>
</Border>
<!-- Dinner 2 -->
<Border Grid.Row="1" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Dinner2, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
<TextBlock Text=" : "/>
</StackPanel>
<TextBlock Grid.Column="1" Text="{Binding Dinner2}" TextWrapping="Wrap"/>
</Grid>
</Border>
<!-- Dinner 3 -->
<Border Grid.Row="2" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Dinner3, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
<TextBlock Text=" : "/>
</StackPanel>
<TextBlock Grid.Column="1" Text="{Binding Dinner3}" TextWrapping="Wrap"/>
</Grid>
</Border>
<!-- Dinner 4 -->
<Border Grid.Row="3" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Dinner4, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
<TextBlock Text=" : "/>
</StackPanel>
<TextBlock Grid.Column="1" Text="{Binding Dinner4}" TextWrapping="Wrap"/>
</Grid>
</Border>
<!-- Bio-->
<Border Grid.Row="4" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Bio, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
<TextBlock Text=" : "/>
</StackPanel>
<TextBlock Grid.Column="1" Text="{Binding Bio}" TextWrapping="Wrap"/>
</Grid>
</Border>
<Border Grid.Row="5" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Action, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
<TextBlock Text=" : "/>
</StackPanel>
<TextBlock Grid.Column="1" Text="{Binding Action}" TextWrapping="Wrap"/>
</Grid>
</Border>
</Grid>
</ScrollViewer>
</StackPanel>
</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>

View File

@@ -24,6 +24,8 @@ namespace CampusAppWP8.Pages.Mensa
/// </summary>
private MensaFeed feed;
// private SpsApi spsApi;
/// <summary>
/// Index representing the weekday of today
/// 0 - Monday(Default)
@@ -34,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
@@ -64,9 +71,44 @@ namespace CampusAppWP8.Pages.Mensa
{
this.InitializeFeed();
}
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
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
@@ -80,7 +122,6 @@ namespace CampusAppWP8.Pages.Mensa
this.CalcSelectedIndex();
}
/// <summary>
/// Method will be execute if the feed is ready
/// </summary>
@@ -130,7 +171,22 @@ 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
}
}

View File

@@ -36,12 +36,18 @@
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<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 ListButtonStyle}">
<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>
</lui:NavigateButton>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</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>

View File

@@ -7,11 +7,12 @@
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Pages.News
{
using System.Linq;
using System;
using System.Windows.Navigation;
using CampusAppWP8.Feed.News;
using CampusAppWP8.Utility;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
/// <summary>
/// Overview page of all news.
@@ -30,6 +31,12 @@ namespace CampusAppWP8.Pages.News
{
this.InitializeComponent();
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);
@@ -39,6 +46,25 @@ namespace CampusAppWP8.Pages.News
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>
@@ -66,5 +92,16 @@ namespace CampusAppWP8.Pages.News
{
this.NewsList.ItemsSource = NewsIndexPage.newsFeed.Model.Channel[0].Item;
}
/// <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 NewsForceUpdate_Click(object sender, EventArgs e)
{
NewsIndexPage.newsFeed.ForceWebUpdate();
}
}
}

View File

@@ -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>

View File

@@ -13,7 +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.Shell;
/// <summary>
/// EventPage, where every news fees has his own PivotItem.
@@ -25,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>
@@ -42,7 +64,28 @@ 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)
{
@@ -53,7 +96,7 @@ namespace CampusAppWP8.Pages.News
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);
@@ -70,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>
@@ -88,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);
}
}
}

View File

@@ -126,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>

View File

@@ -7,8 +7,11 @@
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Openinghours
{
using System;
using System.Windows.Navigation;
using CampusAppWP8.Feed.Openinghours;
using CampusAppWP8.Model.Openinghours;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
/// <summary>
@@ -23,6 +26,11 @@ namespace CampusAppWP8.Pages.Openinghours
/// </summary>
private OpeninghoursFeed feed = null;
/// <summary>
/// for checking if the instance is new or a tombstone.
/// </summary>
private bool isNewInstance = false;
#endregion
#region Constructor
@@ -33,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
@@ -49,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.LoadData();
}
// protected
@@ -67,34 +107,32 @@ namespace CampusAppWP8.Pages.Openinghours
#region private
/// <summary>
/// Initialize the opening hours feed.
/// </summary>
private void InitializeFeed()
{
this.feed = new OpeninghoursFeed();
this.feed.onLoaded += new OpeninghoursFeed.OnLoaded(this.FeedIsReady);
}
/// <summary>
/// Will be execute if the feed is ready.
/// </summary>
private void FeedIsReady()
{
this.SetupInstitutionList();
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
this.InstitutionPanel.ItemsSource = this.feed.Model.Institutions;
// this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
// this.feed.SaveData(true);
}
/// <summary>
/// Setup the institution list.
/// On clicking the update button in the ApplicationBar.
/// Force a data update from the web.
/// </summary>
private void SetupInstitutionList()
/// <param name="sender">button object</param>
/// <param name="e">event args</param>
private void OpenHoursForceUpdate_Click(object sender, EventArgs e)
{
this.InstitutionPanel.ItemsSource = this.feed.Model.Institutions;
// this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.feed.ForceWebUpdate();
}
// private
#endregion
// Method
#endregion
}

View 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>

View 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);
}
}
}
}

View File

@@ -137,5 +137,11 @@
<!-- <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>

View File

@@ -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,6 +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 (Settings.AppSetting.InitApp)
{
this.ShowOptIns();
Settings.AppSetting.InitApp = true;
}
}
/// <summary>
@@ -51,8 +64,8 @@ namespace CampusAppWP8.Pages
HomeworkAppButtonText.Text = AppResources.HomeworkApp_Title;
ContentPanel.RowDefinitions[3].Height = GridLength.Auto;
ContentPanel.ColumnDefinitions[3].Width = new GridLength(1, GridUnitType.Star);
}
ContentPanel.ColumnDefinitions[3].Width = new GridLength(1, GridUnitType.Star);
}
else
{
// If not in portrait, move buttonList content to visible row and column.
@@ -69,15 +82,63 @@ namespace CampusAppWP8.Pages
HomeworkAppButtonText.Text = AppResources.HomeworkApp_Title2;
ContentPanel.RowDefinitions[3].Height = new GridLength(1,GridUnitType.Star);
ContentPanel.RowDefinitions[3].Height = new GridLength(1, GridUnitType.Star);
ContentPanel.ColumnDefinitions[3].Width = GridLength.Auto;
}
}
private void OpenDepartmentApp(object sender, RoutedEventArgs e)
/// <summary>
/// Method Navigate to <see cref="Setting/UserProfil"/>
/// </summary>
/// <param name="sender">Caller of the function</param>
/// <param name="e">some EventArgs</param>
private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
{
Uri url = new Uri(Constants.PathDepartment_DepartmentIndexPage, UriKind.Relative);
Uri url = new Uri(Constants.PathSetting_User, UriKind.Relative);
NavigationService.Navigate(url);
}
/// <summary>
/// Method change the Opacity of the ApplicationBar
/// </summary>
/// <param name="sender">Caller of the function</param>
/// <param name="e">some EventArgs</param>
private void ApplicationBar_StateChanged(object sender, ApplicationBarStateChangedEventArgs e)
{
if (e.IsMenuVisible)
{
ApplicationBar.Opacity = 0.99;
}
else
{
ApplicationBar.Opacity = 0.5;
}
}
/// <summary>
/// Method show all OptIns
/// </summary>
private void ShowOptIns()
{
this.GeoWatchOptIN();
}
/// <summary>
/// Method show the GeoWatchOptIn in a MessageBox
/// </summary>
private void GeoWatchOptIN()
{
MessageBoxResult result = MessageBox.Show(AppResources.GeoWatch_OptInText, AppResources.GeoWatch_OptInHeader, MessageBoxButton.OKCancel);
if (result == MessageBoxResult.OK)
{
Settings.AppSetting.GeoWatchEnable = true;
Utilities.DetermineAndStoreCurrentPosition();
}
else
{
Settings.AppSetting.GeoWatchEnable = false;
}
}
}
}

View File

@@ -52,5 +52,9 @@
</phone:Pivot.ItemTemplate>
</phone:Pivot>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
<lui:UpdateButtonAppBar Click="StudentForceUpdate_Click"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -10,6 +10,7 @@ namespace CampusAppWP8.Pages.StudentCouncil
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using CampusAppWP8.Feed.StudentCouncil;
using System;
/// <summary>
/// Class for the StudentCouncilPage
@@ -58,6 +59,15 @@ namespace CampusAppWP8.Pages.StudentCouncil
this.feed.LoadData();
}
/// <summary>
/// Override the OnNavigatedFrom method
/// </summary>
/// <param name="e">Arguments of navigation</param>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
this.feed.SaveData();
}
#endregion
#region private
@@ -87,6 +97,18 @@ namespace CampusAppWP8.Pages.StudentCouncil
this.StudentCouncilPivot.ItemsSource = this.feed.Model.GetStudentCouncilsGroupByFaculty();
}
/// <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 StudentForceUpdate_Click(object sender, EventArgs e)
{
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.feed.ForceWebUpdate();
}
#endregion
#endregion

View File

@@ -19,9 +19,9 @@
<Tokens>
<PrimaryToken TokenID="CampusAppWP8Token" TaskName="_default">
<TemplateFlip>
<SmallImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileSmall.png</SmallImageURI>
<SmallImageURI IsRelative="true" IsResource="false">Assets\Tiles\kachel_small.png</SmallImageURI>
<Count>0</Count>
<BackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileMedium.png</BackgroundImageURI>
<BackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\kachel_medium.png</BackgroundImageURI>
<Title>CampusAppWP8</Title>
<BackContent>
</BackContent>
@@ -29,10 +29,13 @@
</BackBackgroundImageURI>
<BackTitle>
</BackTitle>
<LargeBackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\kachel_large.png</LargeBackgroundImageURI>
<LargeBackContent />
<LargeBackBackgroundImageURI IsRelative="true" IsResource="false">
</LargeBackBackgroundImageURI>
<DeviceLockImageURI>
</DeviceLockImageURI>
<HasLarge>
</HasLarge>
<HasLarge>True</HasLarge>
</TemplateFlip>
</PrimaryToken>
</Tokens>

View File

@@ -204,6 +204,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Ortung ähnelt.
/// </summary>
public static string GeoWatch_OptInHeader {
get {
return ResourceManager.GetString("GeoWatch_OptInHeader", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Dürfen Positionsdaten enhober und verwendet werdet? ähnelt.
/// </summary>
public static string GeoWatch_OptInText {
get {
return ResourceManager.GetString("GeoWatch_OptInText", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
/// </summary>
@@ -303,15 +321,6 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Studiengangauswahl ähnelt.
/// </summary>
public static string LectureApp_ListPickerHeaderCourse {
get {
return ResourceManager.GetString("LectureApp_ListPickerHeaderCourse", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Verantwortlicher ähnelt.
/// </summary>
@@ -384,6 +393,42 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Studiengangsauswahl ähnelt.
/// </summary>
public static string ListPickerHeaderCourse {
get {
return ResourceManager.GetString("ListPickerHeaderCourse", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Abschlussauswahl ähnelt.
/// </summary>
public static string ListPickerHeaderDegree {
get {
return ResourceManager.GetString("ListPickerHeaderDegree", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Rollenauswahl ähnelt.
/// </summary>
public static string ListPickerHeaderRole {
get {
return ResourceManager.GetString("ListPickerHeaderRole", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Semesterauswahl ähnelt.
/// </summary>
public static string ListPickerHeaderSemester {
get {
return ResourceManager.GetString("ListPickerHeaderSemester", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Webmail ähnelt.
/// </summary>
@@ -447,6 +492,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 5 ähnelt.
/// </summary>
public static string MensaApp_Dinner5 {
get {
return ResourceManager.GetString("MensaApp_Dinner5", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die 84 ähnelt.
/// </summary>
@@ -465,6 +519,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Suppe ähnelt.
/// </summary>
public static string MensaApp_Soup {
get {
return ResourceManager.GetString("MensaApp_Soup", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Mensaplan ähnelt.
/// </summary>
@@ -573,6 +636,78 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Mitarbeiter ähnelt.
/// </summary>
public static string Setting_RoleStaff {
get {
return ResourceManager.GetString("Setting_RoleStaff", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Student ähnelt.
/// </summary>
public static string Setting_RoleStudent {
get {
return ResourceManager.GetString("Setting_RoleStudent", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Profileinstellungen ähnelt.
/// </summary>
public static string Setting_User {
get {
return ResourceManager.GetString("Setting_User", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt.
/// </summary>
public static string Setting_UserCourse {
get {
return ResourceManager.GetString("Setting_UserCourse", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Abschluss ähnelt.
/// </summary>
public static string Setting_UserDegree {
get {
return ResourceManager.GetString("Setting_UserDegree", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Profileinstellungen ähnelt.
/// </summary>
public static string Setting_UserProfilAppBarTitle {
get {
return ResourceManager.GetString("Setting_UserProfilAppBarTitle", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Rolle ähnelt.
/// </summary>
public static string Setting_UserRole {
get {
return ResourceManager.GetString("Setting_UserRole", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Semster ähnelt.
/// </summary>
public static string Setting_UserSemester {
get {
return ResourceManager.GetString("Setting_UserSemester", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Freitag ähnelt.
/// </summary>
@@ -645,6 +780,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Aktualisieren ähnelt.
/// </summary>
public static string UpdateBtn {
get {
return ResourceManager.GetString("UpdateBtn", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Willkommen zur BTU-CampusApp WP8 ähnelt.
/// </summary>

View File

@@ -269,9 +269,6 @@
<data name="Degree_Master" xml:space="preserve">
<value>Master</value>
</data>
<data name="LectureApp_ListPickerHeaderCourse" xml:space="preserve">
<value>Studiengangauswahl</value>
</data>
<data name="Building" xml:space="preserve">
<value>Gebäude</value>
</data>
@@ -317,4 +314,55 @@
<data name="LinkApp_CommonLinks" xml:space="preserve">
<value>allg. Links</value>
</data>
<data name="UpdateBtn" xml:space="preserve">
<value>Aktualisieren</value>
</data>
<data name="Setting_User" xml:space="preserve">
<value>Profileinstellungen</value>
</data>
<data name="Setting_UserCourse" xml:space="preserve">
<value>Studiengang</value>
</data>
<data name="Setting_UserDegree" xml:space="preserve">
<value>Abschluss</value>
</data>
<data name="Setting_UserProfilAppBarTitle" xml:space="preserve">
<value>Profileinstellungen</value>
</data>
<data name="Setting_UserRole" xml:space="preserve">
<value>Rolle</value>
</data>
<data name="Setting_UserSemester" xml:space="preserve">
<value>Semster</value>
</data>
<data name="Setting_RoleStaff" xml:space="preserve">
<value>Mitarbeiter</value>
</data>
<data name="Setting_RoleStudent" xml:space="preserve">
<value>Student</value>
</data>
<data name="ListPickerHeaderCourse" xml:space="preserve">
<value>Studiengangsauswahl</value>
</data>
<data name="ListPickerHeaderDegree" xml:space="preserve">
<value>Abschlussauswahl</value>
</data>
<data name="ListPickerHeaderRole" xml:space="preserve">
<value>Rollenauswahl</value>
</data>
<data name="ListPickerHeaderSemester" xml:space="preserve">
<value>Semesterauswahl</value>
</data>
<data name="MensaApp_Dinner5" xml:space="preserve">
<value>Essen 5</value>
</data>
<data name="MensaApp_Soup" xml:space="preserve">
<value>Suppe</value>
</data>
<data name="GeoWatch_OptInHeader" xml:space="preserve">
<value>Ortung</value>
</data>
<data name="GeoWatch_OptInText" xml:space="preserve">
<value>Dürfen Positionsdaten enhober und verwendet werdet?</value>
</data>
</root>

View File

@@ -60,6 +60,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die AppSetting.GeoWatchEnable ähnelt.
/// </summary>
public static string AppSetting_GeoWatchEnable {
get {
return ResourceManager.GetString("AppSetting_GeoWatchEnable", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die AppSetting.InitApp ähnelt.
/// </summary>
public static string AppSetting_InitApp {
get {
return ResourceManager.GetString("AppSetting_InitApp", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
/// </summary>
@@ -132,6 +150,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die user.xml ähnelt.
/// </summary>
public static string FileProfil_User {
get {
return ResourceManager.GetString("FileProfil_User", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die StudentCouncils.xml ähnelt.
/// </summary>
@@ -141,6 +168,33 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die CurrentPosition.Lat ähnelt.
/// </summary>
public static string GeoWatch_CurrentPosition_Lat {
get {
return ResourceManager.GetString("GeoWatch_CurrentPosition_Lat", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die CurrentPosition.Long ähnelt.
/// </summary>
public static string GeoWatch_CurrentPosition_Long {
get {
return ResourceManager.GetString("GeoWatch_CurrentPosition_Long", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die CurrentPosition.Time ähnelt.
/// </summary>
public static string GeoWatch_CurrentPosition_Time {
get {
return ResourceManager.GetString("GeoWatch_CurrentPosition_Time", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_DepartmentFavoriteModel ähnelt.
/// </summary>
@@ -150,6 +204,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_DepartmentModel ähnelt.
/// </summary>
public static string IsolatedStorage_DepartmentModel {
get {
return ResourceManager.GetString("IsolatedStorage_DepartmentModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_EventRSSModel ähnelt.
/// </summary>
public static string IsolatedStorage_EventRSSModel {
get {
return ResourceManager.GetString("IsolatedStorage_EventRSSModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die LectureModel ähnelt.
/// </summary>
@@ -168,6 +240,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_NewsRSSModel ähnelt.
/// </summary>
public static string IsolatedStorage_NewsRSSModel {
get {
return ResourceManager.GetString("IsolatedStorage_NewsRSSModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_OpeninghoursModel ähnelt.
/// </summary>
public static string IsolatedStorage_OpeninghoursModel {
get {
return ResourceManager.GetString("IsolatedStorage_OpeninghoursModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die lsf_auszug ähnelt.
/// </summary>
@@ -177,6 +267,87 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die RIND ähnelt.
/// </summary>
public static string MealIconName_Cow {
get {
return ResourceManager.GetString("MealIconName_Cow", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die RINDSCHWEIN ähnelt.
/// </summary>
public static string MealIconName_CowPig {
get {
return ResourceManager.GetString("MealIconName_CowPig", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die FISCH ähnelt.
/// </summary>
public static string MealIconName_Fish {
get {
return ResourceManager.GetString("MealIconName_Fish", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die GEFL ähnelt.
/// </summary>
public static string MealIconName_Fowl {
get {
return ResourceManager.GetString("MealIconName_Fowl", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die FREI ähnelt.
/// </summary>
public static string MealIconName_Free {
get {
return ResourceManager.GetString("MealIconName_Free", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die LAMM ähnelt.
/// </summary>
public static string MealIconName_Lamb {
get {
return ResourceManager.GetString("MealIconName_Lamb", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die SCHWEIN ähnelt.
/// </summary>
public static string MealIconName_Pig {
get {
return ResourceManager.GetString("MealIconName_Pig", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die CAROTTE ähnelt.
/// </summary>
public static string MealIconName_Vegetarian {
get {
return ResourceManager.GetString("MealIconName_Vegetarian", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die WILD ähnelt.
/// </summary>
public static string MealIconName_Wild {
get {
return ResourceManager.GetString("MealIconName_Wild", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt.
/// </summary>
@@ -402,6 +573,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Setting/UserProfil.xaml ähnelt.
/// </summary>
public static string PathSetting_User {
get {
return ResourceManager.GetString("PathSetting_User", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/StudentCouncil/StudentCouncilPage.xaml ähnelt.
/// </summary>
@@ -411,6 +591,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die 767 ähnelt.
/// </summary>
public static string Setting_DefaultCourseNumber {
get {
return ResourceManager.GetString("Setting_DefaultCourseNumber", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die 20131 ähnelt.
/// </summary>
public static string Setting_DefaultSemester {
get {
return ResourceManager.GetString("Setting_DefaultSemester", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die ToggleContent ähnelt.
/// </summary>
@@ -475,7 +673,7 @@ namespace CampusAppWP8.Resources {
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/ ähnelt.
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/Studentenwerk/index.php?mensa=CottbusBTU&amp;v=1 ähnelt.
/// </summary>
public static string UrlMensa_Week {
get {
@@ -501,6 +699,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://141.43.76.140/service/sps ähnelt.
/// </summary>
public static string UrlSpsService {
get {
return ResourceManager.GetString("UrlSpsService", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&amp;app=2&amp;appversion=1 ähnelt.
/// </summary>
@@ -519,6 +726,33 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die 20121 ähnelt.
/// </summary>
public static string Valid_FirstSemseter {
get {
return ResourceManager.GetString("Valid_FirstSemseter", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die 20502 ähnelt.
/// </summary>
public static string Valid_LastSemseter {
get {
return ResourceManager.GetString("Valid_LastSemseter", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die 999 ähnelt.
/// </summary>
public static string Valid_MaxCourseNumber {
get {
return ResourceManager.GetString("Valid_MaxCourseNumber", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die root ähnelt.
/// </summary>

View File

@@ -251,15 +251,12 @@
</data>
<data name="FileMensa_Shedule" xml:space="preserve">
<value>MensaFeed.xml</value>
</data>
<data name="FileEvents_Name" xml:space="preserve">
<value>EventsFeed.xml</value>
</data>
<data name="FileEvents_Name" xml:space="preserve">
<value>EventsFeed.xml</value>
</data>
<data name="UrlMensa_Week" xml:space="preserve">
<value>http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/</value>
<value>http://www.tu-cottbus.de/campusapp-data/Studentenwerk/index.php?mensa=CottbusBTU&amp;v=1</value>
</data>
<data name="FileOpeningHours_OpeningHours" xml:space="preserve">
<value>OpeninghoursFeed.xml</value>
@@ -276,4 +273,82 @@
<data name="UrlNews_Addr" xml:space="preserve">
<value>http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php</value>
</data>
<data name="IsolatedStorage_DepartmentModel" xml:space="preserve">
<value>IsolatedStorage_DepartmentModel</value>
</data>
<data name="IsolatedStorage_EventRSSModel" xml:space="preserve">
<value>IsolatedStorage_EventRSSModel</value>
</data>
<data name="IsolatedStorage_NewsRSSModel" xml:space="preserve">
<value>IsolatedStorage_NewsRSSModel</value>
</data>
<data name="IsolatedStorage_OpeninghoursModel" xml:space="preserve">
<value>IsolatedStorage_OpeninghoursModel</value>
</data>
<data name="FileProfil_User" xml:space="preserve">
<value>user.xml</value>
</data>
<data name="PathSetting_User" xml:space="preserve">
<value>/Pages/Setting/UserProfil.xaml</value>
</data>
<data name="Setting_DefaultCourseNumber" xml:space="preserve">
<value>767</value>
</data>
<data name="Setting_DefaultSemester" xml:space="preserve">
<value>20131</value>
</data>
<data name="Valid_FirstSemseter" xml:space="preserve">
<value>20121</value>
</data>
<data name="Valid_LastSemseter" xml:space="preserve">
<value>20502</value>
</data>
<data name="Valid_MaxCourseNumber" xml:space="preserve">
<value>999</value>
</data>
<data name="MealIconName_Cow" xml:space="preserve">
<value>RIND</value>
</data>
<data name="MealIconName_CowPig" xml:space="preserve">
<value>RINDSCHWEIN</value>
</data>
<data name="MealIconName_Fish" xml:space="preserve">
<value>FISCH</value>
</data>
<data name="MealIconName_Fowl" xml:space="preserve">
<value>GEFL</value>
</data>
<data name="MealIconName_Free" xml:space="preserve">
<value>FREI</value>
</data>
<data name="MealIconName_Lamb" xml:space="preserve">
<value>LAMM</value>
</data>
<data name="MealIconName_Pig" xml:space="preserve">
<value>SCHWEIN</value>
</data>
<data name="MealIconName_Vegetarian" xml:space="preserve">
<value>CAROTTE</value>
</data>
<data name="MealIconName_Wild" xml:space="preserve">
<value>WILD</value>
</data>
<data name="AppSetting_GeoWatchEnable" xml:space="preserve">
<value>AppSetting.GeoWatchEnable</value>
</data>
<data name="AppSetting_InitApp" xml:space="preserve">
<value>AppSetting.InitApp</value>
</data>
<data name="GeoWatch_CurrentPosition_Lat" xml:space="preserve">
<value>CurrentPosition.Lat</value>
</data>
<data name="GeoWatch_CurrentPosition_Long" xml:space="preserve">
<value>CurrentPosition.Long</value>
</data>
<data name="GeoWatch_CurrentPosition_Time" xml:space="preserve">
<value>CurrentPosition.Time</value>
</data>
<data name="UrlSpsService" xml:space="preserve">
<value>http://141.43.76.140/service/sps</value>
</data>
</root>

View File

@@ -255,6 +255,17 @@ namespace CampusAppWP8.Resources
}
}
/// <summary>
/// Gets the uri string of the update icon.
/// </summary>
public static string Update
{
get
{
return Themerize("Update");
}
}
/// <summary>
/// Return the theme depending string of a icon.
/// </summary>

View File

@@ -123,6 +123,12 @@
<data name="Campus" xml:space="preserve">
<value>campus_159.png</value>
</data>
<data name="Cow" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="CowPig" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="Delete" xml:space="preserve">
<value>delete_159.png</value>
</data>
@@ -132,12 +138,24 @@
<data name="Favorite" xml:space="preserve">
<value>favorite_159.png</value>
</data>
<data name="Fish" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="Fowl" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="Free" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="Homework" xml:space="preserve">
<value>homework_159.png</value>
</data>
<data name="Info" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="Lamb" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="Lectures" xml:space="preserve">
<value>lectures_159.png</value>
</data>
@@ -156,6 +174,9 @@
<data name="Phone" xml:space="preserve">
<value>phone_159.png</value>
</data>
<data name="Pig" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="Schedule" xml:space="preserve">
<value>schedule_159.png</value>
</data>
@@ -165,7 +186,16 @@
<data name="StudentCouncil" xml:space="preserve">
<value>student_council_159.png</value>
</data>
<data name="Update" xml:space="preserve">
<value>update_159.png</value>
</data>
<data name="Vegetarian" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="WebMail" xml:space="preserve">
<value>webmail_159.png</value>
</data>
<data name="Wild" xml:space="preserve">
<value>info_159.png</value>
</data>
</root>

View File

@@ -0,0 +1,67 @@
//-----------------------------------------------------------------------
// <copyright file="Settings.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>23.07.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8
{
using CampusAppWP8.File.Setting;
using CampusAppWP8.Model.Setting;
/// <summary>
/// Class handle all setting (files)
/// </summary>
public static class Settings
{
/// <summary>
/// reference of the user-profile-file
/// </summary>
private static UserProfilFile userProfil = new UserProfilFile();
/// <summary>
/// reference of the appSettings
/// </summary>
private static AppSettings appSetting = new AppSettings();
/// <summary>
/// Gets or sets the user-profile-file
/// </summary>
public static UserProfilFile UserProfil
{
get
{
return Settings.userProfil;
}
set
{
if (value != Settings.userProfil)
{
Settings.userProfil = value;
}
}
}
/// <summary>
/// Gets or sets the AppSetting
/// </summary>
public static AppSettings AppSetting
{
get
{
return Settings.appSetting;
}
set
{
if (value != Settings.appSetting)
{
Settings.appSetting = value;
}
}
}
}
}

View File

@@ -9,7 +9,7 @@
<Setter Property="BorderBrush" Value="{StaticResource PhoneContrastBackgroundBrush}"/>
<Setter Property="BorderThickness" Value="6,3,6,3"/>
<Setter Property="Margin" Value="-10"/>
<Setter Property="toolkit:TiltEffect.IsTiltEnabled" Value="True"/>
<Setter Property="toolkit:TiltEffect.IsTiltEnabled" Value="True"/>
</Style>
<Style x:Key="ListButtonNoneBorder" TargetType="Button">
<Setter Property="Background" Value="{x:Null}"/>

View File

@@ -22,12 +22,12 @@ namespace CampusAppWP8
/// <summary>
/// Gets the resource object.
/// </summary>
public Icons ThemelizedIcon
public Icons ThemelizedIcon
{
get
{
return themelized;
}
get
{
return themelized;
}
}
}
}

View File

@@ -1,144 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="Api.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>19.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
using System;
using System.Collections.Generic;
using System.Net;
using CampusAppWP8.Model.Utility;
/// <summary>
/// This abstract Class is for API
/// </summary>
/// <typeparam name="T">Type for model of the API</typeparam>
public abstract class Api<T> : HttpRequest
{
#region Members
/// <summary>
/// EventHandler of the API
/// </summary>
private readonly ApiEventHandler eventHandler;
/// <summary>
/// The model of the API
/// </summary>
private T model;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="Api{T}" /> class.
/// </summary>
/// <param name="apiBaseAddress">BaseUrl of the API</param>
public Api(Uri apiBaseAddress)
: base(apiBaseAddress)
{
this.eventHandler = new ApiEventHandler();
}
#endregion
#region Proberty
/// <summary>
/// Gets or sets for the model of the API
/// </summary>
public T Model
{
get
{
return this.model;
}
set
{
if ((value == null && this.model != null) || !value.Equals(this.model))
{
this.model = value;
}
}
}
/// <summary>
/// Gets for the event-handler of the API
/// </summary>
public ApiEventHandler EventHandler
{
get { return this.eventHandler; }
}
#endregion
#region Methods
#region public
/// <summary>
/// Method send an HTTP-Get for an API
/// </summary>
/// <param name="parameters">list of GetParameter</param>
public void ApiGet(List<UrlParamModel> parameters)
{
Uri getUrl = this.CreateGetUrl(parameters);
this.HttpGet(getUrl, this.DownloadCompleted);
}
#endregion
#region protected
/// <summary>
/// Method implement the deserialization a Xml-API
/// </summary>
/// <param name="xmlString">content of the API</param>
protected abstract void Deserialization(string xmlString);
#endregion
#region private
/// <summary>
/// Method create the model of the API
/// </summary>
/// <param name="resultString">content of the API</param>
private void CreateModel(string resultString)
{
if (resultString == null || resultString == string.Empty)
{
return;
}
this.Deserialization(resultString);
this.EventHandler.FireApiReadyevent();
}
/// <summary>
/// Method will be execute if the download of the API is completed and create the model
/// </summary>
/// <param name="sender">Sender of the event</param>
/// <param name="e">Arguments of the event</param>
private void DownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
{
Exception downloadError = e.Error;
if (downloadError != null)
{
return;
}
string downloadResult = e.Result;
if (downloadResult != null && !downloadResult.Equals(string.Empty))
{
this.CreateModel(downloadResult);
}
}
#endregion
#endregion
}
}

View File

@@ -1,47 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="ApiEventHandler.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>17.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
/// <summary>
/// This class handle the events of a API <see cref="RestApi{T}"/>
/// </summary>
public class ApiEventHandler
{
/// <summary>
/// Initializes a new instance of the <see cref="ApiEventHandler" /> class.
/// </summary>
public ApiEventHandler()
{
}
#region Delegate&Events
/// <summary>
/// Delegate for the ready event
/// </summary>
public delegate void ApiReadyHandler();
/// <summary>
/// The ready event
/// </summary>
public event ApiReadyHandler ApiIsReadyEvent;
#endregion
#region Method
/// <summary>
/// Method fire a ready event
/// </summary>
public void FireApiReadyevent()
{
this.ApiIsReadyEvent();
}
#endregion
}
}

View File

@@ -108,7 +108,7 @@ namespace CampusAppWP8.Utility
if (this.Exist() == true)
{
IOTypeRead tempType = ioType;
if (tempType == IOTypeRead.INVALID)
{
tempType = this.readType;
@@ -117,7 +117,7 @@ namespace CampusAppWP8.Utility
if (tempType == IOTypeRead.ReadAsync)
{
// retValue = this.ReadAsync();
retValue = this.ReadSync();
retValue = this.ReadSync();
}
else if (tempType == IOTypeRead.ReadSync)
{
@@ -149,7 +149,7 @@ namespace CampusAppWP8.Utility
else if (tempType == IOTypeWrite.WriteSync)
{
// this.WriteSync(data);
this.WriteAsync(data);
this.WriteAsync(data);
}
}
@@ -220,11 +220,19 @@ namespace CampusAppWP8.Utility
/// <param name="data">data array</param>
private async void WriteAsync(byte[] data)
{
var file = await File.LocalFolder.CreateFileAsync(this.filename, CreationCollisionOption.ReplaceExisting);
using (var s = await file.OpenStreamForWriteAsync())
try
{
await s.WriteAsync(data, 0, data.Length);
var file = await File.LocalFolder.CreateFileAsync(this.filename, CreationCollisionOption.ReplaceExisting);
using (var s = await file.OpenStreamForWriteAsync())
{
await s.WriteAsync(data, 0, data.Length);
}
}
catch (Exception e)
{
// log write Error
Logger.LogException(e);
}
}
}

View File

@@ -17,13 +17,12 @@ namespace CampusAppWP8.Utility
/// </summary>
public class HttpRequest
{
#region Members
#region Member
/// <summary>
/// the WebClient, which send the requests
/// BaseAddress of the webClient
/// </summary>
private WebClient client;
private string baseAddress;
#endregion
#region Constructor
@@ -33,7 +32,6 @@ namespace CampusAppWP8.Utility
/// </summary>
public HttpRequest()
{
this.client = new WebClient();
}
/// <summary>
@@ -42,8 +40,7 @@ namespace CampusAppWP8.Utility
/// <param name="apiBaseAddress">the url of the HttpRequest base address</param>
public HttpRequest(Uri apiBaseAddress)
{
this.client = new WebClient();
this.client.BaseAddress = apiBaseAddress.AbsoluteUri;
this.baseAddress = apiBaseAddress.AbsoluteUri;
}
#endregion
@@ -58,8 +55,9 @@ namespace CampusAppWP8.Utility
/// <param name="action">callback method</param>
public void HttpGet(Uri url, Action<object, DownloadStringCompletedEventArgs> action)
{
this.client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(action);
this.client.DownloadStringAsync(url);
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(action);
client.DownloadStringAsync(url);
}
/// <summary>
@@ -70,12 +68,18 @@ namespace CampusAppWP8.Utility
public Uri CreateGetUrl(List<UrlParamModel> parameters)
{
string paramterStr = string.Empty;
string seperator = string.Empty;
foreach (UrlParamModel parameter in parameters)
{
if (string.Empty.Equals(seperator))
{
seperator = parameter.ParamToken;
}
paramterStr += parameter.ToString();
}
string getUrlStr = this.client.BaseAddress + "?" + paramterStr;
string getUrlStr = this.baseAddress + seperator + paramterStr;
return new Uri(getUrlStr, UriKind.Absolute);
}
@@ -190,8 +194,9 @@ namespace CampusAppWP8.Utility
/// <param name="data">Data which are sending to the HttpRequest</param>
private void UploadData(Uri url, Action<object, UploadStringCompletedEventArgs> action, string method, string data)
{
this.client.UploadStringCompleted += new UploadStringCompletedEventHandler(action);
this.client.UploadStringAsync(url, method, data);
WebClient client = new WebClient();
client.UploadStringCompleted += new UploadStringCompletedEventHandler(action);
client.UploadStringAsync(url, method, data);
}
#endregion

View File

@@ -56,10 +56,10 @@ namespace CampusAppWP8.Utility.Lui.Button
/// Gets or sets the Url
/// </summary>
public object SearchTerm
{
get { return (object)this.GetValue(SearchTermProperty); }
set { this.SetValue(SearchTermProperty, value); }
}
{
get { return (object)this.GetValue(SearchTermProperty); }
set { this.SetValue(SearchTermProperty, value); }
}
#endregion
@@ -75,7 +75,7 @@ namespace CampusAppWP8.Utility.Lui.Button
{
MapsTask mapsTask = new MapsTask();
mapsTask.Center = new GeoCoordinate(51.766788, 14.326681);
mapsTask.SearchTerm = this.SearchTerm as string;
mapsTask.SearchTerm = this.SearchTerm as string;
mapsTask.ZoomLevel = 15;
mapsTask.Show();
}

View File

@@ -0,0 +1,47 @@
//-----------------------------------------------------------------------
// <copyright file="UpdateButtonAppBar.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>22.07.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Utility.Lui.Button
{
using System;
using CampusAppWP8.Resources;
using Microsoft.Phone.Shell;
/// <summary>
/// This class create an Button which start the Email-Client
/// </summary>
public class UpdateButtonAppBar : ApplicationBarIconButton
{
#region Members
/// <summary>
/// IconUri of the Button
/// </summary>
private static Uri iconUri = new Uri(Icons.Update, UriKind.Relative);
/// <summary>
/// Text of the Button
/// </summary>
private static string text = AppResources.UpdateBtn;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="UpdateButtonAppBar" /> class.
/// </summary>
public UpdateButtonAppBar()
: base()
{
this.IconUri = UpdateButtonAppBar.iconUri;
this.Text = UpdateButtonAppBar.text;
}
#endregion
}
}

View File

@@ -39,7 +39,7 @@ namespace CampusAppWP8.Utility
/// Method add an Newline to a string
/// </summary>
/// <param name="str">input string</param>
/// <returns>input string + \n</returns>
/// <returns>input string + newline</returns>
public static string AddNewLine(string str)
{
return str.ToString() + "\n";
@@ -49,7 +49,7 @@ namespace CampusAppWP8.Utility
/// Method remove(TrimEND!) an Newline to a string
/// </summary>
/// <param name="str">input string</param>
/// <returns>input string - \n</returns
/// <returns>input string - newline</returns
public static string RemvoveNewLine(string str)
{
return str.TrimEnd('\n');

View File

@@ -8,19 +8,64 @@
namespace CampusAppWP8.Utility
{
using System;
using System.Collections.Generic;
using System.Device.Location;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using CampusAppWP8.Resources;
/// <summary>
/// Collection of utility functions.
/// </summary>
public static class Utilities
{
/// <summary>
/// Comparison types.
/// </summary>
public enum DifferenceType
{
/// <summary>
/// Compare Equality.
/// </summary>
Equal,
/// <summary>
/// Compare if less.
/// </summary>
Less,
/// <summary>
/// Compare equality or less.
/// </summary>
LessEqual,
/// <summary>
/// Compare greater.
/// </summary>
Greater,
/// <summary>
/// Compare equality or greater.
/// </summary>
GreaterEqual
};
}
/// <summary>
/// Compares the difference between a specified DateTime and Now
/// and the specified time difference (in Days).
/// <example>
/// When type is DifferenceType.Less, the timespan between Now and date
/// is 5.0 (days) and totalDiff is 7.0, the function will return true,
/// because the timespan is Less then 7.0 .
/// </example>
/// </summary>
/// <param name="type">comparison type</param>
/// <param name="date">date to check</param>
/// <param name="totalDiff">difference to check</param>
/// <returns>true, if the comparison condition do not fail</returns>
public static bool DayDifference(DifferenceType type, DateTime date, double totalDiff)
{
bool retValue = false;
@@ -53,5 +98,170 @@ namespace CampusAppWP8.Utility
return retValue;
}
/// <summary>
/// Return a list of child UIElements of the root object with the specified element name.
/// </summary>
/// <param name="rootObj">root object</param>
/// <param name="elemName">name of the element(s)</param>
/// <returns>list of elements</returns>
public static List<DependencyObject> GetChild(DependencyObject rootObj, string elemName)
{
List<DependencyObject> retValue = new List<DependencyObject>();
for (int k = 0; k < VisualTreeHelper.GetChildrenCount(rootObj); k++)
{
var child = VisualTreeHelper.GetChild(rootObj, k);
if ((child as FrameworkElement).Name.Equals(elemName))
{
retValue.Add(child);
}
var ret = retValue.Concat<DependencyObject>(GetChild(child as DependencyObject, elemName));
retValue = ret.ToList<DependencyObject>();
}
return retValue;
}
/// <summary>
/// Search for a UIElement with the specified name in the parent Grid and set its visibility.
/// </summary>
/// <param name="rootObj">root object</param>
/// <param name="parentGridName">name of the parent grid</param>
/// <param name="elemName">name of the UIElement</param>
/// <param name="vis">new visibility property state</param>
/// <param name="index">index of the element in the parent child list</param>
public static void SetElementVisibility(DependencyObject rootObj, string parentGridName, string elemName, Visibility vis, int index = 0)
{
List<DependencyObject> l = Utilities.GetChild(rootObj, parentGridName);
Grid parentGrid = l[index] as Grid;
FrameworkElement elem = null;
foreach (FrameworkElement tempElem in parentGrid.Children)
{
if (tempElem.Name == elemName)
{
elem = tempElem;
}
}
if (elem != null)
{
elem.Visibility = vis;
}
}
/// <summary>
/// Return the visibility property of a UIElement which is a child object of the specified parent grid element.
/// </summary>
/// <param name="rootObj">root object</param>
/// <param name="parentGridName">name of the parent grid</param>
/// <param name="elemName">name of the element</param>
/// <param name="index">index of the element in the child list of the parent</param>
/// <returns>visibility state</returns>
public static Visibility GetElementVisibility(DependencyObject rootObj, string parentGridName, string elemName, int index = 0)
{
Visibility retValue;
List<DependencyObject> l = Utilities.GetChild(rootObj, parentGridName);
if (index >= l.Count)
{
index = 0;
}
Grid parentGrid = l[index] as Grid;
FrameworkElement elem = null;
foreach (FrameworkElement tempElem in parentGrid.Children)
{
if (tempElem.Name == elemName)
{
elem = tempElem;
}
}
if (elem != null)
{
retValue = elem.Visibility;
}
else
{
throw new NotImplementedException("Could not find a UIElement with name (" + elemName + ")");
}
return retValue;
}
/// <summary>
/// Method determine the current position of the phone
/// </summary>
/// <param name="accuracy">accuracy of the position in meters</param>
/// <returns>the position of the phone</returns>
public static GeoPosition<GeoCoordinate> DetermineCurrentPosition(uint accuracy = 50)
{
if (!Settings.AppSetting.GeoWatchEnable)
{
return null;
}
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
bool success = watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));
GeoPosition<GeoCoordinate> geoposition = null;
if (success)
{
geoposition = watcher.Position;
}
watcher.Stop();
return geoposition;
}
/// <summary>
/// Method determine and store the current position of the phone
/// </summary>
public static void DetermineAndStoreCurrentPositionForce()
{
GeoPosition<GeoCoordinate> geoposition = Utilities.DetermineCurrentPosition();
if (geoposition != null)
{
string lat = geoposition.Location.Latitude.ToString(CultureInfo.InvariantCulture);
string log = geoposition.Location.Longitude.ToString(CultureInfo.InvariantCulture);
string time = geoposition.Timestamp.Ticks.ToString();
App.SaveToAppState<string>(Constants.GeoWatch_CurrentPosition_Lat, lat);
App.SaveToAppState<string>(Constants.GeoWatch_CurrentPosition_Long, log);
App.SaveToAppState<string>(Constants.GeoWatch_CurrentPosition_Time, time);
}
}
/// <summary>
/// Method determine and store the current position of the phone, in 15 min interval
/// </summary>
public static void DetermineAndStoreCurrentPosition()
{
string lat = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Lat);
string log = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Long);
string time = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Time);
if (lat == null || log == null || time == null || lat.Equals(string.Empty) || log.Equals(string.Empty) || time.Equals(string.Empty))
{
Utilities.DetermineAndStoreCurrentPositionForce();
}
else
{
long longTime = 0;
if (!long.TryParse(time, out longTime))
{
return;
}
DateTime expired = new DateTime(longTime).AddMinutes(15);
if (DateTime.Now.Ticks > expired.Ticks)
{
Utilities.DetermineAndStoreCurrentPositionForce();
}
}
}
}
}

View File

@@ -1,84 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="XmlApi.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>13.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
using System;
using System.Collections.Generic;
using System.Net;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Resources;
/// <summary>
/// This abstract Class is for Xml-API
/// </summary>
/// <typeparam name="T">Type for model of the API</typeparam>
public abstract class XmlApi<T> : Api<T>
{
#region Members
/// <summary>
/// Variable for the name of the root-tag
/// </summary>
private string validRootName;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="XmlApi{T}" /> class.
/// </summary>
/// <param name="apiBaseAddress">BaseUrl of the API</param>
public XmlApi(Uri apiBaseAddress)
: base(apiBaseAddress)
{
this.validRootName = Constants.XMLRootElementName;
}
#endregion
#region Proberty
/// <summary>
/// Gets or sets the ValidRootName of the API
/// </summary>
protected string ValidRootName
{
get
{
return this.validRootName;
}
set
{
if (value != this.validRootName)
{
this.validRootName = value;
}
}
}
#endregion
#region Methods
/// <summary>
/// Method implement the deserialization a Xml-API
/// </summary>
/// <param name="xmlString">content of the API</param>
protected override void Deserialization(string xmlString)
{
T model = XmlManager.DeserializationToModel<T>(xmlString, this.ValidRootName);
if (model != null)
{
this.Model = model;
}
}
#endregion
}
}

View File

@@ -49,7 +49,7 @@ namespace CampusAppWP8.Utility
string retValue = string.Empty;
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add("", "");
ns.Add(string.Empty, string.Empty);
XmlSerializer serializer = new XmlSerializer(typeof(T));
TextWriter writer = new StringWriter();

View File

@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BuiltToRoam.Core.Agent" version="1.0.1.5" targetFramework="wp80" />
<package id="BuiltToRoam.GeoWatcher" version="1.0.1.5" targetFramework="wp80" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="wp80" />
<package id="SharpZipLib-WP7" version="0.86.0.518" targetFramework="wp80" />
<package id="WPtoolkit" version="4.2012.10.30" targetFramework="wp80" />
</packages>