diff --git a/CampusAppWP8/CampusAppWP8/App.xaml.cs b/CampusAppWP8/CampusAppWP8/App.xaml.cs
index 81f3a560..65acbc71 100644
--- a/CampusAppWP8/CampusAppWP8/App.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/App.xaml.cs
@@ -171,11 +171,18 @@ namespace CampusAppWP8
if (Settings.AppSetting.GeoWatchEnable)
{
- Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPositionForce));
+ Thread thread = new Thread(new ThreadStart(this.PositionThread));
thread.Start();
}
}
+ /// Position thread.
+ /// Stubbfel, 18.11.2013.
+ private void PositionThread()
+ {
+ Utilities.DetermineAndStoreCurrentPositionForce();
+ }
+
///
/// Load the usersettings from the store
///
diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index 8f2dbfdb..fefe0d7d 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -103,6 +103,7 @@
App.xaml
+
@@ -240,6 +241,7 @@
+
@@ -253,6 +255,8 @@
AppointmentCanvas.xaml
+
+ MultiValueTextBlock.xaml
WeekView.xaml
@@ -261,6 +265,7 @@
WeekViewDay.xaml
+
NFC.xaml
@@ -288,8 +293,6 @@
-
-
CampusMapPage.xaml
@@ -539,6 +542,7 @@
MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs
index 030d6aae..670e02b3 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeed.cs
@@ -13,12 +13,19 @@ namespace CampusAppWP8.Feed.Mensa
using CampusAppWP8.Model;
using CampusAppWPortalLib8.Model.Mensa;
using CampusAppWPortalLib8.Model;
+ using CampusAppWP8.Resources;
+ using CampusAppWPortalLib8.Model.Settings;
/// This Class is for MensaFeeds.
/// Stubbfel, 14.10.2013.
///
public abstract class MensaFeed : XmlModel
{
+ #region Member
+ /// The price feed.
+ private PriceFeed priceFeed = null;
+
+ #endregion
#region Constructor
/// Initializes a new instance of the class.
@@ -31,6 +38,11 @@ namespace CampusAppWP8.Feed.Mensa
this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
+
+ this.priceFeed = new PriceFeed();
+ this.priceFeed.OnLoaded += this.PriceFeedIsReady;
+ this.priceFeed.OnFailedLoad += this.PriceFeedIsFailed;
+ this.priceFeed.LoadData();
}
#endregion
@@ -41,6 +53,10 @@ namespace CampusAppWP8.Feed.Mensa
/// The title.
public string Title { get; protected set; }
+ /// Gets the title.
+ /// The title.
+ public Campus Campus { get; protected set; }
+
#endregion
#region Method
@@ -119,6 +135,79 @@ namespace CampusAppWP8.Feed.Mensa
return true;
}
+ ///
+ /// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
+ ///
+ /// Fiedler, 14.11.2013.
+ ///
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
+ {
+ string retValue = string.Empty;
+ int intVal = -1;
+ int intParam = -1;
+
+ if (value is int)
+ {
+ intVal = (int)value;
+ }
+ else if (value is string)
+ {
+ intVal = int.Parse((string)value);
+ }
+
+ if (parameter is int)
+ {
+ intParam = (int)parameter;
+ }
+ else if (parameter is string)
+ {
+ intParam = int.Parse((string)parameter);
+ }
+
+ if ((intVal >= 0) && (intParam >= 0))
+ {
+ if (this.priceFeed != null && this.priceFeed.Model != null)
+ {
+ PriceMealModel model = this.priceFeed.Model.GetCanteen(intParam).GetPriceMealModel(intVal);
+ retValue = AppResources.Students + ": " + model.PriceStudentStr + " € " + AppResources.Employees + ": " + model.PriceEmployeeStr + " € " + AppResources.Guests + ": " + model.PriceGuestStr + " €";
+ }
+ }
+
+ return retValue;
+ }
+
+ /// Price feed is ready.
+ /// Fiedler, 14.11.2013.
+ private void PriceFeedIsReady()
+ {
+ this.priceFeed.SaveData();
+ }
+
+ /// Sets the prices.
+ /// Stubbfel, 18.11.2013.
+ public void SetPrices()
+ {
+ if (this.Model == null || this.Model.Menus == null || this.priceFeed == null || this.priceFeed.Model == null)
+ {
+ return;
+ }
+
+ foreach(MenuModel menu in this.Model.Menus) {
+ foreach (MealModel meal in menu.Meals)
+ {
+ PriceMealModel model = this.priceFeed.Model.GetCanteen(this.Campus).GetPriceMealModel(meal.MealId);
+ meal.Price = AppResources.Students + ": " + model.PriceStudentStr + " € " + AppResources.Employees + ": " + model.PriceEmployeeStr + " € " + AppResources.Guests + ": " + model.PriceGuestStr + " €";
+ }
+ }
+
+ }
+
+ /// Price feed is failed.
+ /// Fiedler, 14.11.2013.
+ private void PriceFeedIsFailed()
+ {
+ }
+
#endregion
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBMain.cs b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBMain.cs
index e0765814..7ea6dcf3 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBMain.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBMain.cs
@@ -23,6 +23,7 @@ namespace CampusAppWP8.Feed.Mensa
: base(Constants.FileMensa_Shedule_CBMain, CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_CBMain)
{
this.Title = CampusAppWPortalLib8.Resources.AppResources.Campus_CBMain;
+ this.Campus = CampusAppWPortalLib8.Model.Settings.Campus.CB_MAIN;
}
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBNorth.cs b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBNorth.cs
index a6956d5f..b6959904 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBNorth.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBNorth.cs
@@ -23,6 +23,7 @@ namespace CampusAppWP8.Feed.Mensa
: base(Constants.FileMensa_Shedule_CBNorth, CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_CBNorth)
{
this.Title = CampusAppWPortalLib8.Resources.AppResources.Campus_CBNorth;
+ this.Campus = CampusAppWPortalLib8.Model.Settings.Campus.CB_NORTH;
}
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBSouth.cs b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBSouth.cs
index fc33a1da..7c0cf80f 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBSouth.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedCBSouth.cs
@@ -23,6 +23,7 @@ namespace CampusAppWP8.Feed.Mensa
: base(Constants.FileMensa_Shedule_CBSouth, CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_CBSouth)
{
this.Title = CampusAppWPortalLib8.Resources.AppResources.Campus_CBSouth;
+ this.Campus = CampusAppWPortalLib8.Model.Settings.Campus.CB_SOUTH;
}
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedSBFMain.cs b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedSBFMain.cs
index 0fe1fc1e..17c6c64e 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedSBFMain.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Mensa/MensaFeedSBFMain.cs
@@ -23,6 +23,7 @@ namespace CampusAppWP8.Feed.Mensa
: base(Constants.FileMensa_Shedule_SBFMain, CampusAppWPortalLib8.Resources.Constants.UrlMensa_Week_SBFMain)
{
this.Title = CampusAppWPortalLib8.Resources.AppResources.Campus_SFBMain;
+ this.Campus = CampusAppWPortalLib8.Model.Settings.Campus.SFB_MAIN;
}
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Mensa/PriceFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Mensa/PriceFeed.cs
new file mode 100644
index 00000000..a5380621
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Feed/Mensa/PriceFeed.cs
@@ -0,0 +1,82 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 13.11.2013
+// Implements the price feed class
+//-----------------------------------------------------------------------
+namespace CampusAppWP8.Feed.Mensa
+{
+ using System;
+ using System.IO;
+ using CampusAppWP8.Model;
+ using CampusAppWP8.Resources;
+ using CampusAppWPortalLib8.Model.Mensa;
+ using CampusAppWPortalLib8.Model;
+
+ /// A price feed.
+ /// Fiedler, 13.11.2013.
+ ///
+ public class PriceFeed : XmlModel
+ {
+ /// Initializes a new instance of the PriceFeed class.
+ /// Fiedler, 13.11.2013.
+ public PriceFeed()
+ : base(ModelType.FileAndFeed, Constants.FileMensaPrice, Constants.UrlMensaPrice)
+ {
+ this.IsFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ this.IsModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
+ this.IsFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDate);
+ }
+
+ /// Check is model up to date.
+ /// Fiedler, 13.11.2013.
+ /// The model.
+ /// true if it succeeds, false if it fails.
+ private bool CheckIsModelUpToDate(PriceModel model)
+ {
+ bool retValue = true;
+
+ if (model == null)
+ {
+ retValue = false;
+ }
+
+ return retValue;
+ }
+
+ /// Check is file up to date.
+ /// Fiedler, 13.11.2013.
+ /// The model.
+ /// Information describing the file.
+ /// true if it succeeds, false if it fails.
+ private bool CheckIsFileUpToDate(PriceModel model, FileInfo fileInfo)
+ {
+ if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
+ {
+ return false;
+ }
+
+ return this.CheckIsUpToDate(fileInfo.LastWriteTime);
+ }
+
+ /// Check is up to date.
+ /// Fiedler, 13.11.2013.
+ /// The last modified Date/Time.
+ /// true if it succeeds, false if it fails.
+ private bool CheckIsUpToDate(DateTime lastModified)
+ {
+ bool retValue = false;
+ TimeSpan diff = DateTime.Now.Subtract(lastModified);
+
+
+ if (diff.TotalDays < 7)
+ {
+ retValue = true;
+ }
+
+ return retValue;
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs b/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs
index 5c4c974d..7f331eef 100644
--- a/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs
+++ b/CampusAppWP8/CampusAppWP8/Feed/Openinghours/OpeninghoursFeed.cs
@@ -11,15 +11,15 @@ namespace CampusAppWP8.Feed.Openinghours
using System;
using System.IO;
using CampusAppWP8.Model;
- using CampusAppWP8.Model.Openinghours;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWPortalLib8.Model;
+ using CampusAppWPortalLib8.Model.Openinghours;
/// This Class is for MesaFeeds.
/// fiedlchr, 14.10.2013.
///
- public class OpeninghoursFeed : XmlModel
+ public class OpeninghoursFeed : XmlModel
{
#region Constructor
@@ -41,7 +41,7 @@ namespace CampusAppWP8.Feed.Openinghours
/// fiedlchr, 14.10.2013.
/// reference of the FeedModel.
/// true, if model is up-to-date, otherwise false.
- private bool CheckIsModelUpToDate(OpeninghoursWp8Model model)
+ private bool CheckIsModelUpToDate(OpeninghoursModel model)
{
bool retValue = true;
@@ -62,7 +62,7 @@ namespace CampusAppWP8.Feed.Openinghours
/// reference of the FeedModel.
/// info about the file.
/// true, if file is up-to-date, otherwise false.
- private bool CheckIsFileUpToDateOnLoad(OpeninghoursWp8Model model, FileInfo info)
+ private bool CheckIsFileUpToDateOnLoad(OpeninghoursModel model, FileInfo info)
{
bool retValue = true;
@@ -82,7 +82,7 @@ namespace CampusAppWP8.Feed.Openinghours
/// reference of the FeedModel.
/// info about the file.
/// true, if file is up-to-date, otherwise false.
- private bool CheckIsFileUpToDateOnSave(OpeninghoursWp8Model model, FileInfo info)
+ private bool CheckIsFileUpToDateOnSave(OpeninghoursModel model, FileInfo info)
{
bool retValue = true;
diff --git a/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursInstitutionWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursInstitutionWp8Model.cs
deleted file mode 100644
index 7c4cfb96..00000000
--- a/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursInstitutionWp8Model.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-//-----------------------------------------------------------------------------
-//
-// Company copyright tag.
-//
-// fiedlchr
-// 24.06.2013
-//-----------------------------------------------------------------------------
-
-namespace CampusAppWP8.Model.Openinghours
-{
- using System.Globalization;
- using System.Windows;
- using System.Xml.Serialization;
-
- ///
- /// Model for menu
- ///
- public class OpeninghoursInstitutionWp8Model : CampusAppWPortalLib8.Model.Openinghours.OpeninghoursInstitutionModel
- {
- #region Property
-
- ///
- /// Gets the visibility state of the monday TextBlock.
- ///
- public Visibility VisibleMonday
- {
- get
- {
- return ((this.Monday == string.Empty) || (this.Monday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the tuesday TextBlock.
- ///
- public Visibility VisibleTuesday
- {
- get
- {
- return ((this.Tuesday == string.Empty) || (this.Tuesday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the wednesday TextBlock.
- ///
- public Visibility VisibleWednesday
- {
- get
- {
- return ((this.Wednesday == string.Empty) || (this.Wednesday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the thursday TextBlock.
- ///
- public Visibility VisibleThursday
- {
- get
- {
- return ((this.Thursday == string.Empty) || (this.Thursday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the friday TextBlock.
- ///
- public Visibility VisibleFriday
- {
- get
- {
- return ((this.Friday == string.Empty) || (this.Friday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the saturday TextBlock.
- ///
- public Visibility VisibleSaturday
- {
- get
- {
- return ((this.Saturday == string.Empty) || (this.Saturday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the sunday TextBlock.
- ///
- public Visibility VisibleSunday
- {
- get
- {
- return ((this.Sunday == string.Empty) || (this.Sunday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the comment.
- ///
- public Visibility VisibleComment
- {
- get
- {
- return ((this.Comment == string.Empty) || (this.Comment.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the email address.
- ///
- public Visibility VisibleEMail
- {
- get
- {
- return ((this.EMail == string.Empty) || (this.EMail.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the phone number.
- ///
- public Visibility VisiblePhone
- {
- get
- {
- return ((this.Phone == string.Empty) || (this.Phone.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the room.
- ///
- public Visibility VisibleRoom
- {
- get
- {
- return ((this.Room == string.Empty) || (this.Room.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- ///
- /// Gets the visibility state of the building.
- ///
- public Visibility VisibleBuilding
- {
- get
- {
- return ((this.Building == string.Empty) || (this.Building.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
- }
- }
-
- #endregion
- }
-}
diff --git a/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursWp8Model.cs
deleted file mode 100644
index 88b480bd..00000000
--- a/CampusAppWP8/CampusAppWP8/Model/Openinghours/OpeninghoursWp8Model.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-//-----------------------------------------------------------------------------
-//
-// Company copyright tag.
-//
-// fiedlchr
-// 24.06.2013
-//-----------------------------------------------------------------------------
-
-namespace CampusAppWP8.Model.Openinghours
-{
- using System.Xml.Serialization;
-
- ///
- /// Model for opening hours.
- ///
- [XmlRoot("root")]
- public class OpeninghoursWp8Model : CampusAppWPortalLib8.Model.Openinghours.OpeninghoursModel
- {
- }
-}
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs
index 3c1b10b3..1cab6f8f 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs
@@ -175,7 +175,10 @@ namespace CampusAppWP8.Pages.Campusmap
}
}
- this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler);
+ if (device != null)
+ {
+ this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler);
+ }
}
/// Methods overrides the OnNavigatedFrom-Method.
@@ -183,7 +186,10 @@ namespace CampusAppWP8.Pages.Campusmap
///
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
- this.device.StopSubscribingForMessage(this.ndefId);
+ if (device != null)
+ {
+ this.device.StopSubscribingForMessage(this.ndefId);
+ }
base.OnNavigatedFrom(e);
}
@@ -489,6 +495,10 @@ namespace CampusAppWP8.Pages.Campusmap
/// the message of the device.
private void NDEFHandler(ProximityDevice sender, ProximityMessage message)
{
+ if (device == null)
+ {
+ return;
+ }
// create ndefMessage
this.device.StopSubscribingForMessage(message.SubscriptionId);
var ndefMessage = message.Data;
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml
index 12d47a20..ac0bb7cd 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml
@@ -14,7 +14,8 @@
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
- shell:SystemTray.IsVisible="True">
+ shell:SystemTray.IsVisible="True"
+ x:Name="root">
@@ -26,34 +27,43 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs
index da9c7fce..69fb12ef 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs
@@ -8,6 +8,7 @@
//-----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Campusmap
{
+ using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
@@ -23,6 +24,7 @@ namespace CampusAppWP8.Pages.Campusmap
using CampusAppWPortalLib8.Model.Campusmap.Pin;
using CampusAppWPortalLib8.Model.Utility;
using Microsoft.Phone.Controls;
+ using Microsoft.Phone.Shell;
using CampusAppWPortalLib8.Model.GeoDb;
/// Class of the RoomListPage.
@@ -49,8 +51,7 @@ namespace CampusAppWP8.Pages.Campusmap
/// The offset point.
private MapPoint offsetPoint;
- /// The layer list picker.
- private ListPickerItemListModel layerListPicker;
+ private string selectedLayer = string.Empty;
#endregion
@@ -65,6 +66,20 @@ namespace CampusAppWP8.Pages.Campusmap
#endregion
+ private string SelectedLayer
+ {
+ get
+ {
+ return this.selectedLayer;
+ }
+
+ set
+ {
+ this.selectedLayer = value;
+ this.LayerTag.Text = value;
+ }
+ }
+
#region Method
#region protected
@@ -122,12 +137,12 @@ namespace CampusAppWP8.Pages.Campusmap
string layerKey = this.building.GetLayerKey(NavigationContext.QueryString[Constants.ParamRoomId]);
if (layerKey != null)
{
- this.Layer.SelectedIndex = this.layerListPicker.GetIndexOrDefault(layerKey);
+ this.SelectedLayer = layerKey;
this.ShowCurrentRoom(NavigationContext.QueryString[Constants.ParamRoomId]);
}
}
- this.ShowLayerPlaces(((ListPickerItemModel)this.Layer.SelectedItem).Value);
+ this.ShowLayerPlaces((this.selectedLayer.Length > 0) ? this.selectedLayer : (this.ApplicationBar.MenuItems[0] as ApplicationBarMenuItem).Text);
}
else
{
@@ -269,14 +284,19 @@ namespace CampusAppWP8.Pages.Campusmap
/// Stubbfel, 14.10.2013.
private void CreateLayerListPicker()
{
- this.layerListPicker = new ListPickerItemListModel();
+ this.ApplicationBar.MenuItems.Clear();
foreach (string layername in this.building.Layers.Keys)
{
- this.layerListPicker.AddItem(layername, layername);
+ ApplicationBarMenuItem newMenuItem = new ApplicationBarMenuItem(layername);
+ newMenuItem.Click += this.OnMenuItemClicked;
+ this.ApplicationBar.MenuItems.Add(newMenuItem);
}
- this.Layer.ItemsSource = this.layerListPicker.List;
+ if (this.ApplicationBar.MenuItems.Count > 0)
+ {
+ this.SelectedLayer = (this.ApplicationBar.MenuItems[0] as ApplicationBarMenuItem).Text;
+ }
}
/// Shows the layer places.
@@ -360,13 +380,13 @@ namespace CampusAppWP8.Pages.Campusmap
Canvas.SetZIndex(this.imgMap, 0);
}
- /// Event handler. Called by Layer for selection changed events.
- /// Stubbfel, 14.10.2013.
- /// Source of the event.
- /// Selection changed event information.
- private void Layer_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private void OnMenuItemClicked(object sender, System.EventArgs e)
{
- this.ShowLayerPlaces(((ListPickerItemModel)this.Layer.SelectedItem).Value);
+ if (this.SelectedLayer.Equals((sender as ApplicationBarMenuItem).Text) == false)
+ {
+ this.SelectedLayer = (sender as ApplicationBarMenuItem).Text;
+ this.ShowLayerPlaces((sender as ApplicationBarMenuItem).Text);
+ }
}
/// Clears the map described by removeTags.
@@ -400,6 +420,28 @@ namespace CampusAppWP8.Pages.Campusmap
#endregion
+ /// Event handler. Called by ZoomIn for tap events.
+ /// Fiedler, 15.11.2013.
+ /// Source of the event.
+ /// Gesture event information.
+ private void ZoomIn_Tap(object sender, System.Windows.Input.GestureEventArgs e)
+ {
+ //throw new NotImplementedException("TODO");
+ (this.MapCanvas.RenderTransform as ScaleTransform).ScaleX *= 1.5;
+ (this.MapCanvas.RenderTransform as ScaleTransform).ScaleY *= 1.5;
+ }
+
+ /// Event handler. Called by ZoomOut for tap events.
+ /// Fiedler, 15.11.2013.
+ /// Source of the event.
+ /// Gesture event information.
+ private void ZoomOut_Tap(object sender, System.Windows.Input.GestureEventArgs e)
+ {
+ //throw new NotImplementedException("TODO");
+ (this.MapCanvas.RenderTransform as ScaleTransform).ScaleX /= 1.5;
+ (this.MapCanvas.RenderTransform as ScaleTransform).ScaleY /= 1.5;
+ }
+
#endregion
}
}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml
index 6377d8db..ea1339ba 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml
@@ -8,14 +8,18 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header"
+ xmlns:lu="clr-namespace:CampusAppWP8.Utility.Lui"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page"
+ xmlns:utility="clr-namespace:CampusAppWP8.Utility"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
- shell:SystemTray.IsVisible="True">
+ shell:SystemTray.IsVisible="True"
+ x:Name="root">
+
@@ -25,7 +29,7 @@
-
+
@@ -44,18 +48,26 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
@@ -79,6 +91,9 @@
+
+
+
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
index 376a77a4..e837fc79 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
@@ -48,6 +48,9 @@ namespace CampusAppWP8.Pages.Mensa
/// Flag for forcing webLoad.
private bool forceLoad = false;
+ /// Identifier for the location.
+ public int locationID = -1;
+
#endregion
#region Constructor
@@ -56,10 +59,14 @@ namespace CampusAppWP8.Pages.Mensa
/// Stubbfel, 15.10.2013.
public MensaPage()
{
+ this.locationID = 0;
+
this.InitializeComponent();
ApplicationBarMenuItem menuItem1 = ApplicationBar.MenuItems[0] as ApplicationBarMenuItem;
ApplicationBarMenuItem menuItem2 = ApplicationBar.MenuItems[1] as ApplicationBarMenuItem;
ApplicationBarMenuItem menuItem3 = ApplicationBar.MenuItems[2] as ApplicationBarMenuItem;
+ ApplicationBarMenuItem menuItem4 = ApplicationBar.MenuItems[3] as ApplicationBarMenuItem;
+ ApplicationBarMenuItem menuItem5 = ApplicationBar.MenuItems[4] as ApplicationBarMenuItem;
if (menuItem1 != null)
{
@@ -76,11 +83,36 @@ namespace CampusAppWP8.Pages.Mensa
menuItem3.Text = CampusAppWPortalLib8.Resources.AppResources.Campus_SFBMain;
}
+ if (menuItem4 != null)
+ {
+ menuItem4.Text = AppResources.MensaApp_Dayplan + " " + AppResources.Copy;
+ }
+
+ if (menuItem5 != null)
+ {
+ menuItem5.Text = AppResources.MensaApp_Weekplan + " " + AppResources.Copy;
+ }
+
this.DefHeader.ProgressVisibility = Visibility.Visible;
}
#endregion
+ /// Gets or sets the identifier of the location.
+ /// The identifier of the location.
+ public int LocationID
+ {
+ get
+ {
+ return this.locationID;
+ }
+
+ set
+ {
+ this.locationID = value;
+ }
+ }
+
#region Method
#region protected
@@ -165,12 +197,12 @@ namespace CampusAppWP8.Pages.Mensa
this.InitializeFeed(mensaCampus);
}
}
-
- /* this.campusApi = new CampusSpsApi();
- this.campusApi.OnLoaded += new SpsApi.OnIO(this.SpsApiIsReady);
- this.campusApi.OnFailedLoad += new SpsApi.OnFailed(this.SpsApiIsFail);
- this.campusApi.SetupCurrentCampusRequest();
- this.campusApi.LoadData();*/
+
+ /* this.campusApi = new CampusSpsApi();
+ this.campusApi.OnLoaded += new SpsApi.OnIO(this.SpsApiIsReady);
+ this.campusApi.OnFailedLoad += new SpsApi.OnFailed(this.SpsApiIsFail);
+ this.campusApi.SetupCurrentCampusRequest();
+ this.campusApi.LoadData();*/
}
/// Method initialize the Feed depends of a campus.
@@ -214,6 +246,7 @@ namespace CampusAppWP8.Pages.Mensa
/// Stubbfel, 15.10.2013.
private void FeedIsReady()
{
+ this.feed.SetPrices();
this.SetupMensaPivot();
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
}
@@ -341,6 +374,7 @@ namespace CampusAppWP8.Pages.Mensa
/// Event information.
private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
{
+ this.LocationID = 0;
this.DefHeader.ProgressVisibility = Visibility.Visible;
this.InitializeFeed(CampusAppWPortalLib8.Model.Settings.Campus.CB_MAIN);
}
@@ -351,6 +385,7 @@ namespace CampusAppWP8.Pages.Mensa
/// Event information.
private void ApplicationBarMenuItem2_Click(object sender, EventArgs e)
{
+ this.LocationID = 1;
this.DefHeader.ProgressVisibility = Visibility.Visible;
this.InitializeFeed(CampusAppWPortalLib8.Model.Settings.Campus.CB_SOUTH);
}
@@ -361,6 +396,7 @@ namespace CampusAppWP8.Pages.Mensa
/// Event information.
private void ApplicationBarMenuItem3_Click(object sender, EventArgs e)
{
+ this.LocationID = 2;
this.DefHeader.ProgressVisibility = Visibility.Visible;
this.InitializeFeed(CampusAppWPortalLib8.Model.Settings.Campus.SFB_MAIN);
}
@@ -381,6 +417,80 @@ namespace CampusAppWP8.Pages.Mensa
Clipboard.SetText(copyText);
}
+ /// Copies the menu of the selected day.
+ /// Stubbfel, 18.11.2013.
+ /// button object.
+ /// Event information.
+ private void CopyDay(object sender, EventArgs e)
+ {
+ if (this.MensaPivot == null)
+ {
+ return;
+ }
+
+ int selecetdIndex = this.MensaPivot.SelectedIndex;
+
+ if (this.feed == null || this.feed.Model == null || selecetdIndex >= this.feed.Model.Menus.Count || selecetdIndex < 0)
+ {
+ return;
+ }
+
+ MenuModel menu = this.feed.Model.Menus[selecetdIndex];
+ string copyText = AppResources.MensaApp_Dayplan + " (" + menu.Day + " - " + menu.Date + ") - " + AppResources.Setting_UserCampus + " " + this.feed.Title + " :";
+ copyText = Wp8StringManager.AddNewLine(copyText);
+
+ foreach (MealModel meal in menu.Meals)
+ {
+ copyText += meal.MealName + ": " + meal.MealDesc;
+ copyText = Wp8StringManager.AddNewLine(copyText);
+ }
+
+
+ Clipboard.SetText(copyText);
+ }
+
+ /// Copies all meals from the week.
+ /// Stubbfel, 18.11.2013.
+ /// button object.
+ /// Event information.
+ private void CopyWeek(object sender, EventArgs e)
+ {
+
+ if (this.MensaPivot == null || this.feed == null || this.feed.Model == null)
+ {
+ return;
+ }
+
+ string startDate = null;
+ string endDate = null;
+
+ string copyText = string.Empty;
+ foreach (MenuModel menu in this.feed.Model.Menus)
+ {
+ if (startDate == null)
+ {
+ startDate = menu.Date;
+ }
+ endDate = menu.Date;
+
+ copyText += menu.Day + " (" + menu.Date + "):";
+ copyText = Wp8StringManager.AddNewLine(copyText);
+
+ foreach (MealModel meal in menu.Meals)
+ {
+ copyText += meal.MealName + ": " + meal.MealDesc;
+ copyText = Wp8StringManager.AddNewLine(copyText);
+ }
+ copyText = Wp8StringManager.AddNewLine(copyText);
+
+ }
+
+ string headline = AppResources.MensaApp_Weekplan + " (" + startDate + " - " + endDate + ") - " + AppResources.Setting_UserCampus + " " + this.feed.Title + " :";
+ headline = Wp8StringManager.AddNewLine(headline);
+
+ Clipboard.SetText(headline + copyText);
+ }
+
#endregion
#endregion
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml
index ca481e36..f5e7f4bf 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml
@@ -9,6 +9,7 @@
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header"
xmlns:page="clr-namespace:CampusAppWP8.Utility.Lui.Page"
+ xmlns:utility="clr-namespace:CampusAppWP8.Utility"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
@@ -16,6 +17,11 @@
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
+
+
+
+
+
@@ -27,105 +33,116 @@
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs
index e0d58228..1bc482eb 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml.cs
@@ -9,38 +9,34 @@ namespace CampusAppWP8.Pages.Openinghours
{
using System;
using System.Windows;
+ using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Feed.Openinghours;
- using CampusAppWP8.Model.Openinghours;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using CampusAppWP8.Utility.Lui.Page;
+ using CampusAppWPortalLib8.Model.Openinghours;
- ///
- /// Opening hours page.
- ///
+ /// Opening hours page.
+ /// Fiedler, 13.11.2013.
+ ///
public partial class OpeninghoursPage : PortraitLandscapePage
{
#region Members
- ///
- /// Opening hours feed object.
- ///
+ /// Opening hours feed object.
private OpeninghoursFeed feed = null;
- ///
- /// for checking if the instance is new or a tombstone.
- ///
+ /// for checking if the instance is new or a tombstone.
private bool isNewInstance = false;
#endregion
#region Constructor
- ///
- /// Initializes a new instance of the class.
- ///
+ /// Initializes a new instance of the class.
+ /// Fiedler, 13.11.2013.
public OpeninghoursPage()
{
this.InitializeComponent();
@@ -52,7 +48,7 @@ namespace CampusAppWP8.Pages.Openinghours
this.feed.OnLoaded += new OpeninghoursFeed.OnIO(this.FeedIsReady);
this.feed.OnFailedWeb += new OpeninghoursFeed.OnFailed(this.FeedIsFailedWeb);
this.feed.OnFailedFile += new OpeninghoursFeed.OnFailed(this.FeedIsFailedFile);
- this.feed.LoadData(Utilities.GetLoadModus());
+ this.feed.LoadData(Utilities.GetLoadModus());
}
this.isNewInstance = true;
@@ -64,10 +60,9 @@ namespace CampusAppWP8.Pages.Openinghours
#region protected
- ///
- /// Override the OnNavigatedTo method.
- ///
- /// Arguments of navigation
+ /// Override the OnNavigatedTo method.
+ /// Fiedler, 13.11.2013.
+ ///
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
@@ -76,9 +71,9 @@ namespace CampusAppWP8.Pages.Openinghours
{
if ((this.feed == null) || (this.feed.Model == null))
{
- OpeninghoursWp8Model tempModel = null;
+ OpeninghoursModel tempModel = null;
- if ((tempModel = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_OpeninghoursModel)) != null)
+ if ((tempModel = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_OpeninghoursModel)) != null)
{
this.feed.Model = tempModel;
this.FeedIsReady();
@@ -89,20 +84,23 @@ namespace CampusAppWP8.Pages.Openinghours
}
}
- ///
- /// Override the OnNavigatedFrom method
- ///
- /// Arguments of navigation
+ /// Override the OnNavigatedFrom method.
+ /// Fiedler, 13.11.2013.
+ ///
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
this.feed.SaveData();
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
{
- App.SaveToIsolatedStorage(Constants.IsolatedStorage_OpeninghoursModel, this.feed.Model);
+ App.SaveToIsolatedStorage(Constants.IsolatedStorage_OpeninghoursModel, this.feed.Model);
}
}
+ /// Raises the tap grid event.
+ /// Fiedler, 13.11.2013.
+ /// button object.
+ /// Event information to send to registered event handlers.
private void OnTapGrid(object sender, EventArgs e)
{
@@ -113,55 +111,51 @@ namespace CampusAppWP8.Pages.Openinghours
#region private
- ///
- /// Will be execute if the feed is ready.
- ///
+ /// Will be execute if the feed is ready.
+ /// Fiedler, 13.11.2013.
private void FeedIsReady()
{
- this.InstitutionPanel.ItemsSource = this.feed.Model.Institutions;
+ this.ThePivot.ItemsSource = this.feed.Model.Locations;
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
this.feed.SaveData();
}
///
- /// On clicking the update button in the ApplicationBar.
- /// Force a data update from the web.
+ /// On clicking the update button in the ApplicationBar. Force a data update from the web.
///
- /// button object
- /// event args
+ /// Fiedler, 13.11.2013.
+ /// button object.
+ /// event args.
private void OpenHoursForceUpdate_Click(object sender, EventArgs e)
{
this.DefHeader.ProgressVisibility = Visibility.Visible;
this.feed.ForceWebUpdate();
}
- ///
- /// Method will be execute if the feed is failed
- ///
+ /// Method will be execute if the feed is failed.
+ /// Fiedler, 13.11.2013.
private void FeedIsFailedWeb()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
this.feed.ForceReadFile();
}
- ///
- /// Method will be execute if the feed is failed
- ///
+ /// Method will be execute if the feed is failed.
+ /// Fiedler, 13.11.2013.
private void FeedIsFailedFile()
{
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
}
- ///
- /// Method will be execute if the selection is change in the listbox.
- ///
- /// listbox object.
- /// event args.
+ /// Method will be execute if the selection is change in the listbox.
+ /// Fiedler, 13.11.2013.
+ /// listbox object.
+ /// event args.
private void InstitutionPanel_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
- this.InstitutionPanel.SelectedIndex = -1;
+ (sender as ListBox).SelectedIndex = -1;
}
// private
diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
index a89a5840..972a122b 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
@@ -133,7 +133,10 @@ namespace CampusAppWP8.Pages
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
- this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler);
+ if (device != null)
+ {
+ this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler);
+ }
}
/// Methods overrides the OnNavigatedFrom-Method.
@@ -141,7 +144,10 @@ namespace CampusAppWP8.Pages
///
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
- this.device.StopSubscribingForMessage(this.ndefId);
+ if (device != null)
+ {
+ this.device.StopSubscribingForMessage(this.ndefId);
+ }
base.OnNavigatedFrom(e);
}
@@ -315,7 +321,7 @@ namespace CampusAppWP8.Pages
if (result == MessageBoxResult.OK)
{
Settings.AppSetting.GeoWatchEnable = true;
- Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPosition));
+ Thread thread = new Thread(new ThreadStart(this.PositionThread));
thread.Start();
}
else
@@ -324,6 +330,13 @@ namespace CampusAppWP8.Pages
}
}
+ /// Position thread.
+ /// Stubbfel, 18.11.2013.
+ private void PositionThread()
+ {
+ Utilities.DetermineAndStoreCurrentPosition();
+ }
+
/// Event handler. Called by PintoStart for click events.
/// Stubbfel, 15.10.2013.
/// Caller of the function.
@@ -392,6 +405,11 @@ namespace CampusAppWP8.Pages
/// The message.
private void NDEFHandler(ProximityDevice sender, ProximityMessage message)
{
+ if (device == null)
+ {
+ return;
+ }
+
// create ndefMessage
this.device.StopSubscribingForMessage(message.SubscriptionId);
var ndefMessage = message.Data;
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index 97f47b74..1defd00d 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -285,6 +285,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Kopieren ähnelt.
+ ///
+ public static string Copy {
+ get {
+ return ResourceManager.GetString("Copy", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Erstellen ähnelt.
///
@@ -384,6 +393,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Angestellte ähnelt.
+ ///
+ public static string Employees {
+ get {
+ return ResourceManager.GetString("Employees", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Events ähnelt.
///
@@ -429,6 +447,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Gäste ähnelt.
+ ///
+ public static string Guests {
+ get {
+ return ResourceManager.GetString("Guests", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
///
@@ -735,6 +762,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Tagesplan ähnelt.
+ ///
+ public static string MensaApp_Dayplan {
+ get {
+ return ResourceManager.GetString("MensaApp_Dayplan", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die 84 ähnelt.
///
@@ -753,6 +789,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Wochenplan ähnelt.
+ ///
+ public static string MensaApp_Weekplan {
+ get {
+ return ResourceManager.GetString("MensaApp_Weekplan", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die BTU-Tag ähnelt.
///
@@ -1275,6 +1320,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Studenten ähnelt.
+ ///
+ public static string Students {
+ get {
+ return ResourceManager.GetString("Students", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die vorlesen ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
index 52126cbe..6bdddefb 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -598,5 +598,22 @@
KW
+
+ Angestellte
+
+
+ Gäste
+
+
+ Studenten
+
+
+ Kopieren
+
+
+ Tagesplan
+
+
+ Wochenplan
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index 5d487472..28a28b70 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -247,7 +247,7 @@
OpeninghoursFeed.xml
- http://www.tu-cottbus.de/campusapp-data/getdata.php?db=openinghours&app=2&appversion=1
+ http://www.tu-cottbus.de/campusapp-data/openinghours.php?v=2
NewsFeed.xml
@@ -602,5 +602,10 @@
Raumnummer
+
+ mensaprice.xml
+
+
+ http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
index cdd89127..ea41e3aa 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs
@@ -384,6 +384,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die mensaprice.xml ähnelt.
+ ///
+ public static string FileMensaPrice {
+ get {
+ return ResourceManager.GetString("FileMensaPrice", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die NewsFeed.xml ähnelt.
///
@@ -1384,7 +1393,16 @@ namespace CampusAppWP8.Resources {
}
///
- /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=openinghours&app=2&appversion=1 ähnelt.
+ /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1 ähnelt.
+ ///
+ public static string UrlMensaPrice {
+ get {
+ return ResourceManager.GetString("UrlMensaPrice", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/openinghours.php?v=2 ähnelt.
///
public static string UrlOpeningHours_OpeningHours {
get {
diff --git a/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs
new file mode 100644
index 00000000..07a8dd99
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs
@@ -0,0 +1,113 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 13.11.2013
+// Implements the identifier to place converter class
+//-----------------------------------------------------------------------
+namespace CampusAppWP8.Utility
+{
+ using System;
+ using System.Windows.Data;
+ using CampusAppWP8.File.Places;
+ using CampusAppWPortalLib8.Model.GeoDb;
+
+ /// An identifier to place converter.
+ /// Fiedler, 13.11.2013.
+ ///
+ public sealed class IdToPlaceConverter : IValueConverter
+ {
+ /// The place file.
+ private PlacesFile placeFile = null;
+
+ /// Initializes a new instance of the IdToPlaceConverter class.
+ /// Fiedler, 13.11.2013.
+ public IdToPlaceConverter()
+ {
+ this.placeFile = new PlacesFile();
+ this.placeFile.OnLoaded += this.PlaceFileIsReady;
+ this.placeFile.OnFailedLoad += this.PlaceFileIsFailed;
+ this.placeFile.LoadData();
+ }
+
+ ///
+ /// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
+ ///
+ /// Fiedler, 13.11.2013.
+ /// info string of the place.
+ ///
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
+ {
+ string retValue = string.Empty;
+ string paramStr = "Name";
+
+ if (parameter is string)
+ {
+ paramStr = (string)parameter;
+ }
+
+ if (value is string)
+ {
+ retValue = this.GetInfo((string)value, paramStr);
+ }
+ else if (value is int)
+ {
+ retValue = this.GetInfo(string.Empty + (int)value, paramStr);
+ }
+
+ return retValue;
+ }
+
+ ///
+ /// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in
+ /// -Bindungen aufgerufen.
+ ///
+ /// Fiedler, 13.11.2013.
+ /// null
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
+ {
+ object retValue = null;
+
+ /*
+ if(targetType.Equals(typeof(int)))
+ {
+ retValue = new int();
+ retValue =
+ }
+ */
+ return retValue;
+ }
+
+ /// Gets an information.
+ /// Fiedler, 13.11.2013.
+ /// Identifier for the place.
+ /// Information describing the search.
+ /// The information.
+ private string GetInfo(string placeID, string searchInfo)
+ {
+ string retValue = string.Empty;
+
+ if (this.placeFile.Model != null)
+ {
+ PlaceModel model = this.placeFile.Model.GetPlaceById(placeID);
+ retValue = model.GetInformationsValue(searchInfo);
+ }
+
+ return retValue;
+ }
+
+ /// Place file is failed.
+ /// Fiedler, 13.11.2013.
+ private void PlaceFileIsFailed()
+ {
+ }
+
+ /// Place file is ready.
+ /// Fiedler, 13.11.2013.
+ private void PlaceFileIsReady()
+ {
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml
new file mode 100644
index 00000000..747b8420
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml
@@ -0,0 +1,18 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs
new file mode 100644
index 00000000..4d050d77
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs
@@ -0,0 +1,94 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 14.11.2013
+// Implements the multi value text block.xaml class
+//-----------------------------------------------------------------------
+namespace CampusAppWP8.Utility.Lui
+{
+ using System.Windows;
+ using System.Windows.Controls;
+ using System.Windows.Data;
+
+ /// A multi value text block.
+ /// Fiedler, 14.11.2013.
+ ///
+ public partial class MultiValueTextBlock : UserControl
+ {
+ /// The value 1 property.
+ public static readonly DependencyProperty Value_1_Property = DependencyProperty.Register("Value1", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
+ /// The value 2 property.
+ public static readonly DependencyProperty Value_2_Property = DependencyProperty.Register("Value2", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
+
+ /// The converter property.
+ public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(IValueConverter), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
+
+ /// Initializes a new instance of the MultiValueTextBlock class.
+ /// Fiedler, 14.11.2013.
+ public MultiValueTextBlock() : base()
+ {
+ this.InitializeComponent();
+ }
+
+ /// Gets or sets the converter.
+ /// The converter.
+ public IValueConverter Converter
+ {
+ get
+ {
+ return (IValueConverter)this.GetValue(ConverterProperty);
+ }
+
+ set
+ {
+ this.SetValue(ConverterProperty, value);
+ }
+ }
+
+ /// Gets or sets the value 1.
+ /// The value 1.
+ public object Value1
+ {
+ get
+ {
+ return this.GetValue(Value_1_Property);
+ }
+
+ set
+ {
+ this.SetValue(Value_1_Property, value);
+ }
+ }
+
+ /// Gets or sets the value 2.
+ /// The value 2.
+ public object Value2
+ {
+ get
+ {
+ return this.GetValue(Value_2_Property);
+ }
+
+ set
+ {
+ this.SetValue(Value_2_Property, value);
+ }
+ }
+
+ /// Raises the dependency property changed event.
+ /// Fiedler, 14.11.2013.
+ /// The DependencyObject to process.
+ /// Event information to send to registered event handlers.
+ private static void OnLoaded(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ MultiValueTextBlock obj = d as MultiValueTextBlock;
+
+ if ((obj.Value1 != null) && (obj.Value2 != null) && (obj.Converter != null))
+ {
+ obj.TheText.Text = (string)obj.Converter.Convert(obj.Value1, typeof(string), obj.Value2, System.Globalization.CultureInfo.CurrentCulture);
+ }
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs
new file mode 100644
index 00000000..73caa561
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs
@@ -0,0 +1,100 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 14.11.2013
+// Implements the meal identifier to price converter class
+//-----------------------------------------------------------------------
+namespace CampusAppWP8.Utility
+{
+ using System;
+ using System.Windows.Data;
+ using CampusAppWP8.Feed.Mensa;
+ using CampusAppWP8.Resources;
+ using CampusAppWPortalLib8.Model.Mensa;
+
+ /// A meal identifier to price converter.
+ /// Fiedler, 14.11.2013.
+ ///
+ public sealed class MealIdToPriceConverter : IValueConverter
+ {
+ /// The price feed.
+ private PriceFeed priceFeed = null;
+
+ /// Initializes a new instance of the MealIdToPriceConverter class.
+ /// Fiedler, 14.11.2013.
+ public MealIdToPriceConverter()
+ {
+ this.priceFeed = new PriceFeed();
+ this.priceFeed.OnLoaded += this.PriceFeedIsReady;
+ this.priceFeed.OnFailedLoad += this.PriceFeedIsFailed;
+ this.priceFeed.LoadData();
+ }
+
+ ///
+ /// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
+ ///
+ /// Fiedler, 14.11.2013.
+ ///
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
+ {
+ string retValue = string.Empty;
+ int intVal = -1;
+ int intParam = -1;
+
+ if (value is int)
+ {
+ intVal = (int)value;
+ }
+ else if(value is string)
+ {
+ intVal = int.Parse((string)value);
+ }
+
+ if (parameter is int)
+ {
+ intParam = (int)parameter;
+ }
+ else if (parameter is string)
+ {
+ intParam = int.Parse((string)parameter);
+ }
+
+ if ((intVal >= 0) && (intParam >= 0))
+ {
+ if (this.priceFeed != null && this.priceFeed.Model != null)
+ {
+ PriceMealModel model = this.priceFeed.Model.GetCanteen(intParam).GetPriceMealModel(intVal);
+ retValue = AppResources.Students + ": " + model.PriceStudentStr + " € " + AppResources.Employees + ": " + model.PriceEmployeeStr + " € " + AppResources.Guests + ": " + model.PriceGuestStr + " €";
+ }
+ }
+
+ return retValue;
+ }
+
+ ///
+ /// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in
+ /// -Bindungen aufgerufen.
+ ///
+ /// Fiedler, 14.11.2013.
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
+ {
+ return null;
+ }
+
+ /// Price feed is ready.
+ /// Fiedler, 14.11.2013.
+ private void PriceFeedIsReady()
+ {
+ this.priceFeed.SaveData();
+ }
+
+ /// Price feed is failed.
+ /// Fiedler, 14.11.2013.
+ private void PriceFeedIsFailed()
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs
index 6a38a13a..f1df31c3 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs
@@ -228,14 +228,14 @@ namespace CampusAppWP8.Utility
/// Method determine the current position of the phone.
/// Stubbfel, 14.10.2013.
/// the position of the phone.
- public static GeoPosition DetermineCurrentPosition()
+ public static GeoPosition DetermineCurrentPosition(GeoPositionAccuracy accuracy = GeoPositionAccuracy.High)
{
if (!Settings.AppSetting.GeoWatchEnable)
{
return null;
}
- GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
+ GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(accuracy);
bool success = watcher.TryStart(false, TimeSpan.FromMilliseconds(10000));
GeoPosition geoposition = null;
if (success)
@@ -263,9 +263,9 @@ namespace CampusAppWP8.Utility
/// Method determine and store the current position of the phone.
/// Stubbfel, 14.10.2013.
- public static void DetermineAndStoreCurrentPositionForce()
+ public static void DetermineAndStoreCurrentPositionForce(GeoPositionAccuracy accuracy = GeoPositionAccuracy.High)
{
- GeoPosition geoposition = Utilities.DetermineCurrentPosition();
+ GeoPosition geoposition = Utilities.DetermineCurrentPosition(accuracy);
if (geoposition != null)
{
@@ -285,19 +285,19 @@ namespace CampusAppWP8.Utility
/// Method determine and store the current position of the phone, in 15 min interval.
///
/// Stubbfel, 14.10.2013.
- public static void DetermineAndStoreCurrentPosition()
+ public static void DetermineAndStoreCurrentPosition(GeoPositionAccuracy accuracy = GeoPositionAccuracy.High)
{
GeoMapPoint currentPoint = App.LoadFromAppState(Constants.GeoWatch_CurrentPositionPoint);
if (currentPoint == null)
{
- Utilities.DetermineAndStoreCurrentPositionForce();
+ Utilities.DetermineAndStoreCurrentPositionForce(accuracy);
}
else
{
DateTime expired = new DateTime(currentPoint.Timestamp).AddMinutes(15);
if (DateTime.Now.Ticks > expired.Ticks)
{
- Utilities.DetermineAndStoreCurrentPositionForce();
+ Utilities.DetermineAndStoreCurrentPositionForce(accuracy);
}
}
}
@@ -378,16 +378,25 @@ namespace CampusAppWP8.Utility
/// Gets the determined campus.
/// Stubbfel, 14.10.2013.
/// The Campus.
- public static Campus DetermineCampus()
+ public static Campus DetermineCampus(GeoPositionAccuracy accuracy = GeoPositionAccuracy.Default)
{
Campus result = Campus.UserSettingCampus;
- Utilities.DetermineAndStoreCurrentPosition();
+
+ Utilities.DetermineAndStoreCurrentPosition(accuracy);
MapPoint currentPoint = App.LoadFromAppState("CurrentGeoPoint");
if (currentPoint == null)
{
- return result;
+ if (accuracy.Equals(GeoPositionAccuracy.High))
+ {
+
+ return result;
+ }
+ else
+ {
+ return Utilities.DetermineCampus(GeoPositionAccuracy.High);
+ }
}
MapPoint tmpCampus = CampusMapPoints.NorthCB;
diff --git a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj
index ea952363..addae01f 100644
--- a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj
+++ b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj
@@ -62,8 +62,13 @@
+
+
+
+
+
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/MealModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/MealModel.cs
index 18a32b4d..e1502d6f 100644
--- a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/MealModel.cs
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/MealModel.cs
@@ -112,6 +112,10 @@ namespace CampusAppWPortalLib8.Model.Mensa
/// The icon URL.
public string IconUrl { get; set; }
+ /// Gets or sets the price.
+ /// The price.
+ public string Price { get; set; }
+
/// Gets or sets the icon name.
/// The name of the icon.
[XmlAttribute("icon")]
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceCanteenModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceCanteenModel.cs
new file mode 100644
index 00000000..26d6c5c3
--- /dev/null
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceCanteenModel.cs
@@ -0,0 +1,185 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 13.11.2013
+// Implements the price canteen model class
+//-----------------------------------------------------------------------
+namespace CampusAppWPortalLib8.Model.Mensa
+{
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+ using CampusAppWPortalLib8.Model.Utility;
+
+ /// A data Model for the price canteen.
+ /// Fiedler, 13.11.2013.
+ public class PriceCanteenModel
+ {
+ /// The identifier.
+ private int id = -1;
+ /// The name de.
+ private string name_de = string.Empty;
+ /// URL of the name.
+ private string name_url = string.Empty;
+ /// The position.
+ private MapPoint pos = null;
+ /// List of prices.
+ private ObservableCollection priceList = null;
+
+ /// Initializes a new instance of the PriceCanteenModel class.
+ /// Fiedler, 13.11.2013.
+ public PriceCanteenModel()
+ {
+ this.pos = new MapPoint(-1, -1);
+ this.priceList = new ObservableCollection();
+ }
+
+ /// Gets or sets the identifier.
+ /// The identifier.
+ [XmlAttribute("id")]
+ public string IdStr
+ {
+ get
+ {
+ return string.Empty + this.id;
+ }
+
+ set
+ {
+ this.id = int.Parse(value);
+ }
+ }
+
+ /// Gets or sets the identifier.
+ /// The identifier.
+ [XmlIgnore]
+ public int Id
+ {
+ get
+ {
+ return this.id;
+ }
+
+ set
+ {
+ this.id = value;
+ }
+ }
+
+ /// Gets or sets the name.
+ /// The name.
+ [XmlAttribute("name_de")]
+ public string Name
+ {
+ get
+ {
+ return this.name_de;
+ }
+
+ set
+ {
+ this.name_de = value;
+ }
+ }
+
+ /// Gets or sets URL of the document.
+ /// The URL.
+ [XmlAttribute("name_url")]
+ public string Url
+ {
+ get
+ {
+ return this.name_url;
+ }
+
+ set
+ {
+ this.name_url = value;
+ }
+ }
+
+ /// Gets or sets the x coordinate.
+ /// The x coordinate.
+ [XmlAttribute("x")]
+ public string X
+ {
+ get
+ {
+ return string.Empty + this.pos.X;
+ }
+
+ set
+ {
+ this.pos.X = double.Parse(value);
+ }
+ }
+
+ /// Gets or sets the y coordinate.
+ /// The y coordinate.
+ [XmlAttribute("y")]
+ public string Y
+ {
+ get
+ {
+ return string.Empty + this.pos.Y;
+ }
+
+ set
+ {
+ this.pos.Y = double.Parse(value);
+ }
+ }
+
+ /// Gets or sets the position.
+ /// The position.
+ [XmlIgnore]
+ public MapPoint Position
+ {
+ get
+ {
+ return this.pos;
+ }
+
+ set
+ {
+ this.pos = value;
+ }
+ }
+
+ /// Gets or sets the prices.
+ /// The prices.
+ [XmlElement("price")]
+ public ObservableCollection Prices
+ {
+ get
+ {
+ return this.priceList;
+ }
+
+ set
+ {
+ this.priceList = value;
+ }
+ }
+
+ /// Gets price meal model.
+ /// Fiedler, 13.11.2013.
+ /// Identifier for the meal.
+ /// The price meal model.
+ public PriceMealModel GetPriceMealModel(int meal_id)
+ {
+ PriceMealModel retValue = null;
+
+ for (int i = 0; i < this.priceList.Count; i++)
+ {
+ if (this.priceList[i].MealID.Equals(meal_id))
+ {
+ retValue = this.priceList[i];
+ }
+ }
+
+ return retValue;
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs
new file mode 100644
index 00000000..460322f6
--- /dev/null
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs
@@ -0,0 +1,169 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 13.11.2013
+// Implements the price meal model class
+//-----------------------------------------------------------------------
+namespace CampusAppWPortalLib8.Model.Mensa
+{
+ using System.Xml.Serialization;
+
+ /// A data Model for the price meal.
+ /// Fiedler, 13.11.2013.
+ public class PriceMealModel
+ {
+ /// Identifier for the meal.
+ private int meal_id = -1;
+ /// The price student.
+ private double priceStudent = 0;
+ /// The price employee.
+ private double priceEmployee = 0;
+ /// The price guest.
+ private double priceGuest = 0;
+
+ /// Initializes a new instance of the PriceMealModel class.
+ /// Fiedler, 13.11.2013.
+ public PriceMealModel()
+ {
+ }
+
+ /// Gets or sets the identifier of the meal.
+ /// The identifier of the meal.
+ [XmlAttribute("meal_id")]
+ public string MealIDStr
+ {
+ get
+ {
+ return string.Empty + this.meal_id;
+ }
+
+ set
+ {
+ this.meal_id = int.Parse(value);
+ }
+ }
+
+ /// Gets or sets the identifier of the meal.
+ /// The identifier of the meal.
+ [XmlIgnore]
+ public int MealID
+ {
+ get
+ {
+ return this.meal_id;
+ }
+
+ set
+ {
+ this.meal_id = value;
+ }
+ }
+
+ /// Gets or sets the price student.
+ /// The price student.
+ [XmlAttribute("s")]
+ public string PriceStudentStr
+ {
+ get
+ {
+ return this.CurrencyString(this.priceStudent);
+ }
+
+ set
+ {
+ this.priceStudent = double.Parse(value);
+ }
+ }
+
+ /// Gets or sets the price student.
+ /// The price student.
+ [XmlIgnore]
+ public double PriceStudent
+ {
+ get
+ {
+ return this.priceStudent;
+ }
+
+ set
+ {
+ this.priceStudent = value;
+ }
+ }
+
+ /// Gets or sets the price employee.
+ /// The price employee.
+ [XmlAttribute("e")]
+ public string PriceEmployeeStr
+ {
+ get
+ {
+ return this.CurrencyString(this.priceEmployee);
+ }
+
+ set
+ {
+ this.priceEmployee = double.Parse(value);
+ }
+ }
+
+ /// Gets or sets the price employee.
+ /// The price employee.
+ [XmlIgnore]
+ public double PriceEmployee
+ {
+ get
+ {
+ return this.priceEmployee;
+ }
+
+ set
+ {
+ this.priceEmployee = value;
+ }
+ }
+
+ /// Gets or sets the price guest.
+ /// The price guest.
+ [XmlAttribute("g")]
+ public string PriceGuestStr
+ {
+ get
+ {
+ return this.CurrencyString(this.priceGuest);
+ }
+
+ set
+ {
+ this.priceGuest = double.Parse(value);
+ }
+ }
+
+ /// Gets or sets the price guest.
+ /// The price guest.
+ [XmlIgnore]
+ public double PriceGuest
+ {
+ get
+ {
+ return this.priceGuest;
+ }
+
+ set
+ {
+ this.priceGuest = value;
+ }
+ }
+
+ /// Currency string.
+ /// Fiedler, 14.11.2013.
+ /// The value.
+ /// A string.
+ private string CurrencyString(double val)
+ {
+ return string.Format("{0:0.00}", val);
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
new file mode 100644
index 00000000..5630e72a
--- /dev/null
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
@@ -0,0 +1,76 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 13.11.2013
+// Implements the price model class
+//-----------------------------------------------------------------------
+namespace CampusAppWPortalLib8.Model.Mensa
+{
+ using CampusAppWPortalLib8.Model.Settings;
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+
+ /// A data Model for the price.
+ /// Fiedler, 13.11.2013.
+ [XmlRoot("root")]
+ public class PriceModel
+ {
+ /// The canteens.
+ private ObservableCollection canteens = null;
+
+ /// Initializes a new instance of the PriceModel class.
+ /// Fiedler, 13.11.2013.
+ public PriceModel()
+ {
+ this.canteens = new ObservableCollection();
+ }
+
+ /// Gets or sets the canteens.
+ /// The canteens.
+ [XmlArray("Canteens")]
+ [XmlArrayItem("Canteen")]
+ public ObservableCollection Canteens
+ {
+ get
+ {
+ return this.canteens;
+ }
+
+ set
+ {
+ this.canteens = value;
+ }
+ }
+
+ /// Gets a canteen.
+ /// Fiedler, 13.11.2013.
+ /// The identifier.
+ /// The canteen.
+ public PriceCanteenModel GetCanteen(int id)
+ {
+ PriceCanteenModel retValue = null;
+
+ foreach (PriceCanteenModel prize in this.canteens)
+ {
+ if (prize.Id == id)
+ {
+ retValue = prize;
+ break;
+ }
+ }
+
+ return retValue;
+ }
+
+ /// Gets a canteen.
+ /// Stubbfel, 18.11.2013.
+ /// The campus.
+ /// The canteen.
+ public PriceCanteenModel GetCanteen(Campus campus)
+ {
+ return this.GetCanteen((int)campus - 1);
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpenhoursDayModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpenhoursDayModel.cs
new file mode 100644
index 00000000..0718c121
--- /dev/null
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpenhoursDayModel.cs
@@ -0,0 +1,217 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 12.11.2013
+// Implements the openhours day model class
+//-----------------------------------------------------------------------
+namespace CampusAppWPortalLib8.Model.Openinghours
+{
+ using System;
+ using System.Xml.Serialization;
+
+ /// A data Model for the openinghours day.
+ /// Fiedler, 12.11.2013.
+ [XmlRoot("Open")]
+ public class OpeninghoursDayModel
+ {
+ /// The start.
+ private TimeSpan start;
+ /// The end.
+ private TimeSpan end;
+ /// The day.
+ private DayOfWeek day;
+
+ /// Initializes a new instance of the OpeninghoursDayModel class.
+ /// Fiedler, 12.11.2013.
+ public OpeninghoursDayModel()
+ {
+ this.start = TimeSpan.Zero;
+ this.end = TimeSpan.Zero;
+ this.day = DayOfWeek.Sunday;
+ }
+
+ /// Gets or sets the start.
+ /// The start.
+ [XmlAttribute("start")]
+ public string Start
+ {
+ get
+ {
+ return this.TimeSpanToString(this.start);
+ }
+
+ set
+ {
+ this.start = this.StringToTimeSpan(value);
+ }
+ }
+
+ /// Gets or sets the start.
+ /// The start.
+ [XmlIgnore]
+ public TimeSpan StartTS
+ {
+ get
+ {
+ return this.start;
+ }
+
+ set
+ {
+ this.start = value;
+ }
+ }
+
+ /// Gets or sets the end.
+ /// The end.
+ [XmlAttribute("end")]
+ public string End
+ {
+ get
+ {
+ return this.TimeSpanToString(this.end);
+ }
+
+ set
+ {
+ this.end = this.StringToTimeSpan(value);
+ }
+ }
+
+ /// Gets or sets the end.
+ /// The end.
+ [XmlIgnore]
+ public TimeSpan EndTS
+ {
+ get
+ {
+ return this.end;
+ }
+
+ set
+ {
+ this.end = value;
+ }
+ }
+
+ /// Gets or sets the day.
+ /// The day.
+ [XmlAttribute("day")]
+ public int Day
+ {
+ get
+ {
+ return this.DayOfWeekToInt(this.day);
+ }
+
+ set
+ {
+ this.day = this.IntToDayOfWeek(value);
+ }
+ }
+
+ /// Gets or sets the day.
+ /// The day.
+ [XmlIgnore]
+ public DayOfWeek DayDOW
+ {
+ get
+ {
+ return this.day;
+ }
+
+ set
+ {
+ this.day = value;
+ }
+ }
+
+ /// Gets the time string.
+ /// The time string.
+ [XmlIgnore]
+ public string TimeString
+ {
+ get
+ {
+ return this.TimeSpanToString(this.start) + " - " + this.TimeSpanToString(this.end);
+ }
+ }
+
+ /// String to time span.
+ /// Fiedler, 12.11.2013.
+ /// The.
+ /// A TimeSpan.
+ private TimeSpan StringToTimeSpan(string str)
+ {
+ string[] split = str.Split(':');
+
+ return new TimeSpan(
+ int.Parse(split[0]),
+ (split.Length > 1) ? int.Parse(split[1]) : 0,
+ (split.Length > 2) ? int.Parse(split[2]) : 0);
+ }
+
+ /// Time span to string.
+ /// Fiedler, 12.11.2013.
+ /// The span.
+ /// A string.
+ private string TimeSpanToString(TimeSpan span)
+ {
+ return string.Format("{0:hh\\:mm}", span);
+ }
+
+ /// Int to day of week.
+ /// Fiedler, 12.11.2013.
+ ///
+ /// Thrown when the requested operation is not supported.
+ ///
+ /// The day nr.
+ /// A DayOfWeek.
+ private DayOfWeek IntToDayOfWeek(int dayNr)
+ {
+ DayOfWeek retValue = DayOfWeek.Sunday;
+
+ switch(dayNr)
+ {
+ case 1: retValue = DayOfWeek.Monday; break;
+ case 2: retValue = DayOfWeek.Tuesday; break;
+ case 3: retValue = DayOfWeek.Wednesday; break;
+ case 4: retValue = DayOfWeek.Thursday; break;
+ case 5: retValue = DayOfWeek.Friday; break;
+ case 6: retValue = DayOfWeek.Saturday; break;
+ case 7: retValue = DayOfWeek.Sunday; break;
+
+ default:
+ {
+ throw new NotSupportedException("day number is not supported (" + dayNr + ")");
+ }
+ }
+
+ return retValue;
+ }
+
+ /// Day of week to int.
+ /// Fiedler, 12.11.2013.
+ /// The dow.
+ /// An int.
+ private int DayOfWeekToInt(DayOfWeek dow)
+ {
+ int retValue = -1;
+
+ switch (dow)
+ {
+ case DayOfWeek.Monday: retValue = 1; break;
+ case DayOfWeek.Tuesday: retValue = 2; break;
+ case DayOfWeek.Wednesday: retValue = 3; break;
+ case DayOfWeek.Thursday: retValue = 4; break;
+ case DayOfWeek.Friday: retValue = 5; break;
+ case DayOfWeek.Saturday: retValue = 6; break;
+ case DayOfWeek.Sunday: retValue = 7; break;
+ }
+
+ return retValue;
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursInstitutionModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursInstitutionModel.cs
index 5a59452b..e2c4892d 100644
--- a/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursInstitutionModel.cs
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursInstitutionModel.cs
@@ -8,6 +8,8 @@
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Openinghours
{
+ using System;
+ using System.Collections.ObjectModel;
using System.Globalization;
using System.Windows;
using System.Xml.Serialization;
@@ -24,27 +26,6 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// English version of the institution title.
private string titleEN = string.Empty;
- /// Opening hours on monday.
- private string dayMonday = string.Empty;
-
- /// Opening hours on tuesday.
- private string dayTuesday = string.Empty;
-
- /// Opening hours on wednesday.
- private string dayWednesday = string.Empty;
-
- /// Opening hours on thursday.
- private string dayThursday = string.Empty;
-
- /// Opening hours on friday.
- private string dayFriday = string.Empty;
-
- /// Opening hours on saturday.
- private string daySaturday = string.Empty;
-
- /// Opening hours on sunday.
- private string daySunday = string.Empty;
-
/// Email address of the institution.
private string infoEmail = string.Empty;
@@ -63,6 +44,9 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// English version of the comment.
private string commentEN = string.Empty;
+ /// List of days.
+ private ObservableCollection dayList = null;
+
#endregion
#region Constructor
@@ -73,6 +57,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// Stubbfel, 15.10.2013.
public OpeninghoursInstitutionModel()
{
+ this.dayList = new ObservableCollection();
}
#endregion
@@ -111,115 +96,80 @@ namespace CampusAppWPortalLib8.Model.Openinghours
}
}
- /// Gets or sets the open hours on monday.
+ /// Gets the open hours on monday.
/// The monday.
- [XmlAttribute("monday")]
+ [XmlIgnore]
public string Monday
{
get
{
- return this.dayMonday;
- }
-
- set
- {
- this.dayMonday = this.FixOpeninghoursString(value);
+ return this.DayToString(DayOfWeek.Monday);
}
}
- /// Gets or sets the open hours on tuesday.
+ /// Gets the open hours on tuesday.
/// The tuesday.
- [XmlAttribute("tuesday")]
+ [XmlIgnore]
public string Tuesday
{
get
{
- return this.dayTuesday;
- }
-
- set
- {
- this.dayTuesday = this.FixOpeninghoursString(value);
+ return this.DayToString(DayOfWeek.Tuesday);
}
}
- /// Gets or sets the open hours on wednesday.
+ /// Gets the open hours on wednesday.
/// The wednesday.
- [XmlAttribute("wednesday")]
+ [XmlIgnore]
public string Wednesday
{
get
{
- return this.dayWednesday;
- }
-
- set
- {
- this.dayWednesday = this.FixOpeninghoursString(value);
+ return this.DayToString(DayOfWeek.Wednesday);
}
}
- /// Gets or sets the open hours on thursday.
+ /// Gets the open hours on thursday.
/// The thursday.
- [XmlAttribute("thursday")]
+ [XmlIgnore]
public string Thursday
{
get
{
- return this.dayThursday;
- }
-
- set
- {
- this.dayThursday = this.FixOpeninghoursString(value);
+ return this.DayToString(DayOfWeek.Thursday);
}
}
- /// Gets or sets the open hours on friday.
+ /// Gets the open hours on friday.
/// The friday.
- [XmlAttribute("friday")]
+ [XmlIgnore]
public string Friday
{
get
{
- return this.dayFriday;
- }
-
- set
- {
- this.dayFriday = this.FixOpeninghoursString(value);
+ return this.DayToString(DayOfWeek.Friday);
}
}
- /// Gets or sets the open hours on saturday.
+ /// Gets the open hours on saturday.
/// The saturday.
- [XmlAttribute("saturday")]
+ [XmlIgnore]
public string Saturday
{
get
{
- return this.daySaturday;
- }
-
- set
- {
- this.daySaturday = this.FixOpeninghoursString(value);
+ return this.DayToString(DayOfWeek.Saturday);
}
}
- /// Gets or sets the open hours on sunday.
+ /// Gets the open hours on sunday.
/// The sunday.
- [XmlAttribute("sunday")]
+ [XmlIgnore]
public string Sunday
{
get
{
- return this.daySunday;
- }
-
- set
- {
- this.daySunday = this.FixOpeninghoursString(value);
+ return this.DayToString(DayOfWeek.Sunday);
}
}
@@ -319,11 +269,28 @@ namespace CampusAppWPortalLib8.Model.Openinghours
}
}
+ /// Gets or sets the days.
+ /// The days.
+ [XmlElement("Open")]
+ public ObservableCollection Days
+ {
+ get
+ {
+ return this.dayList;
+ }
+
+ set
+ {
+ this.dayList = value;
+ }
+ }
+
///
/// Gets the localized title. If the phone is set to german language, the german title will
/// be returned otherwise the english title.
///
/// The title.
+ [XmlIgnore]
public string Title
{
get
@@ -344,6 +311,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// will be returned otherwise the english comment.
///
/// The comment.
+ [XmlIgnore]
public string Comment
{
get
@@ -363,6 +331,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// Gets a string containing the email address and the institution title separated by ':'.
///
/// The e mail title.
+ [XmlIgnore]
public string EMailTitle
{
get
@@ -375,6 +344,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// Gets a string containing the phone number and the institution title separated by ':'.
///
/// The phone title.
+ [XmlIgnore]
public string PhoneTitle
{
get
@@ -383,19 +353,183 @@ namespace CampusAppWPortalLib8.Model.Openinghours
}
}
+ /// Gets a value indicating whether the visible monday.
+ /// true if visible monday, false if not.
+ [XmlIgnore]
+ public bool VisibleMonday
+ {
+ get
+ {
+ return this.HasDay(DayOfWeek.Monday);
+ }
+ }
+
+ /// Gets a value indicating whether the visible tuesday.
+ /// true if visible tuesday, false if not.
+ [XmlIgnore]
+ public bool VisibleTuesday
+ {
+ get
+ {
+ return this.HasDay(DayOfWeek.Tuesday);
+ }
+ }
+
+ /// Gets a value indicating whether the visible wednesday.
+ /// true if visible wednesday, false if not.
+ [XmlIgnore]
+ public bool VisibleWednesday
+ {
+ get
+ {
+ return this.HasDay(DayOfWeek.Wednesday);
+ }
+ }
+
+ /// Gets a value indicating whether the visible thursday.
+ /// true if visible thursday, false if not.
+ [XmlIgnore]
+ public bool VisibleThursday
+ {
+ get
+ {
+ return this.HasDay(DayOfWeek.Thursday);
+ }
+ }
+
+ /// Gets a value indicating whether the visible friday.
+ /// true if visible friday, false if not.
+ [XmlIgnore]
+ public bool VisibleFriday
+ {
+ get
+ {
+ return this.HasDay(DayOfWeek.Friday);
+ }
+ }
+
+ /// Gets a value indicating whether the visible saturday.
+ /// true if visible saturday, false if not.
+ [XmlIgnore]
+ public bool VisibleSaturday
+ {
+ get
+ {
+ return this.HasDay(DayOfWeek.Saturday);
+ }
+ }
+
+ /// Gets a value indicating whether the visible sunday.
+ /// true if visible sunday, false if not.
+ [XmlIgnore]
+ public bool VisibleSunday
+ {
+ get
+ {
+ return this.HasDay(DayOfWeek.Sunday);
+ }
+ }
+
+ /// Gets a value indicating whether the visible comment.
+ /// true if visible comment, false if not.
+ [XmlIgnore]
+ public bool VisibleComment
+ {
+ get
+ {
+ return !((this.Comment == string.Empty) || (this.Comment.Length == 0));
+ }
+ }
+
+ /// Gets a value indicating whether the visible mail.
+ /// true if visible mail, false if not.
+ [XmlIgnore]
+ public bool VisibleEMail
+ {
+ get
+ {
+ return !((this.EMail == string.Empty) || (this.EMail.Length == 0));
+ }
+ }
+
+ /// Gets a value indicating whether the visible phone.
+ /// true if visible phone, false if not.
+ [XmlIgnore]
+ public bool VisiblePhone
+ {
+ get
+ {
+ return !((this.Phone == string.Empty) || (this.Phone.Length == 0));
+ }
+ }
+
+ /// Gets a value indicating whether the visible room.
+ /// true if visible room, false if not.
+ [XmlIgnore]
+ public bool VisibleRoom
+ {
+ get
+ {
+ return !((this.Room == string.Empty) || (this.Room.Length == 0));
+ }
+ }
+
+ /// Gets a value indicating whether the visible building.
+ /// true if visible building, false if not.
+ [XmlIgnore]
+ public bool VisibleBuilding
+ {
+ get
+ {
+ return !((this.Building == string.Empty) || (this.Building.Length == 0));
+ }
+ }
+
#endregion
#region Method
- /// Removes unwanted chars in a string.
- /// Stubbfel, 15.10.2013.
- /// input string.
- /// fixed string.
- private string FixOpeninghoursString(string str)
+ /// Day to string.
+ /// Fiedler, 13.11.2013.
+ /// The dow.
+ /// A string.
+ private string DayToString(DayOfWeek dow)
{
string retValue = string.Empty;
- retValue = str.Replace(" | ", "\n");
+ foreach (OpeninghoursDayModel dm in this.dayList)
+ {
+ if (dm.DayDOW.Equals(dow))
+ {
+ if (retValue.Equals(string.Empty))
+ {
+ retValue += dm.TimeString;
+ }
+ else
+ {
+ retValue += "\n" + dm.TimeString;
+ }
+ }
+ }
+
+ return retValue;
+ }
+
+ /// Query if 'dow' has day.
+ /// Fiedler, 13.11.2013.
+ /// The dow.
+ /// true if day, false if not.
+ private bool HasDay(DayOfWeek dow)
+ {
+ bool retValue = false;
+
+ foreach (OpeninghoursDayModel dm in this.dayList)
+ {
+ if (dm.DayDOW.Equals(dow))
+ {
+ retValue = true;
+ }
+ }
return retValue;
}
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursLocationModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursLocationModel.cs
new file mode 100644
index 00000000..e2027919
--- /dev/null
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursLocationModel.cs
@@ -0,0 +1,62 @@
+//-----------------------------------------------------------------------
+//
+// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
+//
+// Fiedler
+// 13.11.2013
+// Implements the openinghours location model class
+//-----------------------------------------------------------------------
+namespace CampusAppWPortalLib8.Model.Openinghours
+{
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+
+ /// Model for menu.
+ /// Stubbfel, 15.10.2013.
+ public class OpeninghoursLocationModel
+ {
+ /// The institutions.
+ private ObservableCollection institutions = null;
+ /// Identifier for the location.
+ private int locationID = -1;
+
+ /// Initializes a new instance of the OpeninghoursLocationModel class.
+ /// Fiedler, 13.11.2013.
+ public OpeninghoursLocationModel()
+ {
+ this.institutions = new ObservableCollection();
+ }
+
+ /// Gets or sets the identifier of the location.
+ /// The identifier of the location.
+ [XmlAttribute("id")]
+ public int LocationID
+ {
+ get
+ {
+ return this.locationID;
+ }
+
+ set
+ {
+ this.locationID = value;
+ }
+ }
+
+ /// Gets or sets the institutions.
+ /// The institutions.
+ [XmlElement("Object")]
+ public ObservableCollection Institutions
+ {
+ get
+ {
+ return this.institutions;
+ }
+
+ set
+ {
+ this.institutions = value;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursModel.cs
index 42492466..c0dc5316 100644
--- a/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursModel.cs
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Openinghours/OpeninghoursModel.cs
@@ -16,7 +16,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// fiedlchr, 15.10.2013.
/// Generic type parameter.
[XmlRoot("root")]
- public class OpeninghoursModel where T : OpeninghoursInstitutionModel
+ public class OpeninghoursModel
{
#region Member
@@ -24,7 +24,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
private readonly DateTime createTime;
/// Gets or sets feed information item list.
- private ObservableCollection institutions;
+ private ObservableCollection locations;
#endregion
@@ -34,7 +34,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// fiedlchr, 15.10.2013.
public OpeninghoursModel()
{
- this.institutions = new ObservableCollection();
+ this.locations = new ObservableCollection();
this.createTime = DateTime.Now;
}
@@ -55,17 +55,17 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// Gets or sets the Institutions.
/// The institutions.
[XmlArray("data")]
- [XmlArrayItem("institution")]
- public ObservableCollection Institutions
+ [XmlArrayItem("Location")]
+ public ObservableCollection Locations
{
get
{
- return this.institutions;
+ return this.locations;
}
set
{
- this.institutions = value;
+ this.locations = value;
}
}
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/MapPoint.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/MapPoint.cs
index 3a6de69f..a9ea34e6 100644
--- a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/MapPoint.cs
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/MapPoint.cs
@@ -134,6 +134,31 @@ namespace CampusAppWPortalLib8.Model.Utility
return false;
}
+ /// Rotate degrees.
+ /// Fiedler, 13.11.2013.
+ /// The fix point.
+ /// The angle degrees. positive values -> counterclockwise rotation.
+ /// A MapPoint.
+ public MapPoint RotateDeg(MapPoint fixPoint, double angleDeg)
+ {
+ return this.Rotate(fixPoint, angleDeg * (Math.PI / 180));
+ }
+
+ /// Rotates.
+ /// Fiedler, 13.11.2013.
+ /// The fix point.
+ /// The angle radians. positive values -> counterclockwise rotation.
+ /// A MapPoint.
+ public MapPoint Rotate(MapPoint fixPoint, double angleRad)
+ {
+ MapPoint retValue = new MapPoint(0, 0);
+
+ retValue.X = fixPoint.X + (this.X - fixPoint.X) * Math.Cos(angleRad) - (this.Y - fixPoint.Y) * Math.Sin(angleRad);
+ retValue.Y = fixPoint.Y + (this.X - fixPoint.X) * Math.Sin(angleRad) + (this.Y - fixPoint.Y) * Math.Cos(angleRad);
+
+ return retValue;
+ }
+
#endregion
}
}