Merge branch 'develop' into feature/#173

This commit is contained in:
Christian Fiedler
2013-11-18 15:50:36 +01:00
38 changed files with 2025 additions and 494 deletions

View File

@@ -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();
}
}
/// <summary> Position thread. </summary>
/// <remarks> Stubbfel, 18.11.2013. </remarks>
private void PositionThread()
{
Utilities.DetermineAndStoreCurrentPositionForce();
}
/// <summary>
/// Load the usersettings from the store
/// </summary>

View File

@@ -103,6 +103,7 @@
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Feed\TimeTable\AppointmentFeed.cs" />
<Compile Include="Feed\Mensa\PriceFeed.cs" />
<Compile Include="File\Departments\DepartmentFavoriteFile.cs" />
<Compile Include="Const.cs" />
<Compile Include="Feed\Exams\ExamFeed.cs" />
@@ -240,6 +241,7 @@
<Compile Include="Utility\BackgroundTasks.cs" />
<Compile Include="Utility\BoolToVisibilityConverter.cs" />
<Compile Include="Utility\FrameworkAnimator.cs" />
<Compile Include="Utility\IdToPlaceConverter.cs" />
<Compile Include="Utility\ListFiller.cs" />
<Compile Include="Utility\Lui\Button\AddButton.cs" />
<Compile Include="Utility\Lui\Button\AddPersonButton.cs" />
@@ -253,6 +255,8 @@
<Compile Include="Utility\Lui\ListBoxFixed.cs" />
<Compile Include="Utility\Lui\Templates\AppointmentCanvas.xaml.cs">
<DependentUpon>AppointmentCanvas.xaml</DependentUpon>
<Compile Include="Utility\Lui\MultiValueTextBlock.xaml.cs">
<DependentUpon>MultiValueTextBlock.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Lui\Templates\WeekView.xaml.cs">
<DependentUpon>WeekView.xaml</DependentUpon>
@@ -261,6 +265,7 @@
<DependentUpon>WeekViewDay.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Lui\Tiles\TileCreator.cs" />
<Compile Include="Utility\MealIdToPriceConverter.cs" />
<Compile Include="Utility\NDEF\BTUTagMessage.cs" />
<Compile Include="Pages\Dev\NFC.xaml.cs">
<DependentUpon>NFC.xaml</DependentUpon>
@@ -288,8 +293,6 @@
<Compile Include="Model\Lecture\LectureWp8List.cs" />
<Compile Include="Model\Lecture\LecturePageModel.cs" />
<Compile Include="Model\MainModel.cs" />
<Compile Include="Model\Openinghours\OpeninghoursInstitutionWp8Model.cs" />
<Compile Include="Model\Openinghours\OpeninghoursWp8Model.cs" />
<Compile Include="Model\XmlModel.cs" />
<Compile Include="Pages\Campusmap\CampusMapPage.xaml.cs">
<DependentUpon>CampusMapPage.xaml</DependentUpon>
@@ -539,6 +542,7 @@
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Utility\Lui\Templates\AppointmentCanvas.xaml">
<Page Include="Utility\Lui\MultiValueTextBlock.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>

View File

@@ -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;
/// <summary> This Class is for MensaFeeds. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <seealso cref="T:CampusAppWP8.Model.XmlModel{CampusAppWPortalLib8.Model.Mensa.MenuWeekModel}"/>
public abstract class MensaFeed : XmlModel<MenuWeekModel>
{
#region Member
/// <summary> The price feed. </summary>
private PriceFeed priceFeed = null;
#endregion
#region Constructor
/// <summary> Initializes a new instance of the <see cref="MensaFeed" /> class. </summary>
@@ -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
/// <value> The title. </value>
public string Title { get; protected set; }
/// <summary> Gets the title. </summary>
/// <value> The title. </value>
public Campus Campus { get; protected set; }
#endregion
#region Method
@@ -119,6 +135,79 @@ namespace CampusAppWP8.Feed.Mensa
return true;
}
/// <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;
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;
}
/// <summary> Price feed is ready. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
private void PriceFeedIsReady()
{
this.priceFeed.SaveData();
}
/// <summary> Sets the prices. </summary>
/// <remarks> Stubbfel, 18.11.2013. </remarks>
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 + " €";
}
}
}
/// <summary> Price feed is failed. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
private void PriceFeedIsFailed()
{
}
#endregion
#endregion

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,82 @@
//-----------------------------------------------------------------------
// <copyright file="PriceFeed.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the price feed class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Feed.Mensa
{
using System;
using System.IO;
using CampusAppWP8.Model;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Mensa;
using CampusAppWPortalLib8.Model;
/// <summary> A price feed. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <seealso cref="T:CampusAppWP8.Model.XmlModel{CampusAppWPortalLib8.Model.Mensa.PriceModel}"/>
public class PriceFeed : XmlModel<PriceModel>
{
/// <summary> Initializes a new instance of the PriceFeed class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
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);
}
/// <summary> Check is model up to date. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="model"> The model. </param>
/// <returns> true if it succeeds, false if it fails. </returns>
private bool CheckIsModelUpToDate(PriceModel model)
{
bool retValue = true;
if (model == null)
{
retValue = false;
}
return retValue;
}
/// <summary> Check is file up to date. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="model"> The model. </param>
/// <param name="fileInfo"> Information describing the file. </param>
/// <returns> true if it succeeds, false if it fails. </returns>
private bool CheckIsFileUpToDate(PriceModel model, FileInfo fileInfo)
{
if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1)
{
return false;
}
return this.CheckIsUpToDate(fileInfo.LastWriteTime);
}
/// <summary> Check is up to date. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="lastModified"> The last modified Date/Time. </param>
/// <returns> true if it succeeds, false if it fails. </returns>
private bool CheckIsUpToDate(DateTime lastModified)
{
bool retValue = false;
TimeSpan diff = DateTime.Now.Subtract(lastModified);
if (diff.TotalDays < 7)
{
retValue = true;
}
return retValue;
}
}
}

View File

