add roomlist
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// <copyright file="CBMainMapModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>fiedlchr</author>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>13.08.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Campusmap
|
||||
|
||||
@@ -1,30 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="CampusBuildingLayerModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>23.09.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.GeoDb
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Class is model for buildings of a campus
|
||||
/// </summary>
|
||||
public class CampusBuildingLayerModel
|
||||
{
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CampusBuildingLayerModel" /> class.
|
||||
/// </summary>
|
||||
/// <param name="layerId">id of the layer</param>
|
||||
/// <param name="places">list of place which can be room of the layer</param>
|
||||
public CampusBuildingLayerModel(string layerId, List<PlaceModel> places)
|
||||
{
|
||||
this.LayerId = layerId;
|
||||
this.Rooms = new List<PlaceModel>();
|
||||
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<PlaceModel> Rooms {get; set;}
|
||||
|
||||
#endregion
|
||||
|
||||
#region property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets Rooms
|
||||
/// </summary>
|
||||
public SpsModel Rooms { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets LayerId
|
||||
/// </summary>
|
||||
public string LayerId { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="CampusBuildingModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>23.09.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Model.GeoDb
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Class is model for buildings of a campus
|
||||
/// </summary>
|
||||
public class CampusBuildingModel
|
||||
{
|
||||
#region constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CampusBuildingModel" /> class.
|
||||
/// </summary>
|
||||
/// <param name="buildingId">id of the building</param>
|
||||
/// <param name="places">list of place which can be room of the buildings</param>
|
||||
public CampusBuildingModel(string buildingId, List<PlaceModel> places)
|
||||
{
|
||||
this.Layers = new Dictionary<string, CampusBuildingLayerModel>();
|
||||
@@ -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<PlaceModel>() { place }));
|
||||
}
|
||||
|
||||
}
|
||||
else if (place.PlaceId.Equals(buildingId))
|
||||
{
|
||||
@@ -39,8 +52,45 @@ namespace CampusAppWP8.Model.GeoDb
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Layer of the building
|
||||
/// </summary>
|
||||
public Dictionary<string, CampusBuildingLayerModel> Layers { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Building PlaceModel
|
||||
/// </summary>
|
||||
public PlaceModel Building { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region method
|
||||
|
||||
/// <summary>
|
||||
/// Method gets a place by their placeID
|
||||
/// </summary>
|
||||
/// <param name="placeID">the placeId of the place</param>
|
||||
/// <returns>The place by identifier.</returns>
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,11 @@ namespace CampusAppWP8.Model.GeoDb
|
||||
[XmlElement("placeService")]
|
||||
public ObservableCollection<PlaceService> Services { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a string, which is the caption of the place (e.g. for contents of UIElements)
|
||||
/// </summary>
|
||||
public string Caption { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
@@ -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
|
||||
/// <param name="pidList">list of placeId</param>
|
||||
/// <param name="pinType">type of pin</param>
|
||||
/// <param name="clearCanvas">(optional) if its true, clear canvas before adding</param>
|
||||
private void AddPinsByPids(List<string> pidList, MapPinModel.PinType pinType, bool clearCanvas = true)
|
||||
private void AddPinsByPids(List<string> 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
|
||||
/// <returns>The found places.</returns>
|
||||
private List<PlaceModel> SearchPlaces(string query)
|
||||
{
|
||||
// if query is an id
|
||||
if (Wp8StringManager.IsDigitsOnly(query))
|
||||
{
|
||||
return new List<PlaceModel>() { this.campusMap.Spatial.GetPlaceById(query) };
|
||||
}
|
||||
|
||||
if (this.informationsNames == null)
|
||||
{
|
||||
this.informationsNames = new List<string>();
|
||||
@@ -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
|
||||
|
||||
@@ -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 @@
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<!--Pivotsteuerelement-->
|
||||
<phone:Pivot Title="{Binding LocalizedResources.CampusMapApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}">
|
||||
<!--Pivotelement eins-->
|
||||
<phone:PivotItem Header="item1">
|
||||
<Grid/>
|
||||
</phone:PivotItem>
|
||||
|
||||
<!--Pivotelement zwei-->
|
||||
<phone:PivotItem Header="item2">
|
||||
<Grid/>
|
||||
</phone:PivotItem>
|
||||
<phone:Pivot Name="RoomPivot" Title="{Binding LocalizedResources.CampusMapApp_Title, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Key}" />
|
||||
</DataTemplate>
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox ItemsSource="{Binding Value.Rooms.Places}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<lui:GoToMapButton SearchTerm="{Binding PlaceId}" Style="{StaticResource ListButtonStyle}">
|
||||
<TextBlock Text="{Binding Caption}"/>
|
||||
</lui:GoToMapButton>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -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;
|
||||
//-----------------------------------------------------------------------------
|
||||
// <copyright file="RoomListPage.xaml.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>23.09.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Class of the RoomListPage
|
||||
/// </summary>
|
||||
public partial class RoomListPage : PhoneApplicationPage
|
||||
{
|
||||
private PlacesFile placeFile;
|
||||
#region Members
|
||||
/// <summary>
|
||||
/// Variable of placeFile
|
||||
/// </summary>
|
||||
private PlacesFile placeFile;
|
||||
|
||||
/// <summary>
|
||||
/// Variable of building which is shown in the list
|
||||
/// </summary>
|
||||
private CampusBuildingModel building;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="RoomListPage" /> class.</summary>
|
||||
/// <remarks>Stubbfel, 19.08.2013.</remarks>
|
||||
public RoomListPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region protected
|
||||
|
||||
/// <summary>Methods overrides the OnNavigatedTo-Method.</summary>
|
||||
/// <remarks>Stubbfel, 19.08.2013.</remarks>
|
||||
/// <param name="e">some NavigationEventArgs.</param>
|
||||
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
|
||||
/// <summary>
|
||||
/// Callback of the PlaceFile, if load failed
|
||||
/// </summary>
|
||||
private void PlacesFileIsFail()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback of the PlaceFile, if load was successful
|
||||
/// </summary>
|
||||
private void PlacesFileIsReady()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (this.placeFile.Model != null)
|
||||
{
|
||||
this.SetupPivot();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupPivot()
|
||||
/// <summary>
|
||||
/// Method setup the PivotElement
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method sorts the Layers
|
||||
/// </summary>
|
||||
/// <param name="build"> building of the layers </param>
|
||||
/// <returns>sorted Dictionary</returns>
|
||||
private Dictionary<string, CampusBuildingLayerModel> GetSortedLayers(CampusBuildingModel build)
|
||||
{
|
||||
Dictionary<string, CampusBuildingLayerModel> result = new Dictionary<string, CampusBuildingLayerModel>();
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method set all rooms a formatted string , which will be show as buttonContent
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -418,7 +418,6 @@ namespace CampusAppWP8.Pages.PlaceNews
|
||||
txt.Text = place.GetInformationsValue(Constants.PisInformationName_Name);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Handler, called when the ndef.</summary>
|
||||
/// <remarks>Stubbfel, 22.08.2013.</remarks>
|
||||
/// <param name="sender"> The sender.</param>
|
||||
|
||||
@@ -942,6 +942,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Ebene ähnelt.
|
||||
/// </summary>
|
||||
public static string PisInformationName_Layer {
|
||||
get {
|
||||
return ResourceManager.GetString("PisInformationName_Layer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Name ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -525,4 +525,7 @@
|
||||
<data name="NCFMessageType_NDEF" xml:space="preserve">
|
||||
<value>NDEF</value>
|
||||
</data>
|
||||
<data name="PisInformationName_Layer" xml:space="preserve">
|
||||
<value>Ebene</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user