diff --git a/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs b/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs index 73e1c75f..95552f47 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs @@ -2,7 +2,7 @@ // // Company copyright tag. // -// fiedlchr +// stubbfel // 13.08.2013 //----------------------------------------------------------------------------- namespace CampusAppWP8.Model.Campusmap diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerModel.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerModel.cs index 2ff5f882..32307073 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerModel.cs @@ -1,30 +1,57 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 23.09.2013 +//----------------------------------------------------------------------------- namespace CampusAppWP8.Model.GeoDb { + using System.Collections.Generic; + using CampusAppWP8.Resources; + + /// + /// Class is model for buildings of a campus + /// public class CampusBuildingLayerModel { + #region Constructor + /// + /// Initializes a new instance of the class. + /// + /// id of the layer + /// list of place which can be room of the layer public CampusBuildingLayerModel(string layerId, List places) { this.LayerId = layerId; - this.Rooms = new List(); + this.Rooms = new SpsModel(); foreach (PlaceModel place in places) { - string placeLayerId = place.GetInformationsValue("Ebene"); + string placeLayerId = place.GetInformationsValue(Constants.PisInformationName_Layer); if (placeLayerId != null && placeLayerId.Equals(layerId)) { - this.Rooms.Add(place); + this.Rooms.Places.Add(place); } } } - public List Rooms {get; set;} + #endregion + + #region property + + /// + /// Gets or sets Rooms + /// + public SpsModel Rooms { get; set; } + + /// + /// Gets or sets LayerId + /// public string LayerId { get; set; } + + #endregion } } diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs index a3240341..fc31223a 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs @@ -1,14 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 23.09.2013 +//----------------------------------------------------------------------------- namespace CampusAppWP8.Model.GeoDb { + using System.Collections.Generic; + using CampusAppWP8.Resources; + + /// + /// Class is model for buildings of a campus + /// public class CampusBuildingModel { + #region constructor + /// + /// Initializes a new instance of the class. + /// + /// id of the building + /// list of place which can be room of the buildings public CampusBuildingModel(string buildingId, List places) { this.Layers = new Dictionary(); @@ -17,7 +31,7 @@ namespace CampusAppWP8.Model.GeoDb { if (place.ParentId.Equals(buildingId)) { - string placeLayerId = place.GetInformationsValue("Ebene"); + string placeLayerId = place.GetInformationsValue(Constants.PisInformationName_Layer); if (placeLayerId == null) { continue; @@ -25,13 +39,12 @@ namespace CampusAppWP8.Model.GeoDb if (this.Layers.ContainsKey(placeLayerId)) { - this.Layers[placeLayerId].Rooms.Add(place); + this.Layers[placeLayerId].Rooms.Places.Add(place); } else { this.Layers.Add(placeLayerId, new CampusBuildingLayerModel(placeLayerId, new List() { place })); } - } else if (place.PlaceId.Equals(buildingId)) { @@ -39,8 +52,45 @@ namespace CampusAppWP8.Model.GeoDb } } } + + #endregion + + #region Property + + /// + /// Gets the Layer of the building + /// public Dictionary Layers { get; private set; } + /// + /// Gets or sets the Building PlaceModel + /// public PlaceModel Building { get; set; } + + #endregion + + #region method + + /// + /// Method gets a place by their placeID + /// + /// the placeId of the place + /// The place by identifier. + public PlaceModel GetPlaceById(string placeID) + { + PlaceModel result = null; + foreach (CampusBuildingLayerModel layer in this.Layers.Values) + { + result = layer.Rooms.GetPlaceById(placeID); + if (result != null) + { + break; + } + } + + return result; + } + + #endregion } } diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs index 799b0757..3d2ecfe4 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs @@ -87,6 +87,11 @@ namespace CampusAppWP8.Model.GeoDb [XmlElement("placeService")] public ObservableCollection Services { get; set; } + /// + /// Gets or sets a string, which is the caption of the place (e.g. for contents of UIElements) + /// + public string Caption { get; set; } + #endregion #region Method diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs index 8f698f63..54b1821d 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs @@ -15,7 +15,7 @@ namespace CampusAppWP8.Pages.Campusmap using System.Runtime.InteropServices.WindowsRuntime; using System.Threading; using System.Windows; - using System.Windows.Navigation; + using System.Windows.Navigation; using CampusAppWP8.Model.Campusmap; using CampusAppWP8.Model.GeoDb; using CampusAppWP8.Resources; @@ -135,7 +135,7 @@ namespace CampusAppWP8.Pages.Campusmap /// list of placeId /// type of pin /// (optional) if its true, clear canvas before adding - private void AddPinsByPids(List pidList, MapPinModel.PinType pinType, bool clearCanvas = true) + private void AddPinsByPids(List pidList, MapPinModel.PinType pinType, bool clearCanvas = true) { // clear canvas if (clearCanvas) @@ -160,7 +160,7 @@ namespace CampusAppWP8.Pages.Campusmap placeList.Add(tmpPlace); } } - + // add pins to map if (placeList.Count > 0) { @@ -237,8 +237,8 @@ namespace CampusAppWP8.Pages.Campusmap if (this.Dispatcher != null) { this.Dispatcher.BeginInvoke(new Action(() => MessageBoxes.ShowMainModelErrorMessageBox(AppResources.ScarNfc_Fail))); - } - else + } + else { MessageBoxes.ShowMainModelErrorMessageBox(AppResources.ScarNfc_Fail); } @@ -247,8 +247,8 @@ namespace CampusAppWP8.Pages.Campusmap if (this.Dispatcher != null) { this.Dispatcher.BeginInvoke(new Action(() => this.ProgressBar.Visibility = Visibility.Collapsed)); - } - else + } + else { this.ProgressBar.Visibility = Visibility.Collapsed; } @@ -277,6 +277,12 @@ namespace CampusAppWP8.Pages.Campusmap /// The found places. private List SearchPlaces(string query) { + // if query is an id + if (Wp8StringManager.IsDigitsOnly(query)) + { + return new List() { this.campusMap.Spatial.GetPlaceById(query) }; + } + if (this.informationsNames == null) { this.informationsNames = new List(); @@ -439,13 +445,22 @@ namespace CampusAppWP8.Pages.Campusmap if (place.ParentId.Equals(this.campusMap.CampusId)) { - CampusBuildingModel biulding = new CampusBuildingModel(place.PlaceId, campusMap.Spatial.Places.ToList()); + CampusBuildingModel biulding = new CampusBuildingModel(place.PlaceId, this.campusMap.Spatial.Places.ToList()); } } MessageBoxes.ShowMainModelInfoMessageBox(msgText); } + private bool HasRooms(string placeId) + { + foreach (PlaceModel place in this.campusMap.Spatial.Places) + { + + } + return false; + } + #endregion #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml index dee25795..be326965 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml @@ -6,6 +6,7 @@ xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" @@ -16,17 +17,32 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + \ 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 a3aac555..c4f07298 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs @@ -1,54 +1,148 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Navigation; -using Microsoft.Phone.Controls; -using Microsoft.Phone.Shell; -using CampusAppWP8.File.Places; +//----------------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 23.09.2013 +//----------------------------------------------------------------------------- namespace CampusAppWP8.Pages.Campusmap { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Windows.Navigation; + using CampusAppWP8.File.Places; + using CampusAppWP8.Model.GeoDb; + using CampusAppWP8.Resources; + using Microsoft.Phone.Controls; + + /// + /// Class of the RoomListPage + /// public partial class RoomListPage : PhoneApplicationPage { - private PlacesFile placeFile; + #region Members + /// + /// Variable of placeFile + /// + private PlacesFile placeFile; + /// + /// Variable of building which is shown in the list + /// + private CampusBuildingModel building; + + #endregion + + #region Constructor + + /// Initializes a new instance of the class. + /// Stubbfel, 19.08.2013. public RoomListPage() { - InitializeComponent(); + this.InitializeComponent(); } + #endregion + + #region Method + + #region protected + + /// Methods overrides the OnNavigatedTo-Method. + /// Stubbfel, 19.08.2013. + /// some NavigationEventArgs. protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); - - if (NavigationMode.Back == e.NavigationMode) + if (this.placeFile == null) { - if (this.placeFile == null) - { - this.placeFile = new PlacesFile(); - this.placeFile.OnLoaded += new PlacesFile.OnIO(this.PlacesFileIsReady); - this.placeFile.OnFailedLoad += new PlacesFile.OnFailed(this.PlacesFileIsFail); - this.placeFile.LoadData(); - } + this.placeFile = new PlacesFile(); + this.placeFile.OnLoaded += new PlacesFile.OnIO(this.PlacesFileIsReady); + this.placeFile.OnFailedLoad += new PlacesFile.OnFailed(this.PlacesFileIsFail); + this.placeFile.LoadData(); } } + #endregion + + #region private + /// + /// Callback of the PlaceFile, if load failed + /// private void PlacesFileIsFail() { throw new NotImplementedException(); } + /// + /// Callback of the PlaceFile, if load was successful + /// private void PlacesFileIsReady() { - throw new NotImplementedException(); + if (this.placeFile.Model != null) + { + this.SetupPivot(); + } } - private void setupPivot() + /// + /// Method setup the PivotElement + /// + private void SetupPivot() { + this.building = new CampusBuildingModel("122", this.placeFile.Model.Places.ToList()); + if (this.building != null && this.building.Layers != null && this.building.Layers.Count > 0) + { + this.SetCaptionsToRooms(); + this.RoomPivot.ItemsSource = this.GetSortedLayers(this.building); + } } + + /// + /// Method sorts the Layers + /// + /// building of the layers + /// sorted Dictionary + private Dictionary GetSortedLayers(CampusBuildingModel build) + { + Dictionary result = new Dictionary(); + foreach (CampusBuildingLayerModel layer in build.Layers.Values) + { + var sortRom = from place in layer.Rooms.Places + orderby place.GetInformationsValue(Constants.PisInformationName_Typ), place.GetInformationsValue(Constants.PisInformationName_Name) + select place; + result.Add(layer.LayerId, new CampusBuildingLayerModel(layer.LayerId, sortRom.ToList())); + } + + return result; + } + + /// + /// Method set all rooms a formatted string , which will be show as buttonContent + /// + private void SetCaptionsToRooms() + { + string name; + string type; + foreach (CampusBuildingLayerModel layer in this.building.Layers.Values) + { + foreach (PlaceModel place in layer.Rooms.Places) + { + name = place.GetInformationsValue(Constants.PisInformationName_Name); + type = place.GetInformationsValue(Constants.PisInformationName_Typ); + if (name != null && type != null) + { + place.Caption = name + " (" + type + ")"; + } + } + } + } + + #endregion + + #endregion } } \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs index 6ad59c34..e4a529f5 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs @@ -418,7 +418,6 @@ namespace CampusAppWP8.Pages.PlaceNews txt.Text = place.GetInformationsValue(Constants.PisInformationName_Name); } - /// Handler, called when the ndef. /// Stubbfel, 22.08.2013. /// The sender. diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs index 4595325a..ea462b32 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs @@ -942,6 +942,15 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Ebene ähnelt. + /// + public static string PisInformationName_Layer { + get { + return ResourceManager.GetString("PisInformationName_Layer", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Name ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx index 09dd5d5f..ea026675 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx @@ -525,4 +525,7 @@ NDEF + + Ebene + \ No newline at end of file