Merge branch 'feature/#243' into develop

This commit is contained in:
Christian Fiedler
2013-11-22 20:57:33 +01:00
20 changed files with 580 additions and 99 deletions

View File

@@ -16,7 +16,6 @@
<local:LocalizedStrings xmlns:local="clr-namespace:CampusAppWP8" x:Key="LocalizedStrings"/>
<local:ThemelizedIcons xmlns:local="clr-namespace:CampusAppWP8" x:Key="ThemelizedIcons"/>
<local:Const xmlns:local="clr-namespace:CampusAppWP8" x:Key="Const"/>
<local:BoolToVisibilityConverter xmlns:local="clr-namespace:CampusAppWP8.Utility" x:Key="BoolToVisibilityConverter"/>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@@ -155,7 +155,9 @@
<DependentUpon>TimeTableWeek.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\TimeTable\WeekViewPageItem.cs" />
<Compile Include="Utility\DoubleNaNConverter.cs" />
<Compile Include="Utility\Converter\DoubleNaNConverter.cs" />
<Compile Include="Utility\Converter\RoomToStringConverter.cs" />
<Compile Include="Utility\Converter\FrameworkElementToRectConverter.cs" />
<Compile Include="Utility\ICalObject.cs" />
<Compile Include="Utility\ICSClasses.cs" />
<Compile Include="Utility\ICSManager.cs" />
@@ -239,9 +241,9 @@
</Compile>
<Compile Include="Utility\AppUriMapper.cs" />
<Compile Include="Utility\BackgroundTasks.cs" />
<Compile Include="Utility\BoolToVisibilityConverter.cs" />
<Compile Include="Utility\Converter\BoolToVisibilityConverter.cs" />
<Compile Include="Utility\FrameworkAnimator.cs" />
<Compile Include="Utility\IdToPlaceConverter.cs" />
<Compile Include="Utility\Converter\IdToPlaceConverter.cs" />
<Compile Include="Utility\ListFiller.cs" />
<Compile Include="Utility\Lui\Button\AddButton.cs" />
<Compile Include="Utility\Lui\Button\AddPersonButton.cs" />
@@ -266,7 +268,7 @@
<DependentUpon>WeekViewDay.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Lui\Tiles\TileCreator.cs" />
<Compile Include="Utility\MealIdToPriceConverter.cs" />
<Compile Include="Utility\Converter\MealIdToPriceConverter.cs" />
<Compile Include="Utility\NDEF\BTUTagMessage.cs" />
<Compile Include="Pages\Dev\NFC.xaml.cs">
<DependentUpon>NFC.xaml</DependentUpon>

View File