@@ -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;
/// <summary> This Class is for MesaFeeds. </summary>
/// <remarks> fiedlchr, 14.10.2013. </remarks>
/// <seealso cref="T:CampusAppWP8.Model.XmlModel{CampusAppWP8.Model.Openinghours.OpeninghoursWp8Model}"/>
public class OpeninghoursFeed : XmlModel<OpeninghoursWp8Model>
public class OpeninghoursFeed : XmlModel<OpeninghoursModel>
{
#region Constructor
@@ -41,7 +41,7 @@ namespace CampusAppWP8.Feed.Openinghours
/// <remarks> fiedlchr, 14.10.2013. </remarks>
/// <param name="model"> reference of the FeedModel. </param>
/// <returns> true, if model is up-to-date, otherwise false. </returns>
private bool CheckIsModelUpToDate(OpeninghoursWp8Model model)
private bool CheckIsModelUpToDate(OpeninghoursModel model)
{
bool retValue = true;
@@ -62,7 +62,7 @@ namespace CampusAppWP8.Feed.Openinghours
/// <param name="model"> reference of the FeedModel. </param>
/// <param name="info"> info about the file. </param>
/// <returns> true, if file is up-to-date, otherwise false. </returns>
private bool CheckIsFileUpToDateOnLoad(OpeninghoursWp8Model model, FileInfo info)
private bool CheckIsFileUpToDateOnLoad(OpeninghoursModel model, FileInfo info)
{
bool retValue = true;
@@ -82,7 +82,7 @@ namespace CampusAppWP8.Feed.Openinghours
/// <param name="model"> reference of the FeedModel. </param>
/// <param name="info"> info about the file. </param>
/// <returns> true, if file is up-to-date, otherwise false. </returns>
private bool CheckIsFileUpToDateOnSave(OpeninghoursWp8Model model, FileInfo info)
private bool CheckIsFileUpToDateOnSave(OpeninghoursModel model, FileInfo info)
{
bool retValue = true;

View File

@@ -1,156 +0,0 @@
//-----------------------------------------------------------------------------
// <copyright file="OpeninghoursInstitutionWp8Model.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.Openinghours
{
using System.Globalization;
using System.Windows;
using System.Xml.Serialization;
/// <summary>
/// Model for menu
/// </summary>
public class OpeninghoursInstitutionWp8Model : CampusAppWPortalLib8.Model.Openinghours.OpeninghoursInstitutionModel
{
#region Property
/// <summary>
/// Gets the visibility state of the monday TextBlock.
/// </summary>
public Visibility VisibleMonday
{
get
{
return ((this.Monday == string.Empty) || (this.Monday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the tuesday TextBlock.
/// </summary>
public Visibility VisibleTuesday
{
get
{
return ((this.Tuesday == string.Empty) || (this.Tuesday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the wednesday TextBlock.
/// </summary>
public Visibility VisibleWednesday
{
get
{
return ((this.Wednesday == string.Empty) || (this.Wednesday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the thursday TextBlock.
/// </summary>
public Visibility VisibleThursday
{
get
{
return ((this.Thursday == string.Empty) || (this.Thursday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the friday TextBlock.
/// </summary>
public Visibility VisibleFriday
{
get
{
return ((this.Friday == string.Empty) || (this.Friday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the saturday TextBlock.
/// </summary>
public Visibility VisibleSaturday
{
get
{
return ((this.Saturday == string.Empty) || (this.Saturday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the sunday TextBlock.
/// </summary>
public Visibility VisibleSunday
{
get
{
return ((this.Sunday == string.Empty) || (this.Sunday.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the comment.
/// </summary>
public Visibility VisibleComment
{
get
{
return ((this.Comment == string.Empty) || (this.Comment.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the email address.
/// </summary>
public Visibility VisibleEMail
{
get
{
return ((this.EMail == string.Empty) || (this.EMail.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the phone number.
/// </summary>
public Visibility VisiblePhone
{
get
{
return ((this.Phone == string.Empty) || (this.Phone.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the room.
/// </summary>
public Visibility VisibleRoom
{
get
{
return ((this.Room == string.Empty) || (this.Room.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
/// <summary>
/// Gets the visibility state of the building.
/// </summary>
public Visibility VisibleBuilding
{
get
{
return ((this.Building == string.Empty) || (this.Building.Length == 0)) ? Visibility.Collapsed : Visibility.Visible;
}
}
#endregion
}
}

View File

@@ -1,20 +0,0 @@
//-----------------------------------------------------------------------------
// <copyright file="OpeninghoursWp8Model.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.Openinghours
{
using System.Xml.Serialization;
/// <summary>
/// Model for opening hours.
/// </summary>
[XmlRoot("root")]
public class OpeninghoursWp8Model : CampusAppWPortalLib8.Model.Openinghours.OpeninghoursModel<OpeninghoursInstitutionWp8Model>
{
}
}

View File

@@ -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);
}
}
/// <summary> Methods overrides the OnNavigatedFrom-Method. </summary>
@@ -183,7 +186,10 @@ namespace CampusAppWP8.Pages.Campusmap
/// <seealso cref="M:System.Windows.Controls.Page.OnNavigatedFrom(NavigationEventArgs)"/>
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
/// <param name="message"> the message of the device. </param>
private void NDEFHandler(ProximityDevice sender, ProximityMessage message)
{
if (device == null)
{
return;
}
// create ndefMessage
this.device.StopSubscribingForMessage(message.SubscriptionId);
var ndefMessage = message.Data;

View File

@@ -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">
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
@@ -26,34 +27,43 @@
<StackPanel Grid.Row="0">
<header:DefaultHeader Name="DefHeader" HeaderName="{Binding Path=LocalizedResources.CampusMapApp_RoomListTitle, Source={StaticResource LocalizedStrings}}"/>
</StackPanel>
<StackPanel Grid.Row="1" Margin="24,0,0,0">
<TextBlock Text="{Binding Path=LocalizedResources.LayerListPicker_Label, Source={StaticResource LocalizedStrings}}"/>
<!-- Listpicket of courses -->
<toolkit:ListPicker Name="Layer" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.ListPickerHeader_Layer, Source={StaticResource LocalizedStrings}}" SelectionChanged="Layer_SelectionChanged" >
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Text}"/>
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
</Border>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
</StackPanel>
<ViewportControl Name="VPC" Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Bounds="0,-200,720,1200" Margin="24,12,12,0" >
<Canvas Name="MapCanvas" Height="800" Width="480" VerticalAlignment="Top" HorizontalAlignment="Left" ManipulationDelta="MapCanvas_ManipulationDelta" ManipulationStarted="MapCanvas_ManipulationStarted" ManipulationCompleted="MapCanvas_ManipulationCompleted" Margin="-188,-200,-188,-200">
<Image Name="imgMap" Height="{Binding ImageHeigh}" Width="{Binding ImageWidth}" Source="{Binding ImageSource}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Canvas.RenderTransform>
<ScaleTransform/>
</Canvas.RenderTransform>
</Canvas>
</ViewportControl>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Path=LocalizedResources.LayerListPicker_Label, Source={StaticResource LocalizedStrings}}" Margin="24,0,24,0"/>
<TextBlock x:Name="LayerTag" Grid.Column="1" Text="" HorizontalAlignment="Center" />
</Grid>
<Canvas Grid.Row="2" x:Name="MainCanvas" Margin="12">
<ViewportControl Name="VPC" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Bounds="0,-200,720,1200" Width="{Binding ActualWidth, ElementName=MainCanvas, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=MainCanvas, Mode=OneWay}">
<Canvas Name="MapCanvas" Height="800" Width="480" VerticalAlignment="Top" HorizontalAlignment="Left" ManipulationDelta="MapCanvas_ManipulationDelta" ManipulationStarted="MapCanvas_ManipulationStarted" ManipulationCompleted="MapCanvas_ManipulationCompleted" Margin="-188,-200,-188,-200">
<Image Name="imgMap" Height="{Binding ImageHeigh}" Width="{Binding ImageWidth}" Source="{Binding ImageSource}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Canvas.RenderTransform>
<ScaleTransform/>
</Canvas.RenderTransform>
</Canvas>
</ViewportControl>
<Grid x:Name="BtnGrid" Width="{Binding ActualWidth, ElementName=MainCanvas, Mode=OneWay}" Height="60">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderThickness="2" BorderBrush="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Text="ZoomIn" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}" Tap="ZoomIn_Tap"/>
</Border>
<Border Grid.Column="1" BorderThickness="2" BorderBrush="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Text="ZoomOut" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}" Tap="ZoomOut_Tap"/>
</Border>
</Grid>
</Canvas>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized" />
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -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;
/// <summary> Class of the RoomListPage. </summary>
@@ -49,8 +51,7 @@ namespace CampusAppWP8.Pages.Campusmap
/// <summary> The offset point. </summary>
private MapPoint offsetPoint;
/// <summary> The layer list picker. </summary>
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
/// <remarks> Stubbfel, 14.10.2013. </remarks>
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;
}
}
/// <summary> Shows the layer places. </summary>
@@ -360,13 +380,13 @@ namespace CampusAppWP8.Pages.Campusmap
Canvas.SetZIndex(this.imgMap, 0);
}
/// <summary> Event handler. Called by Layer for selection changed events. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Selection changed event information. </param>
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);
}
}
/// <summary> Clears the map described by removeTags. </summary>
@@ -400,6 +420,28 @@ namespace CampusAppWP8.Pages.Campusmap
#endregion
/// <summary> Event handler. Called by ZoomIn for tap events. </summary>
/// <remarks> Fiedler, 15.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Gesture event information. </param>
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;
}
/// <summary> Event handler. Called by ZoomOut for tap events. </summary>
/// <remarks> Fiedler, 15.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Gesture event information. </param>
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
}
}

View File

@@ -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">
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
@@ -25,7 +29,7 @@
<StackPanel Grid.Row="0">
<header:DefaultHeader Name="DefHeader" HeaderName="{Binding Path=LocalizedResources.LocalizedResources.MensaApp_Title, Source={StaticResource LocalizedStrings}}"/>
</StackPanel>
<!--Pivotsteuerelement-->
<phone:Pivot Grid.Row="1" Name="MensaPivot">
<phone:Pivot.HeaderTemplate>
@@ -44,18 +48,26 @@
<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 HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal" Grid.Column="0" Margin="0,0,0,12" MinWidth="100">
<TextBlock Text="{Binding MealName}" FontWeight="Bold"/>
<TextBlock Text=" : "/>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel HorizontalAlignment="Left" Grid.Column="0">
<StackPanel Orientation="Horizontal" Margin="0,0,0,12" MinWidth="100">
<TextBlock Text="{Binding MealName}" FontWeight="Bold"/>
<TextBlock Text=" : "/>
</StackPanel>
<Image HorizontalAlignment="Left" Source="{Binding IconUrl}" Width="100" Margin="-12,-25,0,-21"></Image>
</StackPanel>
<Image HorizontalAlignment="Left" Source="{Binding IconUrl}" Width="100" Margin="-12,-25,0,-21"></Image>
</StackPanel>
<TextBlock Text="{Binding MealDesc}" TextWrapping="Wrap" Grid.Column="1"/>
<TextBlock Text="{Binding MealDesc}" TextWrapping="Wrap" Grid.Column="1"/>
</Grid>
<TextBlock Text="{Binding Price}" TextWrapping="Wrap" Grid.Row="1" FontSize="14" HorizontalAlignment="Left" Margin="0,10,0,0" TextAlignment="Left" />
</Grid>
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
@@ -79,6 +91,9 @@
<shell:ApplicationBarMenuItem Text="Campus1" Click="ApplicationBarMenuItem_Click"/>
<shell:ApplicationBarMenuItem Text="Campus2" Click="ApplicationBarMenuItem2_Click"/>
<shell:ApplicationBarMenuItem Text="Campus3" Click="ApplicationBarMenuItem3_Click"/>
<shell:ApplicationBarMenuItem Text="Tagesplan kopieren" Click="CopyDay"/>
<shell:ApplicationBarMenuItem Text="Wochenplan kopieren" Click="CopyWeek"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

View File

@@ -48,6 +48,9 @@ namespace CampusAppWP8.Pages.Mensa
/// <summary> Flag for forcing webLoad. </summary>
private bool forceLoad = false;
/// <summary> Identifier for the location. </summary>
public int locationID = -1;
#endregion
#region Constructor
@@ -56,10 +59,14 @@ namespace CampusAppWP8.Pages.Mensa
/// <remarks> Stubbfel, 15.10.2013. </remarks>
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
/// <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
@@ -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();*/
}
/// <summary> Method initialize the Feed depends of a campus. </summary>
@@ -214,6 +246,7 @@ namespace CampusAppWP8.Pages.Mensa
/// <remarks> Stubbfel, 15.10.2013. </remarks>
private void FeedIsReady()
{
this.feed.SetPrices();
this.SetupMensaPivot();
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
}
@@ -341,6 +374,7 @@ namespace CampusAppWP8.Pages.Mensa
/// <param name="e"> Event information. </param>
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
/// <param name="e"> Event information. </param>
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
/// <param name="e"> Event information. </param>
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);
}
/// <summary> Copies the menu of the selected day. </summary>
/// <remarks> Stubbfel, 18.11.2013. </remarks>
/// <param name="sender"> button object. </param>
/// <param name="e"> Event information. </param>
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);
}
/// <summary> Copies all meals from the week. </summary>
/// <remarks> Stubbfel, 18.11.2013. </remarks>
/// <param name="sender"> button object. </param>
/// <param name="e"> Event information. </param>
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

View File

@@ -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">
<page:PortraitLandscapePage.Resources>
<utility:BoolToVisibilityConverter x:Key="VisConverter"/>
<utility:IdToPlaceConverter x:Key="PlaceConverter"/>
</page:PortraitLandscapePage.Resources>
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
@@ -27,105 +33,116 @@
<header:DefaultHeader x:Name="DefHeader" Grid.Row="0" HeaderName="{Binding Path=LocalizedResources.OpenHoursApp_Title, Source={StaticResource LocalizedStrings}}"/>
<!-- Content -->
<ListBox x:Name="InstitutionPanel" Grid.Row="1" SelectionMode="Single" SelectionChanged="InstitutionPanel_SelectionChanged" Margin="24,0,12,0">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<phone:Pivot x:Name="ThePivot" Grid.Row="1">
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneContrastBackgroundBrush}" Style="{StaticResource ListButtonBorder}">
<StackPanel>
<lui:ToggleButton Content="{Binding Title}" ToggleContentTag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}" Style="{StaticResource ListButtonNoneBorder}"/>
<StackPanel Visibility="Collapsed" Tag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}">
<Grid>
<Grid.ColumnDefinitions>
<!--day-->
<ColumnDefinition Width="auto"/>
<!--time-->
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<!--monday-->
<RowDefinition Height="auto"/>
<!--tuesday-->
<RowDefinition Height="auto"/>
<!--wednesday-->
<RowDefinition Height="auto"/>
<!--thursday-->
<RowDefinition Height="auto"/>
<!--friday-->
<RowDefinition Height="auto"/>
<!--saturday-->
<RowDefinition Height="auto"/>
<!--sunday-->
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<!--row 0 monday-->
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Monday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleMonday}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Monday}" Visibility="{Binding VisibleMonday}" HorizontalAlignment="Left"/>
<!--row 1 tuesday-->
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Tuesday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleTuesday}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Tuesday}" Visibility="{Binding VisibleTuesday}" HorizontalAlignment="Left"/>
<!--row 2 wednesday-->
<TextBlock Grid.Row="2" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Wednesday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleWednesday}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Wednesday}" Visibility="{Binding VisibleWednesday}" HorizontalAlignment="Left"/>
<!--row 3 thursday-->
<TextBlock Grid.Row="3" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Thursday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleThursday}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Thursday}" Visibility="{Binding VisibleThursday}" HorizontalAlignment="Left"/>
<!--row 4 friday-->
<TextBlock Grid.Row="4" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Friday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleFriday}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Friday}" Visibility="{Binding VisibleFriday}" HorizontalAlignment="Left"/>
<!--row 5 saturday-->
<TextBlock Grid.Row="5" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Saturday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleSaturday}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding Saturday}" Visibility="{Binding VisibleSaturday}" HorizontalAlignment="Left"/>
<!--row 6 sunday-->
<TextBlock Grid.Row="6" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Sunday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleSunday}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding Sunday}" Visibility="{Binding VisibleSunday}" HorizontalAlignment="Left"/>
</Grid>
<Grid Margin="0,12,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<!--building-->
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=LocalizedResources.Building, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleBuilding}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Building}" Visibility="{Binding VisibleBuilding}" HorizontalAlignment="Left" Padding="10,3,10,0"/>
<!--room-->
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Path=LocalizedResources.Room, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleRoom}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Room}" Visibility="{Binding VisibleRoom}" HorizontalAlignment="Left" Padding="10,3,10,0"/>
</Grid>
<!--hint text-->
<TextBlock Text="{Binding Path=LocalizedResources.Hint, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleComment}" Padding="10,3,10,0" Margin="0,12,0,0" FontStyle="Italic"/>
<TextBlock Text="{Binding Comment}" Visibility="{Binding VisibleComment}" TextWrapping="Wrap" Padding="10,3,10,0"/>
<Grid Margin="6,6,6,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<!--mail button-->
<lui:EmailButton Grid.Column="0" EmailAddress="{Binding EMail}" Height="100" Visibility="{Binding VisibleEMail}" Padding="0" Margin="0"/>
<!--phone button-->
<lui:PhoneButton Grid.Column="1" Number="{Binding Phone}" DisplayName="{Binding Title}" Height="100" Visibility="{Binding VisiblePhone}" Padding="0" Margin="0"/>
<!--location button -->
<lui:GoToMapButton Grid.Column="2" SearchTerm="{Binding Building}" Height="100" Visibility="{Binding VisibleBuilding}" Padding="0" Margin="0" />
</Grid>
</StackPanel>
</StackPanel>
</Border>
<TextBlock Text="{Binding Path=LocationID, Mode=OneTime, Converter={StaticResource PlaceConverter}, ConverterParameter=Name}" Margin="0,-36,0,0"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</phone:Pivot.HeaderTemplate>
<phone:Pivot.ItemTemplate>
<DataTemplate>
<ListBox x:Name="InstitutionPanel" Grid.Row="1" SelectionMode="Single" SelectionChanged="InstitutionPanel_SelectionChanged" Margin="24,0,12,0" ItemsSource="{Binding Institutions}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneContrastBackgroundBrush}" Style="{StaticResource ListButtonBorder}">
<StackPanel>
<lui:ToggleButton Content="{Binding Title}" ToggleContentTag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}" Style="{StaticResource ListButtonNoneBorder}"/>
<StackPanel Visibility="Collapsed" Tag="{Binding Path=Constants.ToggleContent, Source={StaticResource Const}}">
<Grid>
<Grid.ColumnDefinitions>
<!--day-->
<ColumnDefinition Width="auto"/>
<!--time-->
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<!--monday-->
<RowDefinition Height="auto"/>
<!--tuesday-->
<RowDefinition Height="auto"/>
<!--wednesday-->
<RowDefinition Height="auto"/>
<!--thursday-->
<RowDefinition Height="auto"/>
<!--friday-->
<RowDefinition Height="auto"/>
<!--saturday-->
<RowDefinition Height="auto"/>
<!--sunday-->
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<!--row 0 monday-->
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Monday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleMonday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Monday}" Visibility="{Binding VisibleMonday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
<!--row 1 tuesday-->
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Tuesday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleTuesday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Tuesday}" Visibility="{Binding VisibleTuesday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
<!--row 2 wednesday-->
<TextBlock Grid.Row="2" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Wednesday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleWednesday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Wednesday}" Visibility="{Binding VisibleWednesday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
<!--row 3 thursday-->
<TextBlock Grid.Row="3" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Thursday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleThursday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Thursday}" Visibility="{Binding VisibleThursday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
<!--row 4 friday-->
<TextBlock Grid.Row="4" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Friday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleFriday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Friday}" Visibility="{Binding VisibleFriday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
<!--row 5 saturday-->
<TextBlock Grid.Row="5" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Saturday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleSaturday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding Saturday}" Visibility="{Binding VisibleSaturday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
<!--row 6 sunday-->
<TextBlock Grid.Row="6" Grid.Column="0" Text="{Binding Path=LocalizedResources.Time_Day_Sunday, Source={StaticResource LocalizedStrings}}" FontWeight="Bold" Visibility="{Binding VisibleSunday, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding Sunday}" Visibility="{Binding VisibleSunday, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left"/>
</Grid>
<Grid Margin="0,12,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<!--building-->
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=LocalizedResources.Building, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleBuilding, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Building}" Visibility="{Binding VisibleBuilding, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left" Padding="10,3,10,0"/>
<!--room-->
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Path=LocalizedResources.Room, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleRoom, Converter={StaticResource VisConverter}}" Padding="10,3,10,0"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Room}" Visibility="{Binding VisibleRoom, Converter={StaticResource VisConverter}}" HorizontalAlignment="Left" Padding="10,3,10,0"/>
</Grid>
<!--hint text-->
<TextBlock Text="{Binding Path=LocalizedResources.Hint, Source={StaticResource LocalizedStrings}}" Visibility="{Binding VisibleComment, Converter={StaticResource VisConverter}}" Padding="10,3,10,0" Margin="0,12,0,0" FontStyle="Italic"/>
<TextBlock Text="{Binding Comment}" Visibility="{Binding VisibleComment, Converter={StaticResource VisConverter}}" TextWrapping="Wrap" Padding="10,3,10,0"/>
<Grid Margin="6,6,6,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<!--mail button-->
<lui:EmailButton Grid.Column="0" EmailAddress="{Binding EMail}" Height="100" Visibility="{Binding VisibleEMail, Converter={StaticResource VisConverter}}" Padding="0" Margin="0"/>
<!--phone button-->
<lui:PhoneButton Grid.Column="1" Number="{Binding Phone}" DisplayName="{Binding Title}" Height="100" Visibility="{Binding VisiblePhone, Converter={StaticResource VisConverter}}" Padding="0" Margin="0"/>
<!--location button -->
<lui:GoToMapButton Grid.Column="2" SearchTerm="{Binding Building}" Height="100" Visibility="{Binding VisibleBuilding, Converter={StaticResource VisConverter}}" Padding="0" Margin="0" />
</Grid>
</StackPanel>
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DataTemplate>
</phone:Pivot.ItemTemplate>
</phone:Pivot>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >

View File

@@ -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;
/// <summary>
/// Opening hours page.
/// </summary>
/// <summary> Opening hours page. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <seealso cref="T:CampusAppWP8.Utility.Lui.Page.PortraitLandscapePage"/>
public partial class OpeninghoursPage : PortraitLandscapePage
{
#region Members
/// <summary>
/// Opening hours feed object.
/// </summary>
/// <summary> Opening hours feed object. </summary>
private OpeninghoursFeed feed = null;
/// <summary>
/// for checking if the instance is new or a tombstone.
/// </summary>
/// <summary> for checking if the instance is new or a tombstone. </summary>
private bool isNewInstance = false;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="OpeninghoursPage" /> class.
/// </summary>
/// <summary> Initializes a new instance of the <see cref="OpeninghoursPage" /> class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
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<Model.Openinghours.OpeninghoursWp8Model>());
this.feed.LoadData(Utilities.GetLoadModus<OpeninghoursModel>());
}
this.isNewInstance = true;
@@ -64,10 +60,9 @@ namespace CampusAppWP8.Pages.Openinghours
#region protected
/// <summary>
/// Override the OnNavigatedTo method.
/// </summary>
/// <param name="e">Arguments of navigation</param>
/// <summary> Override the OnNavigatedTo method. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <seealso cref="M:CampusAppWP8.Utility.Lui.Page.PortraitLandscapePage.OnNavigatedTo(NavigationEventArgs)"/>
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<OpeninghoursWp8Model>(Constants.IsolatedStorage_OpeninghoursModel)) != null)
if ((tempModel = App.LoadFromIsolatedStorage<OpeninghoursModel>(Constants.IsolatedStorage_OpeninghoursModel)) != null)
{
this.feed.Model = tempModel;
this.FeedIsReady();
@@ -89,20 +84,23 @@ namespace CampusAppWP8.Pages.Openinghours
}
}
/// <summary>
/// Override the OnNavigatedFrom method
/// </summary>
/// <param name="e">Arguments of navigation</param>
/// <summary> Override the OnNavigatedFrom method. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <seealso cref="M:System.Windows.Controls.Page.OnNavigatedFrom(NavigationEventArgs)"/>
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
this.feed.SaveData();
if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back)
{
App.SaveToIsolatedStorage<OpeninghoursWp8Model>(Constants.IsolatedStorage_OpeninghoursModel, this.feed.Model);
App.SaveToIsolatedStorage<OpeninghoursModel>(Constants.IsolatedStorage_OpeninghoursModel, this.feed.Model);
}
}
/// <summary> Raises the tap grid event. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="sender"> button object. </param>
/// <param name="e"> Event information to send to registered event handlers. </param>
private void OnTapGrid(object sender, EventArgs e)
{
@@ -113,55 +111,51 @@ namespace CampusAppWP8.Pages.Openinghours
#region private
/// <summary>
/// Will be execute if the feed is ready.
/// </summary>
/// <summary> Will be execute if the feed is ready. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
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();
}
/// <summary>
/// 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.
/// </summary>
/// <param name="sender">button object</param>
/// <param name="e">event args</param>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="sender"> button object. </param>
/// <param name="e"> event args. </param>
private void OpenHoursForceUpdate_Click(object sender, EventArgs e)
{
this.DefHeader.ProgressVisibility = Visibility.Visible;
this.feed.ForceWebUpdate();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
/// <summary> Method will be execute if the feed is failed. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
private void FeedIsFailedWeb()
{
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb);
this.feed.ForceReadFile();
}
/// <summary>
/// Method will be execute if the feed is failed
/// </summary>
/// <summary> Method will be execute if the feed is failed. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
private void FeedIsFailedFile()
{
this.DefHeader.ProgressVisibility = Visibility.Collapsed;
MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile);
}
/// <summary>
/// Method will be execute if the selection is change in the listbox.
/// </summary>
/// <param name="sender">listbox object.</param>
/// <param name="e">event args.</param>
/// <summary> Method will be execute if the selection is change in the listbox. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="sender"> listbox object. </param>
/// <param name="e"> event args. </param>
private void InstitutionPanel_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
this.InstitutionPanel.SelectedIndex = -1;
(sender as ListBox).SelectedIndex = -1;
}
// private

