diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index 43b27b8b..698e02d7 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -249,6 +249,9 @@
WeekViewPivotHeader.xaml
+
+ MultiValueTextBlock.xaml
+
WeekView.xaml
@@ -532,6 +535,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml
index ac82d84d..3b83b591 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml
@@ -8,6 +8,7 @@
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"
@@ -71,7 +72,7 @@
-
+
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
index 73cd21d2..8952c549 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
@@ -48,7 +48,8 @@ namespace CampusAppWP8.Pages.Mensa
/// Flag for forcing webLoad.
private bool forceLoad = false;
- public int LocationID { get; set; }
+ /// Identifier for the location.
+ public int locationID = -1;
#endregion
@@ -58,7 +59,7 @@ namespace CampusAppWP8.Pages.Mensa
/// Stubbfel, 15.10.2013.
public MensaPage()
{
- this.LocationID = 0;
+ this.locationID = 0;
this.InitializeComponent();
ApplicationBarMenuItem menuItem1 = ApplicationBar.MenuItems[0] as ApplicationBarMenuItem;
@@ -85,6 +86,21 @@ namespace CampusAppWP8.Pages.Mensa
#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
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index dffe834c..5ab45237 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -375,6 +375,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.
///
@@ -420,6 +429,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.
///
@@ -1266,6 +1284,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 90588cd5..9297b6cd 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -596,4 +596,13 @@
Mi
+
+ Angestellte
+
+
+ Gäste
+
+
+ Studenten
+
\ No newline at end of file
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
index 5adfdb57..dad09bf1 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs
@@ -1,14 +1,29 @@
-namespace CampusAppWP8.Utility
+//-----------------------------------------------------------------------
+//
+// 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 CampusAppWPortalLib8.Model.GeoDb;
+ 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();
@@ -17,28 +32,63 @@
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;
-
- if ((parameter is int) && (value is int))
+ int intVal = -1;
+ int intParam = -1;
+
+ if (value is int)
{
- retValue = this.priceFeed.Model.GetCanteen((int)value).GetPriceMealModel((int)parameter).PriceString();
+ 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))
+ {
+ 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()
{
}
+ /// Price feed is failed.
+ /// Fiedler, 14.11.2013.
private void PriceFeedIsFailed()
{
}
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs
index ff3a2526..460322f6 100644
--- a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceMealModel.cs
@@ -68,7 +68,7 @@ namespace CampusAppWPortalLib8.Model.Mensa
{
get
{
- return string.Format("{0:0.00}", this.priceStudent);
+ return this.CurrencyString(this.priceStudent);
}
set
@@ -100,7 +100,7 @@ namespace CampusAppWPortalLib8.Model.Mensa
{
get
{
- return string.Format("{0:00.0}", this.priceEmployee);
+ return this.CurrencyString(this.priceEmployee);
}
set
@@ -132,7 +132,7 @@ namespace CampusAppWPortalLib8.Model.Mensa
{
get
{
- return string.Format("{0:00.0}", this.priceGuest);
+ return this.CurrencyString(this.priceGuest);
}
set
@@ -157,16 +157,13 @@ namespace CampusAppWPortalLib8.Model.Mensa
}
}
- /// Gets the price string.
- /// Fiedler, 13.11.2013.
+ /// Currency string.
+ /// Fiedler, 14.11.2013.
+ /// The value.
/// A string.
- public string PriceString()
+ private string CurrencyString(double val)
{
- string retValue = string.Empty;
-
- retValue = "S: " + this.PriceGuestStr + " A: " + this.PriceEmployeeStr + " G: " + this.PriceGuestStr;
-
- return retValue;
+ return string.Format("{0:0.00}", val);
}
}
}
diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
index ff66b109..3a62b506 100644
--- a/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
+++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Mensa/PriceModel.cs
@@ -13,7 +13,7 @@ namespace CampusAppWPortalLib8.Model.Mensa
/// A data Model for the price.
/// Fiedler, 13.11.2013.
- [XmlRoot("Canteens")]
+ [XmlRoot("root")]
public class PriceModel
{
/// The canteens.
@@ -28,7 +28,8 @@ namespace CampusAppWPortalLib8.Model.Mensa
/// Gets or sets the canteens.
/// The canteens.
- [XmlElement("Canteen")]
+ [XmlArray("Canteens")]
+ [XmlArrayItem("Canteen")]
public ObservableCollection Canteens
{
get