@@ -9,6 +9,8 @@
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header"
xmlns:lu="clr-namespace:CampusAppWP8.Utility.Lui"
xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
@@ -17,53 +19,97 @@
shell:SystemTray.IsVisible="True"
x:Name="root">
<phone:PhoneApplicationPage.Resources>
<conv:RoomToStringConverter x:Key="RoomConverter"/>
<conv:FrameworkElementToRectConverter x:Key="RectConverter"/>
<DataTemplate x:Name="RoomPickerItemTemplate">
<lu:MultiValueTextBlock Value1="{Binding BindsDirectlyToSource=True}" Converter="{StaticResource RoomConverter}"/>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--row_0-->
<StackPanel Grid.Row="0">
<header:DefaultHeader Name="DefHeader" HeaderName="{Binding Path=LocalizedResources.CampusMapApp_RoomListTitle, Source={StaticResource LocalizedStrings}}"/>
<header:DefaultHeader x:Name="DefHeader" HeaderName="{Binding Path=LocalizedResources.CampusMapApp_RoomListTitle, Source={StaticResource LocalizedStrings}}"/>
</StackPanel>
<Grid Grid.Row="1">
<!--row_1-->
<Grid Grid.Row="1" Margin="24,-12,24,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</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" />
<TextBlock
Grid.Column="0"
Text="{Binding Path=LocalizedResources.LayerListPicker_Label, Source={StaticResource LocalizedStrings}}"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="0,0,24,0"/>
<TextBlock
x:Name="LayerTag"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<Button Grid.Column="2" Click="SearchRoom" Margin="0,0,0,-10" Padding="0">
<Image Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="50" Height="50" Margin="0"/>
</Button>
</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>
<!--row_2-->
<toolkit:ListPicker
x:Name="RoomPicker"
Grid.Row="2"
SelectionChanged="RoomPicker_SelectionChanged"
ItemsSource="{Binding RoomPickerList, ElementName=root, Mode=OneWay}"
FullModeItemTemplate="{StaticResource RoomPickerItemTemplate}"
FullModeHeader="{Binding Path=LocalizedResources.Rooms, Source={StaticResource LocalizedStrings}}"
Opacity="0"/>
<!--row_3-->
<ViewportControl
x:Name="VPC"
Grid.Row="3"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Margin="12"
Bounds="{Binding ViewBounds, ElementName=root, Mode=OneWay}"
>
<Canvas
x:Name="MapCanvas"
Height="{Binding Height, Mode=OneWay, ElementName=imgMap}"
Width="{Binding Width, Mode=OneWay, ElementName=imgMap}"
VerticalAlignment="Top"
HorizontalAlignment="Left"
ManipulationDelta="MapCanvas_ManipulationDelta"
ManipulationStarted="MapCanvas_ManipulationStarted"
ManipulationCompleted="MapCanvas_ManipulationCompleted"
SizeChanged="MapCanvas_SizeChanged"
>
<Image
x:Name="imgMap"
Height="{Binding ImageHeight}"
Width="{Binding ImageWidth}"
Source="{Binding ImageSource}"
HorizontalAlignment="Left"
VerticalAlignment="Top"/>
<Canvas.RenderTransform>
<ScaleTransform/>
</Canvas.RenderTransform>
</Canvas>
</ViewportControl>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized" />
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Default" />
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -10,6 +10,7 @@ namespace CampusAppWP8.Pages.Campusmap
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
@@ -51,8 +52,19 @@ namespace CampusAppWP8.Pages.Campusmap
/// <summary> The offset point. </summary>
private MapPoint offsetPoint;
/// <summary> The selected layer. </summary>
private string selectedLayer = string.Empty;
/// <summary> List of room pickers. </summary>
private ObservableCollection<object> roomPickerList = new ObservableCollection<object>();
/// <summary> The view bounds. </summary>
private Rect viewBounds = new Rect();
/// <summary> The marker pin. </summary>
private UIElement markerPin = null;
/// <summary> The canvas scale. </summary>
private double canvasScale = 1.0;
#endregion
#region Constructor
@@ -62,10 +74,25 @@ namespace CampusAppWP8.Pages.Campusmap
public RoomListPage()
{
this.InitializeComponent();
ApplicationBarIconButton btnZoomIn = new ApplicationBarIconButton();
btnZoomIn.IconUri = new Uri(Icons.Info, UriKind.Relative);
btnZoomIn.Text = AppResources.ZoomIn;
btnZoomIn.Click += this.BtnZoomIn_Click;
ApplicationBarIconButton btnZoomOut = new ApplicationBarIconButton();
btnZoomOut.IconUri = new Uri(Icons.Info, UriKind.Relative);
btnZoomOut.Text = AppResources.ZoomOut;
btnZoomOut.Click += this.BtnZoomOut_Click;
this.ApplicationBar.Buttons.Add(btnZoomIn);
this.ApplicationBar.Buttons.Add(btnZoomOut);
}
#endregion
/// <summary> Gets or sets the selected layer. </summary>
/// <value> The selected layer. </value>
private string SelectedLayer
{
get
@@ -75,8 +102,27 @@ namespace CampusAppWP8.Pages.Campusmap
set
{
this.selectedLayer = value;
this.LayerTag.Text = value;
if (this.selectedLayer != value)
{
this.selectedLayer = value;
this.LayerTag.Text = value;
this.UpdateRoomList(value);
}
}
}
/// <summary> Gets or sets a list of room pickers. </summary>
/// <value> A List of room pickers. </value>
public ObservableCollection<object> RoomPickerList
{
get
{
return this.roomPickerList;
}
set
{
this.roomPickerList = value;
}
}
@@ -170,7 +216,7 @@ namespace CampusAppWP8.Pages.Campusmap
x = room.GeoRefPoint.Longitude;
y = room.GeoRefPoint.Latitude;
MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y)));
MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint;
MapPoint viewPoint = roompoint + this.offsetPoint; //- this.mappoint
MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, PinType.InfoRedPlace, new List<PlaceModel> { room }));
}
@@ -320,7 +366,7 @@ namespace CampusAppWP8.Pages.Campusmap
x = room.GeoRefPoint.Longitude;
y = room.GeoRefPoint.Latitude;
MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y)));
MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint;
MapPoint viewPoint = roompoint + this.offsetPoint; // -this.mappoint;
PinType type;
@@ -375,11 +421,15 @@ namespace CampusAppWP8.Pages.Campusmap
this.MapCanvas.DataContext = this.buildingMap;
Canvas.SetLeft(this.imgMap, -1 * this.mappoint.X);
Canvas.SetTop(this.imgMap, -1 * this.mappoint.Y);
Canvas.SetZIndex(this.imgMap, 0);
//Canvas.SetLeft(this.imgMap, -1 * this.mappoint.X);
//Canvas.SetTop(this.imgMap, -1 * this.mappoint.Y);
//Canvas.SetZIndex(this.imgMap, 0);
}
/// <summary> Raises the system. event. </summary>
/// <remarks> Fiedler, 18.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Event information to send to registered event handlers. </param>
private void OnMenuItemClicked(object sender, System.EventArgs e)
{
if (this.SelectedLayer.Equals((sender as ApplicationBarMenuItem).Text) == false)
@@ -423,25 +473,138 @@ namespace CampusAppWP8.Pages.Campusmap
/// <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)
/// <param name="e"> Event information. </param>
private void BtnZoomIn_Click(object sender, EventArgs e)
{
//throw new NotImplementedException("TODO");
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleX *= 1.5;
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleY *= 1.5;
if (this.canvasScale >= 3)
{
return;
}
else
{
this.canvasScale *= 1.1;
}
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleX = this.canvasScale;
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleY = this.canvasScale;
this.ReCalcBounds();
}
/// <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)
/// <param name="e"> Event information. </param>
private void BtnZoomOut_Click(object sender, EventArgs e)
{
//throw new NotImplementedException("TODO");
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleX /= 1.5;
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleY /= 1.5;
double tempW = (this.MapCanvas.ActualWidth / this.VPC.ActualWidth);
double tempH = (this.MapCanvas.ActualHeight / this.VPC.ActualHeight);
if (tempW == 1 || tempH == 1)
{
return;
}
else if ((this.MapCanvas.ActualWidth * this.canvasScale * 0.95) < this.VPC.ActualWidth || (this.MapCanvas.ActualHeight * this.canvasScale * 0.95) < this.VPC.ActualHeight)
{
tempW = (this.VPC.ActualWidth / this.MapCanvas.ActualWidth);
tempH = (this.VPC.ActualHeight / this.MapCanvas.ActualHeight);
if (tempH < tempW)
{
this.canvasScale = tempW;
}
else
{
this.canvasScale = tempH;
}
}
else
{
this.canvasScale *= 0.95;
}
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleX = this.canvasScale;
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleY = this.canvasScale;
this.ReCalcBounds();
}
/// <summary> Searches for the first room. </summary>
/// <remarks> Fiedler, 18.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Event information. </param>
private void SearchRoom(object sender, EventArgs e)
{
this.RoomPicker.Open();
}
/// <summary> Updates the room list described by level. </summary>
/// <remarks> Fiedler, 18.11.2013. </remarks>
/// <param name="level"> The level. </param>
private void UpdateRoomList(string level)
{
CampusBuildingLayerModel layer = this.building.Layers[level];
this.roomPickerList.Clear();
foreach (PlaceModel room in layer.Rooms.Places)
{
if(room.GetInformationsValue(Constants.PisInformationName_Typ).Equals(Constants.PisInformationValue_Entrance) == false)
{
this.roomPickerList.Add(room);
}
}
}
#endregion
/// <summary> Event handler. Called by RoomPicker for selection changed events. </summary>
/// <remarks> Fiedler, 18.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Selection changed event information. </param>
private void RoomPicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.AddedItems != null && e.AddedItems.Count > 0 && e.RemovedItems != null && e.RemovedItems.Count > 0)
{
if (this.markerPin != null)
{
this.MapCanvas.Children.Remove(this.markerPin);
}
PlaceModel room = e.AddedItems[0] as PlaceModel;
MapPoint viewPoint
= this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(room.GeoRefPoint.Longitude, room.GeoRefPoint.Latitude)))
+ this.offsetPoint;
this.markerPin = this.buildingMap.AddPin(viewPoint, PinType.InfoRedPlace);
this.MapCanvas.Children.Add(this.markerPin);
}
}
/// <summary> Event handler. Called by MapCanvas for size changed events. </summary>
/// <remarks> Fiedler, 22.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Size changed event information. </param>
private void MapCanvas_SizeChanged(object sender, SizeChangedEventArgs e)
{
this.ReCalcBounds();
this.VPC.SetViewportOrigin(new Point(this.mappoint.X, this.mappoint.Y));
}
/// <summary> Re calculate bounds. </summary>
/// <remarks> Fiedler, 22.11.2013. </remarks>
private void ReCalcBounds()
{
this.viewBounds.Width = this.MapCanvas.RenderSize.Width * (this.MapCanvas.RenderTransform as ScaleTransform).ScaleX;
this.viewBounds.Height = this.MapCanvas.RenderSize.Height * (this.MapCanvas.RenderTransform as ScaleTransform).ScaleY;
Point newPos = new Point();
newPos.X = this.VPC.Viewport.X + ((this.viewBounds.Width - this.VPC.Bounds.Width) * 0.5);
newPos.Y = this.VPC.Viewport.Y + ((this.viewBounds.Height - this.VPC.Bounds.Height) * 0.5);
this.VPC.Bounds = this.viewBounds;
this.VPC.SetViewportOrigin(newPos);
}
}
}

