instert new mensapp
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
@@ -9,6 +9,7 @@ namespace CampusAppWP8.Model.Mensa
|
||||
{
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Model for a meal
|
||||
@@ -20,7 +21,7 @@ namespace CampusAppWP8.Model.Mensa
|
||||
/// <summary>
|
||||
/// Constant for the vegetarian icon
|
||||
/// </summary>
|
||||
private const string MealIconNameVegetarian = "CAROTTE";
|
||||
private const string MealIconNameVegetarian = "CARROTTE";
|
||||
|
||||
/// <summary>
|
||||
/// Constant for the free icon
|
||||
@@ -110,7 +111,7 @@ namespace CampusAppWP8.Model.Mensa
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.mealId && value > -1 && value < 8)
|
||||
if (value > -1 && value < 8)
|
||||
{
|
||||
this.mealId = value;
|
||||
this.CreateMealName();
|
||||
@@ -176,7 +177,7 @@ namespace CampusAppWP8.Model.Mensa
|
||||
{
|
||||
if (value != this.mealDesc)
|
||||
{
|
||||
this.mealDesc = value;
|
||||
this.mealDesc = StringManager.StripHTML(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace CampusAppWP8.Model.Mensa
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
|
||||
/// <summary>
|
||||
/// Model for menu
|
||||
@@ -57,7 +59,7 @@ namespace CampusAppWP8.Model.Mensa
|
||||
/// <summary>
|
||||
/// DateTime of the day
|
||||
/// </summary>
|
||||
private DateTime date;
|
||||
private string date;
|
||||
|
||||
/// <summary>
|
||||
/// DateTime of the monday
|
||||
@@ -80,10 +82,16 @@ namespace CampusAppWP8.Model.Mensa
|
||||
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the menus for the week
|
||||
/// </summary>
|
||||
[XmlElement("Meal")]
|
||||
public ObservableCollection<MealModel> Meals { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WeekDay
|
||||
/// </summary>
|
||||
[XmlElement("Wochentag")]
|
||||
[XmlAttribute("day")]
|
||||
public string Day
|
||||
{
|
||||
get
|
||||
@@ -93,19 +101,22 @@ namespace CampusAppWP8.Model.Mensa
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(value, ref this.dayName);
|
||||
this.CalcDateOfDay();
|
||||
if (value != this.dayName)
|
||||
{
|
||||
this.dayName = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets of Date
|
||||
/// </summary>
|
||||
public DateTime Date
|
||||
[XmlAttribute("date")]
|
||||
public string Date
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.date;
|
||||
return this.date.ToString();
|
||||
}
|
||||
|
||||
set
|
||||
@@ -117,153 +128,6 @@ namespace CampusAppWP8.Model.Mensa
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner 1
|
||||
/// </summary>
|
||||
[XmlElement("Essen1")]
|
||||
public string Dinner1
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.dinner1;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(value, ref this.dinner1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner 2
|
||||
/// </summary>
|
||||
[XmlElement("Essen2")]
|
||||
public string Dinner2
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.dinner2;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(value, ref this.dinner2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner 3
|
||||
/// </summary>
|
||||
[XmlElement("Essen3")]
|
||||
public string Dinner3
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.dinner3;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(value, ref this.dinner3);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner 4
|
||||
/// </summary>
|
||||
[XmlElement("Essen4")]
|
||||
public string Dinner4
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.dinner4;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(value, ref this.dinner4);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner bio
|
||||
/// </summary>
|
||||
[XmlElement("Bio")]
|
||||
public string Bio
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bio;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(value, ref this.bio);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dinner action
|
||||
/// </summary>
|
||||
[XmlElement("Aktionstag")]
|
||||
public string Action
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.action;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.SetValue(value, ref this.action);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
/// <summary>
|
||||
/// Methods sets the property
|
||||
/// </summary>
|
||||
/// <remarks> maybe move to base class</remarks>
|
||||
/// <param name="value">new property value</param>
|
||||
/// <param name="property">name of the property</param>
|
||||
private void SetValue(string value, ref string property)
|
||||
{
|
||||
if (value != null && !string.Empty.Equals(value) && !value.Equals(property))
|
||||
{
|
||||
property = StringManager.StripHTML(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method calculate the DateTime of the MenuDay
|
||||
/// </summary>
|
||||
private void CalcDateOfDay()
|
||||
{
|
||||
switch (this.dayName)
|
||||
{
|
||||
case "Montag":
|
||||
this.date = this.monday;
|
||||
break;
|
||||
case "Diensttag":
|
||||
this.date = this.monday.AddDays(1);
|
||||
break;
|
||||
case "Mittwoch":
|
||||
this.date = this.monday.AddDays(2);
|
||||
break;
|
||||
case "Donnerstag":
|
||||
this.date = this.monday.AddDays(3);
|
||||
break;
|
||||
case "Freitag":
|
||||
this.date = this.monday.AddDays(4);
|
||||
break;
|
||||
default:
|
||||
this.date = this.monday;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace CampusAppWP8.Model.Mensa
|
||||
/// <summary>
|
||||
/// Gets or sets the menus for the week
|
||||
/// </summary>
|
||||
[XmlArray("BTU")]
|
||||
[XmlArrayItem("Tagesmenu")]
|
||||
[XmlArray("Mealplan")]
|
||||
[XmlArrayItem("Menu")]
|
||||
public ObservableCollection<MenuModel> Menus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -19,127 +19,47 @@
|
||||
<!--Pivotsteuerelement-->
|
||||
<phone:Pivot Name="MensaPivot" Title="{Binding Path=LocalizedResources.MensaApp_Title, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Day}" />
|
||||
<TextBlock Text="{Binding Day}" />
|
||||
<TextBlock Text="{Binding Date}" FontSize="34" Margin="6,0,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Margin="12,0,12,0">
|
||||
<TextBlock Text="{Binding Date, StringFormat='{}{0:dd.MM.yyyy}'}"/>
|
||||
<ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer>
|
||||
<ItemsControl x:Name="MenuPanel" ItemsSource="{Binding Meals}" ScrollViewer.VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="0" Margin="0,0,0,12" Width="100">
|
||||
<TextBlock Text="{Binding MealName}" FontWeight="Bold"/>
|
||||
<TextBlock Text=" : "/>
|
||||
</StackPanel>
|
||||
<Image Source="{Binding IconUrl}" Width="100" Margin="-25,-25,-25,-21"></Image>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding MealDesc}" TextWrapping="Wrap" Grid.Column="1"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<!-- Dinner 1 -->
|
||||
<Border Grid.Row="0" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,0,0,0" Padding="0,12,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}" />
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Dinner1, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
|
||||
<TextBlock Text=" : "/>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Dinner1}" TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Dinner 2 -->
|
||||
<Border Grid.Row="1" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Dinner2, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
|
||||
<TextBlock Text=" : "/>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Dinner2}" TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Dinner 3 -->
|
||||
<Border Grid.Row="2" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Dinner3, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
|
||||
<TextBlock Text=" : "/>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Dinner3}" TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Dinner 4 -->
|
||||
<Border Grid.Row="3" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Dinner4, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
|
||||
<TextBlock Text=" : "/>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Dinner4}" TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Bio-->
|
||||
<Border Grid.Row="4" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Bio, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
|
||||
<TextBlock Text=" : "/>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Bio}" TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="5" Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=LocalizedResources.MensaApp_DinnerLabelW, Source={StaticResource LocalizedStrings}}"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.MensaApp_Action, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" />
|
||||
<TextBlock Text=" : "/>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Action}" TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
<!-- <Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" /> -->
|
||||
</Grid>
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" >
|
||||
<lui:UpdateButtonAppBar Click="MensaForceUpdate_Click"/>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// </summary>
|
||||
private int selectedIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Flag indicate that the feed was refreshed
|
||||
/// </summary>
|
||||
private bool refreshed = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
@@ -75,7 +80,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
this.feed.SaveData();
|
||||
this.feed.SaveData(this.refreshed);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -151,6 +156,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
{
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
this.feed.ForceWebUpdate();
|
||||
this.refreshed = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -628,7 +628,7 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/ ähnelt.
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/Studentenwerk/index.php?mensa=CottbusBTU&v=1 ähnelt.
|
||||
/// </summary>
|
||||
public static string UrlMensa_Week {
|
||||
get {
|
||||
|
||||
@@ -256,7 +256,7 @@
|
||||
<value>EventsFeed.xml</value>
|
||||
</data>
|
||||
<data name="UrlMensa_Week" xml:space="preserve">
|
||||
<value>http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/</value>
|
||||
<value>http://www.tu-cottbus.de/campusapp-data/Studentenwerk/index.php?mensa=CottbusBTU&v=1</value>
|
||||
</data>
|
||||
<data name="FileOpeningHours_OpeningHours" xml:space="preserve">
|
||||
<value>OpeninghoursFeed.xml</value>
|
||||
|
||||
Reference in New Issue
Block a user