This commit is contained in:
@@ -249,6 +249,9 @@
|
||||
<DependentUpon>WeekViewPivotHeader.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\Lui\ListBoxFixed.cs" />
|
||||
<Compile Include="Utility\Lui\MultiValueTextBlock.xaml.cs">
|
||||
<DependentUpon>MultiValueTextBlock.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\Lui\Templates\WeekView.xaml.cs">
|
||||
<DependentUpon>WeekView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -532,6 +535,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Utility\Lui\MultiValueTextBlock.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Utility\Lui\Templates\WeekView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -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 @@
|
||||
<TextBlock Text="{Binding MealDesc}" TextWrapping="Wrap" Grid.Column="1"/>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Text="{Binding MealId, Converter={StaticResource MealConverter}, ConverterParameter={Binding LocationID, ElementName=root}}" />
|
||||
<lu:MultiValueTextBlock Value1="{Binding MealId}" Value2="{Binding LocationID, ElementName=root, Mode=OneWay}" Converter="{StaticResource MealConverter}" Grid.Row="1" FontSize="14" HorizontalAlignment="Center" Margin="0,10,0,0"/>
|
||||
</Grid>
|
||||
<toolkit:ContextMenuService.ContextMenu>
|
||||
<toolkit:ContextMenu>
|
||||
|
||||
@@ -48,7 +48,8 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// <summary> Flag for forcing webLoad. </summary>
|
||||
private bool forceLoad = false;
|
||||
|
||||
public int LocationID { get; set; }
|
||||
/// <summary> Identifier for the location. </summary>
|
||||
public int locationID = -1;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -58,7 +59,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// <remarks> Stubbfel, 15.10.2013. </remarks>
|
||||
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
|
||||
|
||||
/// <summary> Gets or sets the identifier of the location. </summary>
|
||||
/// <value> The identifier of the location. </value>
|
||||
public int LocationID
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.locationID;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.locationID = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Method
|
||||
|
||||
#region protected
|
||||
|
||||
@@ -375,6 +375,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Angestellte ähnelt.
|
||||
/// </summary>
|
||||
public static string Employees {
|
||||
get {
|
||||
return ResourceManager.GetString("Employees", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Events ähnelt.
|
||||
/// </summary>
|
||||
@@ -420,6 +429,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Gäste ähnelt.
|
||||
/// </summary>
|
||||
public static string Guests {
|
||||
get {
|
||||
return ResourceManager.GetString("Guests", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
|
||||
/// </summary>
|
||||
@@ -1266,6 +1284,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Studenten ähnelt.
|
||||
/// </summary>
|
||||
public static string Students {
|
||||
get {
|
||||
return ResourceManager.GetString("Students", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die vorlesen ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -596,4 +596,13 @@
|
||||
<data name="Time_Day_Wednesday_Short" xml:space="preserve">
|
||||
<value>Mi</value>
|
||||
</data>
|
||||
<data name="Employees" xml:space="preserve">
|
||||
<value>Angestellte</value>
|
||||
</data>
|
||||
<data name="Guests" xml:space="preserve">
|
||||
<value>Gäste</value>
|
||||
</data>
|
||||
<data name="Students" xml:space="preserve">
|
||||
<value>Studenten</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,18 @@
|
||||
<UserControl x:Class="CampusAppWP8.Utility.Lui.MultiValueTextBlock"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
>
|
||||
|
||||
<!--
|
||||
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
|
||||
|
||||
</Grid>
|
||||
-->
|
||||
<TextBlock x:Name="TheText"/>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,94 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MultiValueTextBlock.xaml.cs" company="BTU/IIT">
|
||||
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
|
||||
// </copyright>
|
||||
// <author>Fiedler</author>
|
||||
// <date>14.11.2013</date>
|
||||
// <summary>Implements the multi value text block.xaml class</summary>
|
||||
//-----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility.Lui
|
||||
{
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
/// <summary> A multi value text block. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <seealso cref="T:System.Windows.Controls.UserControl"/>
|
||||
public partial class MultiValueTextBlock : UserControl
|
||||
{
|
||||
/// <summary> The value 1 property. </summary>
|
||||
public static readonly DependencyProperty Value_1_Property = DependencyProperty.Register("Value1", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
|
||||
/// <summary> The value 2 property. </summary>
|
||||
public static readonly DependencyProperty Value_2_Property = DependencyProperty.Register("Value2", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
|
||||
|
||||
/// <summary> The converter property. </summary>
|
||||
public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(IValueConverter), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
|
||||
|
||||
/// <summary> Initializes a new instance of the MultiValueTextBlock class. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
public MultiValueTextBlock() : base()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the converter. </summary>
|
||||
/// <value> The converter. </value>
|
||||
public IValueConverter Converter
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IValueConverter)this.GetValue(ConverterProperty);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(ConverterProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the value 1. </summary>
|
||||
/// <value> The value 1. </value>
|
||||
public object Value1
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue(Value_1_Property);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(Value_1_Property, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets the value 2. </summary>
|
||||
/// <value> The value 2. </value>
|
||||
public object Value2
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue(Value_2_Property);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(Value_2_Property, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Raises the dependency property changed event. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <param name="d"> The DependencyObject to process. </param>
|
||||
/// <param name="e"> Event information to send to registered event handlers. </param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,29 @@
|
||||
namespace CampusAppWP8.Utility
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MealIdToPriceConverter.cs" company="BTU/IIT">
|
||||
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
|
||||
// </copyright>
|
||||
// <author>Fiedler</author>
|
||||
// <date>14.11.2013</date>
|
||||
// <summary>Implements the meal identifier to price converter class</summary>
|
||||
//-----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
using CampusAppWP8.Feed.Mensa;
|
||||
using CampusAppWPortalLib8.Model.GeoDb;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWPortalLib8.Model.Mensa;
|
||||
|
||||
/// <summary> A meal identifier to price converter. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <seealso cref="T:System.Windows.Data.IValueConverter"/>
|
||||
public sealed class MealIdToPriceConverter : IValueConverter
|
||||
{
|
||||
/// <summary> The price feed. </summary>
|
||||
private PriceFeed priceFeed = null;
|
||||
|
||||
/// <summary> Initializes a new instance of the MealIdToPriceConverter class. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
public MealIdToPriceConverter()
|
||||
{
|
||||
this.priceFeed = new PriceFeed();
|
||||
@@ -17,28 +32,63 @@
|
||||
this.priceFeed.LoadData();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
|
||||
/// </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <seealso cref="M:System.Windows.Data.IValueConverter.Convert(object,Type,object,System.Globalization.CultureInfo)"/>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in
|
||||
/// <see cref="F:System.Windows.Data.BindingMode.TwoWay" />-Bindungen aufgerufen.
|
||||
/// </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <seealso cref="M:System.Windows.Data.IValueConverter.ConvertBack(object,Type,object,System.Globalization.CultureInfo)"/>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary> Price feed is ready. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
private void PriceFeedIsReady()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary> Price feed is failed. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
private void PriceFeedIsFailed()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets the price string. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <summary> Currency string. </summary>
|
||||
/// <remarks> Fiedler, 14.11.2013. </remarks>
|
||||
/// <param name="val"> The value. </param>
|
||||
/// <returns> A string. </returns>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace CampusAppWPortalLib8.Model.Mensa
|
||||
|
||||
/// <summary> A data Model for the price. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
[XmlRoot("Canteens")]
|
||||
[XmlRoot("root")]
|
||||
public class PriceModel
|
||||
{
|
||||
/// <summary> The canteens. </summary>
|
||||
@@ -28,7 +28,8 @@ namespace CampusAppWPortalLib8.Model.Mensa
|
||||
|
||||
/// <summary> Gets or sets the canteens. </summary>
|
||||
/// <value> The canteens. </value>
|
||||
[XmlElement("Canteen")]
|
||||
[XmlArray("Canteens")]
|
||||
[XmlArrayItem("Canteen")]
|
||||
public ObservableCollection<PriceCanteenModel> Canteens
|
||||
{
|
||||
get
|
||||
|
||||
Reference in New Issue
Block a user