View File

@@ -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);
}
}
/// <summary> Methods overrides the OnNavigatedFrom-Method. </summary>
@@ -141,7 +144,10 @@ namespace CampusAppWP8.Pages
/// <seealso cref="M:System.Windows.Controls.Page.OnNavigatedFrom(NavigationEventArgs)"/>
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
}
}
/// <summary> Position thread. </summary>
/// <remarks> Stubbfel, 18.11.2013. </remarks>
private void PositionThread()
{
Utilities.DetermineAndStoreCurrentPosition();
}
/// <summary> Event handler. Called by PintoStart for click events. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
/// <param name="sender"> Caller of the function. </param>
@@ -392,6 +405,11 @@ namespace CampusAppWP8.Pages
/// <param name="message"> The message. </param>
private void NDEFHandler(ProximityDevice sender, ProximityMessage message)
{
if (device == null)
{
return;
}
// create ndefMessage
this.device.StopSubscribingForMessage(message.SubscriptionId);
var ndefMessage = message.Data;

View File

@@ -285,6 +285,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Kopieren ähnelt.
/// </summary>
public static string Copy {
get {
return ResourceManager.GetString("Copy", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Erstellen ähnelt.
/// </summary>
@@ -384,6 +393,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>
@@ -429,6 +447,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>
@@ -735,6 +762,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Tagesplan ähnelt.
/// </summary>
public static string MensaApp_Dayplan {
get {
return ResourceManager.GetString("MensaApp_Dayplan", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die 84 ähnelt.
/// </summary>
@@ -753,6 +789,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Wochenplan ähnelt.
/// </summary>
public static string MensaApp_Weekplan {
get {
return ResourceManager.GetString("MensaApp_Weekplan", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die BTU-Tag ähnelt.
/// </summary>
@@ -1275,6 +1320,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>

View File

@@ -598,5 +598,22 @@
</data>
<data name="Calendar_Week_Short" xml:space="preserve">
<value>KW</value>
<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>
<data name="Copy" xml:space="preserve">
<value>Kopieren</value>
</data>
<data name="MensaApp_Dayplan" xml:space="preserve">
<value>Tagesplan</value>
</data>
<data name="MensaApp_Weekplan" xml:space="preserve">
<value>Wochenplan</value>
</data>
</root>

View File

@@ -247,7 +247,7 @@
<value>OpeninghoursFeed.xml</value>
</data>
<data name="UrlOpeningHours_OpeningHours" xml:space="preserve">
<value>http://www.tu-cottbus.de/campusapp-data/getdata.php?db=openinghours&amp;app=2&amp;appversion=1</value>
<value>http://www.tu-cottbus.de/campusapp-data/openinghours.php?v=2</value>
</data>
<data name="FileNews_Name" xml:space="preserve">
<value>NewsFeed.xml</value>
@@ -602,5 +602,10 @@
</data>
<data name="PisInformationName_Room" xml:space="preserve">
<value>Raumnummer</value>
<data name="FileMensaPrice" xml:space="preserve">
<value>mensaprice.xml</value>
</data>
<data name="UrlMensaPrice" xml:space="preserve">
<value>http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1</value>
</data>
</root>

View File

@@ -384,6 +384,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die mensaprice.xml ähnelt.
/// </summary>
public static string FileMensaPrice {
get {
return ResourceManager.GetString("FileMensaPrice", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die NewsFeed.xml ähnelt.
/// </summary>
@@ -1384,7 +1393,16 @@ namespace CampusAppWP8.Resources {
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=openinghours&amp;app=2&amp;appversion=1 ähnelt.
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1 ähnelt.
/// </summary>
public static string UrlMensaPrice {
get {
return ResourceManager.GetString("UrlMensaPrice", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/openinghours.php?v=2 ähnelt.
/// </summary>
public static string UrlOpeningHours_OpeningHours {
get {

View File

@@ -0,0 +1,113 @@
//-----------------------------------------------------------------------
// <copyright file="IdToPlaceConverter.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the identifier to place converter class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
using System;
using System.Windows.Data;
using CampusAppWP8.File.Places;
using CampusAppWPortalLib8.Model.GeoDb;
/// <summary> An identifier to place converter. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <seealso cref="T:System.Windows.Data.IValueConverter"/>
public sealed class IdToPlaceConverter : IValueConverter
{
/// <summary> The place file. </summary>
private PlacesFile placeFile = null;
/// <summary> Initializes a new instance of the IdToPlaceConverter class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public IdToPlaceConverter()
{
this.placeFile = new PlacesFile();
this.placeFile.OnLoaded += this.PlaceFileIsReady;
this.placeFile.OnFailedLoad += this.PlaceFileIsFailed;
this.placeFile.LoadData();
}
/// <summary>
/// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
/// </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <returns>info string of the place.</returns>
/// <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;
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;
}
/// <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, 13.11.2013. </remarks>
/// <returns>null</returns>
/// <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)
{
object retValue = null;
/*
if(targetType.Equals(typeof(int)))
{
retValue = new int();
retValue =
}
*/
return retValue;
}
/// <summary> Gets an information. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="placeID"> Identifier for the place. </param>
/// <param name="searchInfo"> Information describing the search. </param>
/// <returns> The information. </returns>
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;
}
/// <summary> Place file is failed. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
private void PlaceFileIsFailed()
{
}
/// <summary> Place file is ready. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
private void PlaceFileIsReady()
{
}
}
}

View File

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

View File

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

View File

@@ -0,0 +1,100 @@
//-----------------------------------------------------------------------
// <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 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();
this.priceFeed.OnLoaded += this.PriceFeedIsReady;
this.priceFeed.OnFailedLoad += this.PriceFeedIsFailed;
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;
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;
}
/// <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()
{
this.priceFeed.SaveData();
}
/// <summary> Price feed is failed. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
private void PriceFeedIsFailed()
{
}
}
}

View File

@@ -228,14 +228,14 @@ namespace CampusAppWP8.Utility
/// <summary> Method determine the current position of the phone. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <returns> the position of the phone. </returns>
public static GeoPosition<GeoCoordinate> DetermineCurrentPosition()
public static GeoPosition<GeoCoordinate> 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<GeoCoordinate> geoposition = null;
if (success)
@@ -263,9 +263,9 @@ namespace CampusAppWP8.Utility
/// <summary> Method determine and store the current position of the phone. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
public static void DetermineAndStoreCurrentPositionForce()
public static void DetermineAndStoreCurrentPositionForce(GeoPositionAccuracy accuracy = GeoPositionAccuracy.High)
{
GeoPosition<GeoCoordinate> geoposition = Utilities.DetermineCurrentPosition();
GeoPosition<GeoCoordinate> 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.
/// </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
public static void DetermineAndStoreCurrentPosition()
public static void DetermineAndStoreCurrentPosition(GeoPositionAccuracy accuracy = GeoPositionAccuracy.High)
{
GeoMapPoint currentPoint = App.LoadFromAppState<GeoMapPoint>(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
/// <summary> Gets the determined campus. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <returns> The Campus. </returns>
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<GeoMapPoint>("CurrentGeoPoint");
if (currentPoint == null)
{
return result;
if (accuracy.Equals(GeoPositionAccuracy.High))
{
return result;
}
else
{
return Utilities.DetermineCampus(GeoPositionAccuracy.High);
}
}
MapPoint tmpCampus = CampusMapPoints.NorthCB;

View File

@@ -62,8 +62,13 @@
<Compile Include="Model\Mensa\MealModel.cs" />
<Compile Include="Model\Mensa\MenuModel.cs" />
<Compile Include="Model\Mensa\MenuWeekModel.cs" />
<Compile Include="Model\Mensa\PriceCanteenModel.cs" />
<Compile Include="Model\Mensa\PriceMealModel.cs" />
<Compile Include="Model\Mensa\PriceModel.cs" />
<Compile Include="Model\ModelTypes.cs" />
<Compile Include="Model\Openinghours\OpenhoursDayModel.cs" />
<Compile Include="Model\Openinghours\OpeninghoursInstitutionModel.cs" />
<Compile Include="Model\Openinghours\OpeninghoursLocationModel.cs" />
<Compile Include="Model\Openinghours\OpeninghoursModel.cs" />
<Compile Include="Model\Person\PersonFunctionModel.cs" />
<Compile Include="Model\Person\PersonListModel.cs" />

View File

@@ -112,6 +112,10 @@ namespace CampusAppWPortalLib8.Model.Mensa
/// <value> The icon URL. </value>
public string IconUrl { get; set; }
/// <summary> Gets or sets the price. </summary>
/// <value> The price. </value>
public string Price { get; set; }
/// <summary> Gets or sets the icon name. </summary>
/// <value> The name of the icon. </value>
[XmlAttribute("icon")]

View File

@@ -0,0 +1,185 @@
//-----------------------------------------------------------------------
// <copyright file="PriceCanteenModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the price canteen model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Mensa
{
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> A data Model for the price canteen. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public class PriceCanteenModel
{
/// <summary> The identifier. </summary>
private int id = -1;
/// <summary> The name de. </summary>
private string name_de = string.Empty;
/// <summary> URL of the name. </summary>
private string name_url = string.Empty;
/// <summary> The position. </summary>
private MapPoint pos = null;
/// <summary> List of prices. </summary>
private ObservableCollection<PriceMealModel> priceList = null;
/// <summary> Initializes a new instance of the PriceCanteenModel class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public PriceCanteenModel()
{
this.pos = new MapPoint(-1, -1);
this.priceList = new ObservableCollection<PriceMealModel>();
}
/// <summary> Gets or sets the identifier. </summary>
/// <value> The identifier. </value>
[XmlAttribute("id")]
public string IdStr
{
get
{
return string.Empty + this.id;
}
set
{
this.id = int.Parse(value);
}
}
/// <summary> Gets or sets the identifier. </summary>
/// <value> The identifier. </value>
[XmlIgnore]
public int Id
{
get
{
return this.id;
}
set
{
this.id = value;
}
}
/// <summary> Gets or sets the name. </summary>
/// <value> The name. </value>
[XmlAttribute("name_de")]
public string Name
{
get
{
return this.name_de;
}
set
{
this.name_de = value;
}
}
/// <summary> Gets or sets URL of the document. </summary>
/// <value> The URL. </value>
[XmlAttribute("name_url")]
public string Url
{
get
{
return this.name_url;
}
set
{
this.name_url = value;
}
}
/// <summary> Gets or sets the x coordinate. </summary>
/// <value> The x coordinate. </value>
[XmlAttribute("x")]
public string X
{
get
{
return string.Empty + this.pos.X;
}
set
{
this.pos.X = double.Parse(value);
}
}
/// <summary> Gets or sets the y coordinate. </summary>
/// <value> The y coordinate. </value>
[XmlAttribute("y")]
public string Y
{
get
{
return string.Empty + this.pos.Y;
}
set
{
this.pos.Y = double.Parse(value);
}
}
/// <summary> Gets or sets the position. </summary>
/// <value> The position. </value>
[XmlIgnore]
public MapPoint Position
{
get
{
return this.pos;
}
set
{
this.pos = value;
}
}
/// <summary> Gets or sets the prices. </summary>
/// <value> The prices. </value>
[XmlElement("price")]
public ObservableCollection<PriceMealModel> Prices
{
get
{
return this.priceList;
}
set
{
this.priceList = value;
}
}
/// <summary> Gets price meal model. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="meal_id"> Identifier for the meal. </param>
/// <returns> The price meal model. </returns>
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;
}
}
}

View File

@@ -0,0 +1,169 @@
//-----------------------------------------------------------------------
// <copyright file="PriceMealModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the price meal model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Mensa
{
using System.Xml.Serialization;
/// <summary> A data Model for the price meal. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public class PriceMealModel
{
/// <summary> Identifier for the meal. </summary>
private int meal_id = -1;
/// <summary> The price student. </summary>
private double priceStudent = 0;
/// <summary> The price employee. </summary>
private double priceEmployee = 0;
/// <summary> The price guest. </summary>
private double priceGuest = 0;
/// <summary> Initializes a new instance of the PriceMealModel class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public PriceMealModel()
{
}
/// <summary> Gets or sets the identifier of the meal. </summary>
/// <value> The identifier of the meal. </value>
[XmlAttribute("meal_id")]
public string MealIDStr
{
get
{
return string.Empty + this.meal_id;
}
set
{
this.meal_id = int.Parse(value);
}
}
/// <summary> Gets or sets the identifier of the meal. </summary>
/// <value> The identifier of the meal. </value>
[XmlIgnore]
public int MealID
{
get
{
return this.meal_id;
}
set
{
this.meal_id = value;
}
}
/// <summary> Gets or sets the price student. </summary>
/// <value> The price student. </value>
[XmlAttribute("s")]
public string PriceStudentStr
{
get
{
return this.CurrencyString(this.priceStudent);
}
set
{
this.priceStudent = double.Parse(value);
}
}
/// <summary> Gets or sets the price student. </summary>
/// <value> The price student. </value>
[XmlIgnore]
public double PriceStudent
{
get
{
return this.priceStudent;
}
set
{
this.priceStudent = value;
}
}
/// <summary> Gets or sets the price employee. </summary>
/// <value> The price employee. </value>
[XmlAttribute("e")]
public string PriceEmployeeStr
{
get
{
return this.CurrencyString(this.priceEmployee);
}
set
{
this.priceEmployee = double.Parse(value);
}
}
/// <summary> Gets or sets the price employee. </summary>
/// <value> The price employee. </value>
[XmlIgnore]
public double PriceEmployee
{
get
{
return this.priceEmployee;
}
set
{
this.priceEmployee = value;
}
}
/// <summary> Gets or sets the price guest. </summary>
/// <value> The price guest. </value>
[XmlAttribute("g")]
public string PriceGuestStr
{
get
{
return this.CurrencyString(this.priceGuest);
}
set
{
this.priceGuest = double.Parse(value);
}
}
/// <summary> Gets or sets the price guest. </summary>
/// <value> The price guest. </value>
[XmlIgnore]
public double PriceGuest
{
get
{
return this.priceGuest;
}
set
{
this.priceGuest = value;
}
}
/// <summary> Currency string. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
/// <param name="val"> The value. </param>
/// <returns> A string. </returns>
private string CurrencyString(double val)
{
return string.Format("{0:0.00}", val);
}
}
}

View File

@@ -0,0 +1,76 @@
//-----------------------------------------------------------------------
// <copyright file="PriceModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the price model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Mensa
{
using CampusAppWPortalLib8.Model.Settings;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
/// <summary> A data Model for the price. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
[XmlRoot("root")]
public class PriceModel
{
/// <summary> The canteens. </summary>
private ObservableCollection<PriceCanteenModel> canteens = null;
/// <summary> Initializes a new instance of the PriceModel class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public PriceModel()
{
this.canteens = new ObservableCollection<PriceCanteenModel>();
}
/// <summary> Gets or sets the canteens. </summary>
/// <value> The canteens. </value>
[XmlArray("Canteens")]
[XmlArrayItem("Canteen")]
public ObservableCollection<PriceCanteenModel> Canteens
{
get
{
return this.canteens;
}
set
{
this.canteens = value;
}
}
/// <summary> Gets a canteen. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="id"> The identifier. </param>
/// <returns> The canteen. </returns>
public PriceCanteenModel GetCanteen(int id)
{
PriceCanteenModel retValue = null;
foreach (PriceCanteenModel prize in this.canteens)
{
if (prize.Id == id)
{
retValue = prize;
break;
}
}
return retValue;
}
/// <summary> Gets a canteen. </summary>
/// <remarks> Stubbfel, 18.11.2013. </remarks>
/// <param name="campus"> The campus. </param>
/// <returns> The canteen. </returns>
public PriceCanteenModel GetCanteen(Campus campus)
{
return this.GetCanteen((int)campus - 1);
}
}
}

View File

@@ -0,0 +1,217 @@
//-----------------------------------------------------------------------
// <copyright file="OpenhoursDayModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>12.11.2013</date>
// <summary>Implements the openhours day model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Openinghours
{
using System;
using System.Xml.Serialization;
/// <summary> A data Model for the openinghours day. </summary>
/// <remarks> Fiedler, 12.11.2013. </remarks>
[XmlRoot("Open")]
public class OpeninghoursDayModel
{
/// <summary> The start. </summary>
private TimeSpan start;
/// <summary> The end. </summary>
private TimeSpan end;
/// <summary> The day. </summary>
private DayOfWeek day;
/// <summary> Initializes a new instance of the OpeninghoursDayModel class. </summary>
/// <remarks> Fiedler, 12.11.2013. </remarks>
public OpeninghoursDayModel()
{
this.start = TimeSpan.Zero;
this.end = TimeSpan.Zero;
this.day = DayOfWeek.Sunday;
}
/// <summary> Gets or sets the start. </summary>
/// <value> The start. </value>
[XmlAttribute("start")]
public string Start
{
get
{
return this.TimeSpanToString(this.start);
}
set
{
this.start = this.StringToTimeSpan(value);
}
}
/// <summary> Gets or sets the start. </summary>
/// <value> The start. </value>
[XmlIgnore]
public TimeSpan StartTS
{
get
{
return this.start;
}
set
{
this.start = value;
}
}
/// <summary> Gets or sets the end. </summary>
/// <value> The end. </value>
[XmlAttribute("end")]
public string End
{
get
{
return this.TimeSpanToString(this.end);
}
set
{
this.end = this.StringToTimeSpan(value);
}
}
/// <summary> Gets or sets the end. </summary>
/// <value> The end. </value>
[XmlIgnore]
public TimeSpan EndTS
{
get
{
return this.end;
}
set
{
this.end = value;
}
}
/// <summary> Gets or sets the day. </summary>
/// <value> The day. </value>
[XmlAttribute("day")]
public int Day
{
get
{
return this.DayOfWeekToInt(this.day);
}
set
{
this.day = this.IntToDayOfWeek(value);
}
}
/// <summary> Gets or sets the day. </summary>
/// <value> The day. </value>
[XmlIgnore]
public DayOfWeek DayDOW
{
get
{
return this.day;
}
set
{
this.day = value;
}
}
/// <summary> Gets the time string. </summary>
/// <value> The time string. </value>
[XmlIgnore]
public string TimeString
{
get
{
return this.TimeSpanToString(this.start) + " - " + this.TimeSpanToString(this.end);
}
}
/// <summary> String to time span. </summary>
/// <remarks> Fiedler, 12.11.2013. </remarks>
/// <param name="str"> The. </param>
/// <returns> A TimeSpan. </returns>
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);
}
/// <summary> Time span to string. </summary>
/// <remarks> Fiedler, 12.11.2013. </remarks>
/// <param name="span"> The span. </param>
/// <returns> A string. </returns>
private string TimeSpanToString(TimeSpan span)
{
return string.Format("{0:hh\\:mm}", span);
}
/// <summary> Int to day of week. </summary>
/// <remarks> Fiedler, 12.11.2013. </remarks>
/// <exception cref="NotSupportedException">
/// Thrown when the requested operation is not supported.
/// </exception>
/// <param name="dayNr"> The day nr. </param>
/// <returns> A DayOfWeek. </returns>
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;
}
/// <summary> Day of week to int. </summary>
/// <remarks> Fiedler, 12.11.2013. </remarks>
/// <param name="dow"> The dow. </param>
/// <returns> An int. </returns>
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;
}
}
}

View File

@@ -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
/// <summary> English version of the institution title. </summary>
private string titleEN = string.Empty;
/// <summary> Opening hours on monday. </summary>
private string dayMonday = string.Empty;
/// <summary> Opening hours on tuesday. </summary>
private string dayTuesday = string.Empty;
/// <summary> Opening hours on wednesday. </summary>
private string dayWednesday = string.Empty;
/// <summary> Opening hours on thursday. </summary>
private string dayThursday = string.Empty;
/// <summary> Opening hours on friday. </summary>
private string dayFriday = string.Empty;
/// <summary> Opening hours on saturday. </summary>
private string daySaturday = string.Empty;
/// <summary> Opening hours on sunday. </summary>
private string daySunday = string.Empty;
/// <summary> Email address of the institution. </summary>
private string infoEmail = string.Empty;
@@ -63,6 +44,9 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// <summary> English version of the comment. </summary>
private string commentEN = string.Empty;
/// <summary> List of days. </summary>
private ObservableCollection<OpeninghoursDayModel> dayList = null;
#endregion
#region Constructor
@@ -73,6 +57,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// <remarks> Stubbfel, 15.10.2013. </remarks>
public OpeninghoursInstitutionModel()
{
this.dayList = new ObservableCollection<OpeninghoursDayModel>();
}
#endregion
@@ -111,115 +96,80 @@ namespace CampusAppWPortalLib8.Model.Openinghours
}
}
/// <summary> Gets or sets the open hours on monday. </summary>
/// <summary> Gets the open hours on monday. </summary>
/// <value> The monday. </value>
[XmlAttribute("monday")]
[XmlIgnore]
public string Monday
{
get
{
return this.dayMonday;
}
set
{
this.dayMonday = this.FixOpeninghoursString(value);
return this.DayToString(DayOfWeek.Monday);
}
}
/// <summary> Gets or sets the open hours on tuesday. </summary>
/// <summary> Gets the open hours on tuesday. </summary>
/// <value> The tuesday. </value>
[XmlAttribute("tuesday")]
[XmlIgnore]
public string Tuesday
{
get
{
return this.dayTuesday;
}
set
{
this.dayTuesday = this.FixOpeninghoursString(value);
return this.DayToString(DayOfWeek.Tuesday);
}
}
/// <summary> Gets or sets the open hours on wednesday. </summary>
/// <summary> Gets the open hours on wednesday. </summary>
/// <value> The wednesday. </value>
[XmlAttribute("wednesday")]
[XmlIgnore]
public string Wednesday
{
get
{
return this.dayWednesday;
}
set
{
this.dayWednesday = this.FixOpeninghoursString(value);
return this.DayToString(DayOfWeek.Wednesday);
}
}
/// <summary> Gets or sets the open hours on thursday. </summary>
/// <summary> Gets the open hours on thursday. </summary>
/// <value> The thursday. </value>
[XmlAttribute("thursday")]
[XmlIgnore]
public string Thursday
{
get
{
return this.dayThursday;
}
set
{
this.dayThursday = this.FixOpeninghoursString(value);
return this.DayToString(DayOfWeek.Thursday);
}
}
/// <summary> Gets or sets the open hours on friday. </summary>
/// <summary> Gets the open hours on friday. </summary>
/// <value> The friday. </value>
[XmlAttribute("friday")]
[XmlIgnore]
public string Friday
{
get
{
return this.dayFriday;
}
set
{
this.dayFriday = this.FixOpeninghoursString(value);
return this.DayToString(DayOfWeek.Friday);
}
}
/// <summary> Gets or sets the open hours on saturday. </summary>
/// <summary> Gets the open hours on saturday. </summary>
/// <value> The saturday. </value>
[XmlAttribute("saturday")]
[XmlIgnore]
public string Saturday
{
get
{
return this.daySaturday;
}
set
{
this.daySaturday = this.FixOpeninghoursString(value);
return this.DayToString(DayOfWeek.Saturday);
}
}
/// <summary> Gets or sets the open hours on sunday. </summary>
/// <summary> Gets the open hours on sunday. </summary>
/// <value> The sunday. </value>
[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
}
}
/// <summary> Gets or sets the days. </summary>
/// <value> The days. </value>
[XmlElement("Open")]
public ObservableCollection<OpeninghoursDayModel> Days
{
get
{
return this.dayList;
}
set
{
this.dayList = value;
}
}
/// <summary>
/// Gets the localized title. If the phone is set to german language, the german title will
/// be returned otherwise the english title.
/// </summary>
/// <value> The title. </value>
[XmlIgnore]
public string Title
{
get
@@ -344,6 +311,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// will be returned otherwise the english comment.
/// </summary>
/// <value> The comment. </value>
[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 ':'.
/// </summary>
/// <value> The e mail title. </value>
[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 ':'.
/// </summary>
/// <value> The phone title. </value>
[XmlIgnore]
public string PhoneTitle
{
get
@@ -383,19 +353,183 @@ namespace CampusAppWPortalLib8.Model.Openinghours
}
}
/// <summary> Gets a value indicating whether the visible monday. </summary>
/// <value> true if visible monday, false if not. </value>
[XmlIgnore]
public bool VisibleMonday
{
get
{
return this.HasDay(DayOfWeek.Monday);
}
}
/// <summary> Gets a value indicating whether the visible tuesday. </summary>
/// <value> true if visible tuesday, false if not. </value>
[XmlIgnore]
public bool VisibleTuesday
{
get
{
return this.HasDay(DayOfWeek.Tuesday);
}
}
/// <summary> Gets a value indicating whether the visible wednesday. </summary>
/// <value> true if visible wednesday, false if not. </value>
[XmlIgnore]
public bool VisibleWednesday
{
get
{
return this.HasDay(DayOfWeek.Wednesday);
}
}
/// <summary> Gets a value indicating whether the visible thursday. </summary>
/// <value> true if visible thursday, false if not. </value>
[XmlIgnore]
public bool VisibleThursday
{
get
{
return this.HasDay(DayOfWeek.Thursday);
}
}
/// <summary> Gets a value indicating whether the visible friday. </summary>
/// <value> true if visible friday, false if not. </value>
[XmlIgnore]
public bool VisibleFriday
{
get
{
return this.HasDay(DayOfWeek.Friday);
}
}
/// <summary> Gets a value indicating whether the visible saturday. </summary>
/// <value> true if visible saturday, false if not. </value>
[XmlIgnore]
public bool VisibleSaturday
{
get
{
return this.HasDay(DayOfWeek.Saturday);
}
}
/// <summary> Gets a value indicating whether the visible sunday. </summary>
/// <value> true if visible sunday, false if not. </value>
[XmlIgnore]
public bool VisibleSunday
{
get
{
return this.HasDay(DayOfWeek.Sunday);
}
}
/// <summary> Gets a value indicating whether the visible comment. </summary>
/// <value> true if visible comment, false if not. </value>
[XmlIgnore]
public bool VisibleComment
{
get
{
return !((this.Comment == string.Empty) || (this.Comment.Length == 0));
}
}
/// <summary> Gets a value indicating whether the visible mail. </summary>
/// <value> true if visible mail, false if not. </value>
[XmlIgnore]
public bool VisibleEMail
{
get
{
return !((this.EMail == string.Empty) || (this.EMail.Length == 0));
}
}
/// <summary> Gets a value indicating whether the visible phone. </summary>
/// <value> true if visible phone, false if not. </value>
[XmlIgnore]
public bool VisiblePhone
{
get
{
return !((this.Phone == string.Empty) || (this.Phone.Length == 0));
}
}
/// <summary> Gets a value indicating whether the visible room. </summary>
/// <value> true if visible room, false if not. </value>
[XmlIgnore]
public bool VisibleRoom
{
get
{
return !((this.Room == string.Empty) || (this.Room.Length == 0));
}
}
/// <summary> Gets a value indicating whether the visible building. </summary>
/// <value> true if visible building, false if not. </value>
[XmlIgnore]
public bool VisibleBuilding
{
get
{
return !((this.Building == string.Empty) || (this.Building.Length == 0));
}
}
#endregion
#region Method
/// <summary> Removes unwanted chars in a string. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
/// <param name="str"> input string. </param>
/// <returns> fixed string. </returns>
private string FixOpeninghoursString(string str)
/// <summary> Day to string. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="dow"> The dow. </param>
/// <returns> A string. </returns>
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;
}
/// <summary> Query if 'dow' has day. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="dow"> The dow. </param>
/// <returns> true if day, false if not. </returns>
private bool HasDay(DayOfWeek dow)
{
bool retValue = false;
foreach (OpeninghoursDayModel dm in this.dayList)
{
if (dm.DayDOW.Equals(dow))
{
retValue = true;
}
}
return retValue;
}

View File

@@ -0,0 +1,62 @@
//-----------------------------------------------------------------------
// <copyright file="OpeninghoursLocationModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>13.11.2013</date>
// <summary>Implements the openinghours location model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Openinghours
{
using System.Collections.ObjectModel;
using System.Xml.Serialization;
/// <summary> Model for menu. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
public class OpeninghoursLocationModel
{
/// <summary> The institutions. </summary>
private ObservableCollection<OpeninghoursInstitutionModel> institutions = null;
/// <summary> Identifier for the location. </summary>
private int locationID = -1;
/// <summary> Initializes a new instance of the OpeninghoursLocationModel class. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
public OpeninghoursLocationModel()
{
this.institutions = new ObservableCollection<OpeninghoursInstitutionModel>();
}
/// <summary> Gets or sets the identifier of the location. </summary>
/// <value> The identifier of the location. </value>
[XmlAttribute("id")]
public int LocationID
{
get
{
return this.locationID;
}
set
{
this.locationID = value;
}
}
/// <summary> Gets or sets the institutions. </summary>
/// <value> The institutions. </value>
[XmlElement("Object")]
public ObservableCollection<OpeninghoursInstitutionModel> Institutions
{
get
{
return this.institutions;
}
set
{
this.institutions = value;
}
}
}
}

View File

@@ -16,7 +16,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// <remarks> fiedlchr, 15.10.2013. </remarks>
/// <typeparam name="T"> Generic type parameter. </typeparam>
[XmlRoot("root")]
public class OpeninghoursModel<T> where T : OpeninghoursInstitutionModel
public class OpeninghoursModel
{
#region Member
@@ -24,7 +24,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
private readonly DateTime createTime;
/// <summary> Gets or sets feed information item list. </summary>
private ObservableCollection<T> institutions;
private ObservableCollection<OpeninghoursLocationModel> locations;
#endregion
@@ -34,7 +34,7 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// <remarks> fiedlchr, 15.10.2013. </remarks>
public OpeninghoursModel()
{
this.institutions = new ObservableCollection<T>();
this.locations = new ObservableCollection<OpeninghoursLocationModel>();
this.createTime = DateTime.Now;
}
@@ -55,17 +55,17 @@ namespace CampusAppWPortalLib8.Model.Openinghours
/// <summary> Gets or sets the Institutions. </summary>
/// <value> The institutions. </value>
[XmlArray("data")]
[XmlArrayItem("institution")]
public ObservableCollection<T> Institutions
[XmlArrayItem("Location")]
public ObservableCollection<OpeninghoursLocationModel> Locations
{
get
{
return this.institutions;
return this.locations;
}
set
{
this.institutions = value;
this.locations = value;
}
}

View File

@@ -134,6 +134,31 @@ namespace CampusAppWPortalLib8.Model.Utility
return false;
}
/// <summary> Rotate degrees. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="fixPoint"> The fix point. </param>
/// <param name="angleDeg"> The angle degrees. positive values -> counterclockwise rotation.</param>
/// <returns> A MapPoint. </returns>
public MapPoint RotateDeg(MapPoint fixPoint, double angleDeg)
{
return this.Rotate(fixPoint, angleDeg * (Math.PI / 180));
}
/// <summary> Rotates. </summary>
/// <remarks> Fiedler, 13.11.2013. </remarks>
/// <param name="fixPoint"> The fix point. </param>
/// <param name="angleRad"> The angle radians. positive values -> counterclockwise rotation.</param>
/// <returns> A MapPoint. </returns>
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
}
}