From 5605491ea98d83fd9e2922cfaab6131fba3898be Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Tue, 19 Nov 2013 13:17:24 +0100 Subject: [PATCH 1/2] a --- .../Pages/Campusmap/RoomListPage.xaml | 49 ++++++----- .../Pages/Campusmap/RoomListPage.xaml.cs | 85 +++++++++++++++++-- .../Resources/AppResources.Designer.cs | 18 ++++ .../CampusAppWP8/Resources/AppResources.resx | 6 ++ .../CampusAppWP8/Resources/Constants.resx | 3 + .../Resources/Constants1.Designer.cs | 9 ++ 6 files changed, 143 insertions(+), 27 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml index ac0bb7cd..257cb480 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml @@ -9,6 +9,7 @@ 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" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" @@ -22,22 +23,46 @@ + - + + - - + + + - + + + + + + + + + + @@ -46,24 +71,10 @@ - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs index 69fb12ef..3bee41eb 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs @@ -62,6 +62,19 @@ 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 @@ -75,8 +88,12 @@ 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); + } } } @@ -380,6 +397,10 @@ namespace CampusAppWP8.Pages.Campusmap Canvas.SetZIndex(this.imgMap, 0); } + /// Raises the system. event. + /// Fiedler, 18.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. private void OnMenuItemClicked(object sender, System.EventArgs e) { if (this.SelectedLayer.Equals((sender as ApplicationBarMenuItem).Text) == false) @@ -423,10 +444,9 @@ namespace CampusAppWP8.Pages.Campusmap /// Event handler. Called by ZoomIn for tap events. /// Fiedler, 15.11.2013. /// Source of the event. - /// Gesture event information. - private void ZoomIn_Tap(object sender, System.Windows.Input.GestureEventArgs e) + /// Event information. + 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; } @@ -434,14 +454,63 @@ namespace CampusAppWP8.Pages.Campusmap /// Event handler. Called by ZoomOut for tap events. /// Fiedler, 15.11.2013. /// Source of the event. - /// Gesture event information. - private void ZoomOut_Tap(object sender, System.Windows.Input.GestureEventArgs e) + /// Event information. + 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; } + /// Searches for the first room. + /// Fiedler, 18.11.2013. + /// Source of the event. + /// Event information. + private void SearchRoom(object sender, EventArgs e) + { + this.RoomPicker.Open(); + } + + /// Updates the room list described by level. + /// Fiedler, 18.11.2013. + /// The level. + private void UpdateRoomList(string level) + { + CampusBuildingLayerModel layer = this.building.Layers[level]; + this.RoomPicker.Items.Clear(); + + foreach (PlaceModel room in layer.Rooms.Places) + { + if(room.GetInformationsValue(Constants.PisInformationName_Typ).Equals(Constants.PisInformationValue_Entrance) == false) + { + if (room.GetInformationsValue(Constants.PisInformationName_Room).Equals(room.GetInformationsValue(Constants.PisInformationName_Name)) == false) + { + string newStr = room.GetInformationsValue(Constants.PisInformationName_Room) + ", " + room.GetInformationsValue(Constants.PisInformationName_Name); + this.RoomPicker.Items.Add(newStr); + } + else + { + this.RoomPicker.Items.Add(room.GetInformationsValue(Constants.PisInformationName_Room)); + } + } + } + } + #endregion + + /// Event handler. Called by RoomPicker for selection changed events. + /// Fiedler, 18.11.2013. + /// Source of the event. + /// Selection changed event information. + private void RoomPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + MapPoint pos = new MapPoint(); + + pos.X = room.GeoRefPoint.Longitude; + pos.Y = room.GeoRefPoint.Latitude; + MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y))); + MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint; + + MapCanvas.Children.Add(this.buildingMap.AddPin(pos, PinType.SearchPlace)); + } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 1defd00d..46d43bdd 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -1553,5 +1553,23 @@ namespace CampusAppWP8.Resources { return ResourceManager.GetString("When", resourceCulture); } } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Zoom + ähnelt. + /// + public static string ZoomIn { + get { + return ResourceManager.GetString("ZoomIn", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Zoom - ähnelt. + /// + public static string ZoomOut { + get { + return ResourceManager.GetString("ZoomOut", resourceCulture); + } + } } } diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 4d494990..37c797e4 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -617,4 +617,10 @@ Wochenplan + + Zoom + + + + Zoom - + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index a7a62d34..514a9671 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -609,4 +609,7 @@ http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1 + + Zugangsbereich + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs index ea41e3aa..be6e354f 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants1.Designer.cs @@ -1239,6 +1239,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Zugangsbereich ähnelt. + /// + public static string PisInformationValue_Entrance { + get { + return ResourceManager.GetString("PisInformationValue_Entrance", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die pid ähnelt. /// From 37460f155582045b069c0e5223d9c661eb446dd1 Mon Sep 17 00:00:00 2001 From: Christian Fiedler Date: Fri, 22 Nov 2013 20:57:17 +0100 Subject: [PATCH 2/2] #243 done --- CampusAppWP8/CampusAppWP8/App.xaml | 1 - CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 10 +- .../Pages/Campusmap/RoomListPage.xaml | 81 +++++--- .../Pages/Campusmap/RoomListPage.xaml.cs | 144 +++++++++++--- .../Pages/Openinghours/OpeninghoursPage.xaml | 6 +- .../Resources/AppResources.Designer.cs | 9 + .../CampusAppWP8/Resources/AppResources.resx | 4 + .../CampusAppWP8/Resources/Constants.resx | 1 + .../BoolToVisibilityConverter.cs | 2 +- .../FrameworkElementToRectConverter.cs | 28 +++ .../{ => Converter}/IdToPlaceConverter.cs | 2 +- .../{ => Converter}/MealIdToPriceConverter.cs | 2 +- .../Converter/RoomToStringConverter.cs | 67 +++++++ .../Utility/DoubleNaNConverter.cs | 22 --- .../Utility/Lui/MultiValueTextBlock.xaml | 5 - .../Utility/Lui/MultiValueTextBlock.xaml.cs | 178 ++++++++++++++++-- .../Utility/Lui/Templates/WeekView.xaml | 2 +- .../Utility/Lui/Templates/WeekViewDay.xaml | 4 +- .../Utility/Lui/Templates/WeekViewDay.xaml.cs | 1 + 19 files changed, 468 insertions(+), 101 deletions(-) rename CampusAppWP8/CampusAppWP8/Utility/{ => Converter}/BoolToVisibilityConverter.cs (97%) create mode 100644 CampusAppWP8/CampusAppWP8/Utility/Converter/FrameworkElementToRectConverter.cs rename CampusAppWP8/CampusAppWP8/Utility/{ => Converter}/IdToPlaceConverter.cs (99%) rename CampusAppWP8/CampusAppWP8/Utility/{ => Converter}/MealIdToPriceConverter.cs (98%) create mode 100644 CampusAppWP8/CampusAppWP8/Utility/Converter/RoomToStringConverter.cs delete mode 100644 CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs diff --git a/CampusAppWP8/CampusAppWP8/App.xaml b/CampusAppWP8/CampusAppWP8/App.xaml index 282eda77..a4aef1d3 100644 --- a/CampusAppWP8/CampusAppWP8/App.xaml +++ b/CampusAppWP8/CampusAppWP8/App.xaml @@ -16,7 +16,6 @@ - diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 14b52676..891e313e 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -155,7 +155,9 @@ TimeTableWeek.xaml - + + + @@ -239,9 +241,9 @@ - + - + @@ -266,7 +268,7 @@ WeekViewDay.xaml - + NFC.xaml diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml index 257cb480..04463450 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml @@ -10,6 +10,7 @@ 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}" @@ -18,6 +19,14 @@ shell:SystemTray.IsVisible="True" x:Name="root"> + + + + + + + + @@ -26,10 +35,13 @@ + + - + + @@ -48,30 +60,53 @@ Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"/> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs index 3bee41eb..6bcc3ac9 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs @@ -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 /// The offset point. private MapPoint offsetPoint; + /// The selected layer. private string selectedLayer = string.Empty; + /// List of room pickers. + private ObservableCollection roomPickerList = new ObservableCollection(); + /// The view bounds. + private Rect viewBounds = new Rect(); + + /// The marker pin. + private UIElement markerPin = null; + /// The canvas scale. + private double canvasScale = 1.0; + #endregion #region Constructor @@ -79,6 +91,8 @@ namespace CampusAppWP8.Pages.Campusmap #endregion + /// Gets or sets the selected layer. + /// The selected layer. private string SelectedLayer { get @@ -97,6 +111,21 @@ namespace CampusAppWP8.Pages.Campusmap } } + /// Gets or sets a list of room pickers. + /// A List of room pickers. + public ObservableCollection RoomPickerList + { + get + { + return this.roomPickerList; + } + + set + { + this.roomPickerList = value; + } + } + #region Method #region protected @@ -187,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 { room })); } @@ -337,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; @@ -392,9 +421,9 @@ 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); } /// Raises the system. event. @@ -447,8 +476,19 @@ namespace CampusAppWP8.Pages.Campusmap /// Event information. private void BtnZoomIn_Click(object sender, EventArgs e) { - (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(); } /// Event handler. Called by ZoomOut for tap events. @@ -457,8 +497,36 @@ namespace CampusAppWP8.Pages.Campusmap /// Event information. private void BtnZoomOut_Click(object sender, EventArgs e) { - (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(); } /// Searches for the first room. @@ -476,21 +544,13 @@ namespace CampusAppWP8.Pages.Campusmap private void UpdateRoomList(string level) { CampusBuildingLayerModel layer = this.building.Layers[level]; - this.RoomPicker.Items.Clear(); + this.roomPickerList.Clear(); foreach (PlaceModel room in layer.Rooms.Places) { if(room.GetInformationsValue(Constants.PisInformationName_Typ).Equals(Constants.PisInformationValue_Entrance) == false) { - if (room.GetInformationsValue(Constants.PisInformationName_Room).Equals(room.GetInformationsValue(Constants.PisInformationName_Name)) == false) - { - string newStr = room.GetInformationsValue(Constants.PisInformationName_Room) + ", " + room.GetInformationsValue(Constants.PisInformationName_Name); - this.RoomPicker.Items.Add(newStr); - } - else - { - this.RoomPicker.Items.Add(room.GetInformationsValue(Constants.PisInformationName_Room)); - } + this.roomPickerList.Add(room); } } } @@ -503,14 +563,48 @@ namespace CampusAppWP8.Pages.Campusmap /// Selection changed event information. private void RoomPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { - MapPoint pos = new MapPoint(); + 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); + } - pos.X = room.GeoRefPoint.Longitude; - pos.Y = room.GeoRefPoint.Latitude; - MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y))); - MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint; + 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; - MapCanvas.Children.Add(this.buildingMap.AddPin(pos, PinType.SearchPlace)); + this.markerPin = this.buildingMap.AddPin(viewPoint, PinType.InfoRedPlace); + + this.MapCanvas.Children.Add(this.markerPin); + } + } + + /// Event handler. Called by MapCanvas for size changed events. + /// Fiedler, 22.11.2013. + /// Source of the event. + /// Size changed event information. + private void MapCanvas_SizeChanged(object sender, SizeChangedEventArgs e) + { + this.ReCalcBounds(); + this.VPC.SetViewportOrigin(new Point(this.mappoint.X, this.mappoint.Y)); + } + + /// Re calculate bounds. + /// Fiedler, 22.11.2013. + 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); } } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml index f5e7f4bf..30588de8 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Openinghours/OpeninghoursPage.xaml @@ -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"> - - + + diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 0006ab52..47c3c85a 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -1158,6 +1158,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Räume ähnelt. + /// + public static string Rooms { + get { + return ResourceManager.GetString("Rooms", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Beispielwert für die Laufzeiteigenschaft ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 6201f774..b8452a9c 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -622,10 +622,14 @@ Zoom - + Termin erstellen Veranstaltungstermine + + Räume + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 01a020aa..bcad4e3a 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -611,6 +611,7 @@ Zugangsbereich + isolated diff --git a/CampusAppWP8/CampusAppWP8/Utility/BoolToVisibilityConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/BoolToVisibilityConverter.cs similarity index 97% rename from CampusAppWP8/CampusAppWP8/Utility/BoolToVisibilityConverter.cs rename to CampusAppWP8/CampusAppWP8/Utility/Converter/BoolToVisibilityConverter.cs index c8723978..8c7191a9 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/BoolToVisibilityConverter.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/BoolToVisibilityConverter.cs @@ -6,7 +6,7 @@ // 15.10.2013 // Implements to visibility converter class //----------------------------------------------------------------------- -namespace CampusAppWP8.Utility +namespace CampusAppWP8.Utility.Converter { using System; using System.Windows; diff --git a/CampusAppWP8/CampusAppWP8/Utility/Converter/FrameworkElementToRectConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/FrameworkElementToRectConverter.cs new file mode 100644 index 00000000..c3fd0f16 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/FrameworkElementToRectConverter.cs @@ -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; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/IdToPlaceConverter.cs similarity index 99% rename from CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs rename to CampusAppWP8/CampusAppWP8/Utility/Converter/IdToPlaceConverter.cs index 07a8dd99..243c1731 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/IdToPlaceConverter.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/IdToPlaceConverter.cs @@ -6,7 +6,7 @@ // 13.11.2013 // Implements the identifier to place converter class //----------------------------------------------------------------------- -namespace CampusAppWP8.Utility +namespace CampusAppWP8.Utility.Converter { using System; using System.Windows.Data; diff --git a/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/MealIdToPriceConverter.cs similarity index 98% rename from CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs rename to CampusAppWP8/CampusAppWP8/Utility/Converter/MealIdToPriceConverter.cs index 73caa561..d2e7e4b0 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/MealIdToPriceConverter.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/MealIdToPriceConverter.cs @@ -6,7 +6,7 @@ // 14.11.2013 // Implements the meal identifier to price converter class //----------------------------------------------------------------------- -namespace CampusAppWP8.Utility +namespace CampusAppWP8.Utility.Converter { using System; using System.Windows.Data; diff --git a/CampusAppWP8/CampusAppWP8/Utility/Converter/RoomToStringConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/Converter/RoomToStringConverter.cs new file mode 100644 index 00000000..9cca528a --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Converter/RoomToStringConverter.cs @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Fiedler +// 22.11.2013 +// Implements the room to string converter class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Converter +{ + using System; + using System.Collections.Generic; + using System.Windows.Data; + using CampusAppWP8.Resources; + using CampusAppWPortalLib8.Model.GeoDb; + + /// A room to string converter. + /// Fiedler, 22.11.2013. + /// + public sealed class RoomToStringConverter : IValueConverter + { + /// + /// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche. + /// + /// Fiedler, 22.11.2013. + /// + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo language) + { + string retValue = string.Empty; + + if (value.GetType().Equals(typeof(List))) + { + List list = value as List; + + 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; + } + + /// + /// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in + /// -Bindungen aufgerufen. + /// + /// Fiedler, 22.11.2013. + /// + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo language) + { + return null; + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs b/CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs deleted file mode 100644 index dc937c1a..00000000 --- a/CampusAppWP8/CampusAppWP8/Utility/DoubleNaNConverter.cs +++ /dev/null @@ -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; - } - } -} diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml index 747b8420..c7087f5b 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml @@ -9,10 +9,5 @@ Foreground="{StaticResource PhoneForegroundBrush}" > - \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs index 4d050d77..ef9e3484 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MultiValueTextBlock.xaml.cs @@ -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 /// public partial class MultiValueTextBlock : UserControl { + #region DependencyProperties + /// The value 1 property. - 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)); /// The value 2 property. - 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)); + /// The value 3 property. + public static readonly DependencyProperty Value_3_Property = DependencyProperty.Register("Value3", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 4 property. + public static readonly DependencyProperty Value_4_Property = DependencyProperty.Register("Value4", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 5 property. + public static readonly DependencyProperty Value_5_Property = DependencyProperty.Register("Value5", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 6 property. + public static readonly DependencyProperty Value_6_Property = DependencyProperty.Register("Value6", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 7 property. + public static readonly DependencyProperty Value_7_Property = DependencyProperty.Register("Value7", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + /// The value 8 property. + public static readonly DependencyProperty Value_8_Property = DependencyProperty.Register("Value8", typeof(object), typeof(MultiValueTextBlock), new PropertyMetadata(null)); + + /// The value list property. + public static readonly DependencyProperty Value_List_Property = DependencyProperty.Register("ValueList", typeof(List), typeof(MultiValueTextBlock), new PropertyMetadata(null)); /// The converter property. - 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 /// Initializes a new instance of the MultiValueTextBlock class. /// Fiedler, 14.11.2013. public MultiValueTextBlock() : base() { this.InitializeComponent(); + this.Loaded += this.OnLoaded; } + #endregion // Constructor + + #region Properties + /// Gets or sets the converter. /// The converter. public IValueConverter Converter @@ -77,18 +104,145 @@ namespace CampusAppWP8.Utility.Lui } } - /// Raises the dependency property changed event. - /// Fiedler, 14.11.2013. - /// The DependencyObject to process. - /// Event information to send to registered event handlers. - private static void OnLoaded(DependencyObject d, DependencyPropertyChangedEventArgs e) + /// Gets or sets the value 3. + /// The value 3. + 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); } } + + /// Gets or sets the value 4. + /// The value 4. + public object Value4 + { + get + { + return this.GetValue(Value_4_Property); + } + + set + { + this.SetValue(Value_4_Property, value); + } + } + + /// Gets or sets the value 5. + /// The value 5. + public object Value5 + { + get + { + return this.GetValue(Value_5_Property); + } + + set + { + this.SetValue(Value_5_Property, value); + } + } + + /// Gets or sets the value 6. + /// The value 6. + public object Value6 + { + get + { + return this.GetValue(Value_6_Property); + } + + set + { + this.SetValue(Value_6_Property, value); + } + } + + /// Gets or sets the value 7. + /// The value 7. + public object Value7 + { + get + { + return this.GetValue(Value_7_Property); + } + + set + { + this.SetValue(Value_7_Property, value); + } + } + + /// Gets or sets the value 8. + /// The value 8. + public object Value8 + { + get + { + return this.GetValue(Value_8_Property); + } + + set + { + this.SetValue(Value_8_Property, value); + } + } + + /// Gets or sets a list of values. + /// A List of values. + public object ValueList + { + get + { + return this.GetValue(Value_List_Property); + } + + set + { + this.SetValue(Value_List_Property, value); + } + } + + #endregion // Properties + + #region Methods + + /// Raises the routed event. + /// Fiedler, 22.11.2013. + /// Source of the event. + /// Event information to send to registered event handlers. + 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 valList = new List(); + + 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 } } diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml index a30baecb..3e102a12 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekView.xaml @@ -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}" diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml index a85ecd37..6cbe6cea 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml @@ -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 @@ > - + diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml.cs index 8327b81b..75d6c829 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Templates/WeekViewDay.xaml.cs @@ -24,6 +24,7 @@ namespace CampusAppWP8.Utility.Lui.Templates using System.Windows.Data; using CampusAppWP8.Model.TimeTable; using CampusAppWP8.Utility; + using CampusAppWP8.Utility.Converter; /// A week view day. /// Fiedler, 06.11.2013.