View File

@@ -9,7 +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"
xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
@@ -18,8 +18,8 @@
shell:SystemTray.IsVisible="True">
<page:PortraitLandscapePage.Resources>
<utility:BoolToVisibilityConverter x:Key="VisConverter"/>
<utility:IdToPlaceConverter x:Key="PlaceConverter"/>
<conv:BoolToVisibilityConverter x:Key="VisConverter"/>
<conv:IdToPlaceConverter x:Key="PlaceConverter"/>
</page:PortraitLandscapePage.Resources>
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->

View File

@@ -1158,6 +1158,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Räume ähnelt.
/// </summary>
public static string Rooms {
get {
return ResourceManager.GetString("Rooms", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Beispielwert für die Laufzeiteigenschaft ähnelt.
/// </summary>
@@ -1571,5 +1580,23 @@ namespace CampusAppWP8.Resources {
return ResourceManager.GetString("When", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Zoom + ähnelt.
/// </summary>
public static string ZoomIn {
get {
return ResourceManager.GetString("ZoomIn", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Zoom - ähnelt.
/// </summary>
public static string ZoomOut {
get {
return ResourceManager.GetString("ZoomOut", resourceCulture);
}
}
}
}

View File

@@ -617,10 +617,19 @@
<data name="MensaApp_Weekplan" xml:space="preserve">
<value>Wochenplan</value>
</data>
<data name="ZoomIn" xml:space="preserve">
<value>Zoom +</value>
</data>
<data name="ZoomOut" xml:space="preserve">
<value>Zoom -</value>
</data>
<data name="Setting_TagHandlerDate" xml:space="preserve">
<value>Termin erstellen</value>
</data>
<data name="LectureApp_LectureDates" xml:space="preserve">
<value>Veranstaltungstermine</value>
</data>
<data name="Rooms" xml:space="preserve">
<value>Räume</value>
</data>
</root>

View File

@@ -609,6 +609,9 @@
<data name="UrlMensaPrice" xml:space="preserve">
<value>http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1</value>
</data>
<data name="PisInformationValue_Entrance" xml:space="preserve">
<value>Zugangsbereich</value>
</data>
<data name="ParamIsoKey" xml:space="preserve">
<value>isolated</value>
</data>

View File

@@ -1275,6 +1275,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Zugangsbereich ähnelt.
/// </summary>
public static string PisInformationValue_Entrance {
get {
return ResourceManager.GetString("PisInformationValue_Entrance", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die pid ähnelt.
/// </summary>

View File

@@ -6,7 +6,7 @@
// <date>15.10.2013</date>
// <summary>Implements to visibility converter class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility
namespace CampusAppWP8.Utility.Converter
{
using System;
using System.Windows;

View File

@@ -0,0 +1,28 @@
namespace CampusAppWP8.Utility.Converter
{
using System;
using System.Windows;
using System.Windows.Data;
public sealed class FrameworkElementToRectConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
{
Rect retValue = new Rect();
if (value != null)
{
retValue.Height = (value as FrameworkElement).ActualHeight;
retValue.Width = (value as FrameworkElement).ActualWidth;
}
return retValue;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
{
return null;
}
}
}

View File

@@ -6,7 +6,7 @@
// <date>13.11.2013</date>
// <summary>Implements the identifier to place converter class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility
namespace CampusAppWP8.Utility.Converter
{
using System;
using System.Windows.Data;

View File

@@ -6,7 +6,7 @@
// <date>14.11.2013</date>
// <summary>Implements the meal identifier to price converter class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility
namespace CampusAppWP8.Utility.Converter
{
using System;
using System.Windows.Data;

View File

@@ -0,0 +1,67 @@
//-----------------------------------------------------------------------
// <copyright file="RoomToStringConverter.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Fiedler</author>
// <date>22.11.2013</date>
// <summary>Implements the room to string converter class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility.Converter
{
using System;
using System.Collections.Generic;
using System.Windows.Data;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.GeoDb;
/// <summary> A room to string converter. </summary>
/// <remarks> Fiedler, 22.11.2013. </remarks>
/// <seealso cref="T:System.Windows.Data.IValueConverter"/>
public sealed class RoomToStringConverter : IValueConverter
{
/// <summary>
/// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
/// </summary>
/// <remarks> Fiedler, 22.11.2013. </remarks>
/// <seealso cref="M:System.Windows.Data.IValueConverter.Convert(object,Type,object,System.Globalization.CultureInfo)"/>
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
{
string retValue = string.Empty;
if (value.GetType().Equals(typeof(List<object>)))
{
List<object> list = value as List<object>;
if (list[0] != null && list[0].GetType().Equals(typeof(PlaceModel)) == true)
{
PlaceModel room = list[0] as PlaceModel;
string nameStr = room.GetInformationsValue(Constants.PisInformationName_Name);
string roomStr = room.GetInformationsValue(Constants.PisInformationName_Room);
if (nameStr.Equals(roomStr))
{
retValue = roomStr;
}
else
{
retValue = roomStr + ", " + nameStr;
}
}
}
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, 22.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;
}
}
}

View File

@@ -1,22 +0,0 @@
namespace CampusAppWP8.Utility
{
using System;
using System.Windows;
using System.Windows.Data;
public sealed class DoubleNaNConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
{
return (value is double && value.Equals(double.NaN) == false) ? value : 0.0;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language)
{
return (value is double && value.Equals(double.NaN) == false) ? value : 0.0;
}
}
}

View File

@@ -9,10 +9,5 @@
Foreground="{StaticResource PhoneForegroundBrush}"
>
<!--
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
</Grid>
-->
<TextBlock x:Name="TheText"/>
</UserControl>

View File

@@ -8,6 +8,7 @@
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility.Lui
{
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@@ -17,21 +18,47 @@ namespace CampusAppWP8.Utility.Lui
/// <seealso cref="T:System.Windows.Controls.UserControl"/>
public partial class MultiValueTextBlock : UserControl
{
#region DependencyProperties
/// <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));
public static readonly DependencyProperty Value_1_Property = DependencyProperty.Register("Value1", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null));
/// <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));
public static readonly DependencyProperty Value_2_Property = DependencyProperty.Register("Value2", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null));
/// <summary> The value 3 property. </summary>
public static readonly DependencyProperty Value_3_Property = DependencyProperty.Register("Value3", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null));
/// <summary> The value 4 property. </summary>
public static readonly DependencyProperty Value_4_Property = DependencyProperty.Register("Value4", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null));
/// <summary> The value 5 property. </summary>
public static readonly DependencyProperty Value_5_Property = DependencyProperty.Register("Value5", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null));
/// <summary> The value 6 property. </summary>
public static readonly DependencyProperty Value_6_Property = DependencyProperty.Register("Value6", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null));
/// <summary> The value 7 property. </summary>
public static readonly DependencyProperty Value_7_Property = DependencyProperty.Register("Value7", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null));
/// <summary> The value 8 property. </summary>
public static readonly DependencyProperty Value_8_Property = DependencyProperty.Register("Value8", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null));
/// <summary> The value list property. </summary>
public static readonly DependencyProperty Value_List_Property = DependencyProperty.Register("ValueList", typeof(List<object>), typeof(MultiValueTextBlock), new PropertyMetadata(null));
/// <summary> The converter property. </summary>
public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(IValueConverter), typeof(MultiValueTextBlock), new PropertyMetadata(null, MultiValueTextBlock.OnLoaded));
public static readonly DependencyProperty ConverterProperty = DependencyProperty.Register("Converter", typeof(IValueConverter), typeof(MultiValueTextBlock), new PropertyMetadata(null));
#endregion // DependencyProperties
#region Constructor
/// <summary> Initializes a new instance of the MultiValueTextBlock class. </summary>
/// <remarks> Fiedler, 14.11.2013. </remarks>
public MultiValueTextBlock() : base()
{
this.InitializeComponent();
this.Loaded += this.OnLoaded;
}
#endregion // Constructor
#region Properties
/// <summary> Gets or sets the converter. </summary>
/// <value> The converter. </value>
public IValueConverter Converter
@@ -77,18 +104,145 @@ namespace CampusAppWP8.Utility.Lui
}
}
/// <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)
/// <summary> Gets or sets the value 3. </summary>
/// <value> The value 3. </value>
public object Value3
{
MultiValueTextBlock obj = d as MultiValueTextBlock;
if ((obj.Value1 != null) && (obj.Value2 != null) && (obj.Converter != null))
get
{
obj.TheText.Text = (string)obj.Converter.Convert(obj.Value1, typeof(string), obj.Value2, System.Globalization.CultureInfo.CurrentCulture);
return this.GetValue(Value_3_Property);
}
set
{
this.SetValue(Value_3_Property, value);
}
}
/// <summary> Gets or sets the value 4. </summary>
/// <value> The value 4. </value>
public object Value4
{
get
{
return this.GetValue(Value_4_Property);
}
set
{
this.SetValue(Value_4_Property, value);
}
}
/// <summary> Gets or sets the value 5. </summary>
/// <value> The value 5. </value>
public object Value5
{
get
{
return this.GetValue(Value_5_Property);
}
set
{
this.SetValue(Value_5_Property, value);
}
}
/// <summary> Gets or sets the value 6. </summary>
/// <value> The value 6. </value>
public object Value6
{
get
{
return this.GetValue(Value_6_Property);
}
set
{
this.SetValue(Value_6_Property, value);
}
}
/// <summary> Gets or sets the value 7. </summary>
/// <value> The value 7. </value>
public object Value7
{
get
{
return this.GetValue(Value_7_Property);
}
set
{
this.SetValue(Value_7_Property, value);
}
}
/// <summary> Gets or sets the value 8. </summary>
/// <value> The value 8. </value>
public object Value8
{
get
{
return this.GetValue(Value_8_Property);
}
set
{
this.SetValue(Value_8_Property, value);
}
}
/// <summary> Gets or sets a list of values. </summary>
/// <value> A List of values. </value>
public object ValueList
{
get
{
return this.GetValue(Value_List_Property);
}
set
{
this.SetValue(Value_List_Property, value);
}
}
#endregion // Properties
#region Methods
/// <summary> Raises the routed event. </summary>
/// <remarks> Fiedler, 22.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Event information to send to registered event handlers. </param>
private void OnLoaded(object sender, RoutedEventArgs e)
{
if (this.Converter != null)
{
if (this.ValueList != null)
{
this.TheText.Text = (string)this.Converter.Convert(this.ValueList, typeof(string), null, System.Globalization.CultureInfo.CurrentCulture);
}
else
{
List<object> valList = new List<object>();
valList.Add(this.Value1);
valList.Add(this.Value2);
valList.Add(this.Value3);
valList.Add(this.Value4);
valList.Add(this.Value5);
valList.Add(this.Value6);
valList.Add(this.Value7);
valList.Add(this.Value8);
this.TheText.Text = (string)this.Converter.Convert(valList, typeof(string), null, System.Globalization.CultureInfo.CurrentCulture);
}
}
}
#endregion // Methods
}
}

View File

@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:weekView="clr-namespace:CampusAppWP8.Utility.Lui.Templates"
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui"
xmlns:conv="clr-namespace:CampusAppWP8.Utility"
xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"

View File

@@ -3,7 +3,7 @@
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"
xmlns:utility="clr-namespace:CampusAppWP8.Utility"
xmlns:conv="clr-namespace:CampusAppWP8.Utility.Converter"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
@@ -12,7 +12,7 @@
>
<UserControl.Resources>
<utility:DoubleNaNConverter x:Key="NaNConverter"/>
<conv:DoubleNaNConverter x:Key="NaNConverter"/>
</UserControl.Resources>
<Grid x:Name="TheGrid" Width="{Binding Path=Width, ElementName=root, Mode=OneWay}">

View File

@@ -24,6 +24,7 @@ namespace CampusAppWP8.Utility.Lui.Templates
using System.Windows.Data;
using CampusAppWP8.Model.TimeTable;
using CampusAppWP8.Utility;
using CampusAppWP8.Utility.Converter;
/// <summary> A week view day. </summary>
/// <remarks> Fiedler, 06.11.2013. </remarks>