Merge branch 'feature/#201' into develop
This commit is contained in:
@@ -112,12 +112,15 @@
|
||||
<Compile Include="File\Exams\ExamFile.cs" />
|
||||
<Compile Include="File\Places\PlacesFile.cs" />
|
||||
<Compile Include="Model\BinaryModel.cs" />
|
||||
<Compile Include="Model\Campusmap\CampusMapModel.cs" />
|
||||
<Compile Include="Model\Campusmap\CBMainMapModel.cs" />
|
||||
<Compile Include="Model\Campusmap\CurrentPositionPinModel.cs" />
|
||||
<Compile Include="Model\Campusmap\HiddenPinPlaceModel.cs" />
|
||||
<Compile Include="Model\Campusmap\SearchPlacePinModel.cs" />
|
||||
<Compile Include="Model\Exams\ExamListModel.cs" />
|
||||
<Compile Include="Model\Exams\ExamModel.cs" />
|
||||
<Compile Include="Model\GeoDb\CampusBuildingLayerModel.cs" />
|
||||
<Compile Include="Model\GeoDb\CampusBuildingModel.cs" />
|
||||
<Compile Include="Model\GeoDb\PlaceInformation.cs" />
|
||||
<Compile Include="Model\GeoDb\PlaceModel.cs" />
|
||||
<Compile Include="Model\GeoDb\PlaceService.cs" />
|
||||
@@ -131,6 +134,9 @@
|
||||
<Compile Include="Model\Utility\CourseModel.cs" />
|
||||
<Compile Include="Model\Utility\DegreeListPickerItemListModel.cs" />
|
||||
<Compile Include="Model\Utility\CampusListPickerItemListModel.cs" />
|
||||
<Compile Include="Pages\Campusmap\RoomListPage.xaml.cs">
|
||||
<DependentUpon>RoomListPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Exams\Exams.xaml.cs">
|
||||
<DependentUpon>Exams.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -143,6 +149,11 @@
|
||||
<Compile Include="Pages\PlaceNews\ShowPad.xaml.cs">
|
||||
<DependentUpon>ShowPad.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Resources\Constants1.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Constants.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\BackgroundTasks.cs" />
|
||||
<Compile Include="Utility\Lui\Button\AddPersonButton.cs" />
|
||||
<Compile Include="Utility\Lui\Tiles\TileCreator.cs" />
|
||||
@@ -262,11 +273,6 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>AppResources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Resources\Constants.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Constants.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ThemelizedIcons.cs" />
|
||||
<Compile Include="Utility\File.cs" />
|
||||
<Compile Include="Utility\HttpRequest.cs" />
|
||||
@@ -294,6 +300,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Campusmap\RoomListPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Departments\DepartmentFavoritePage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -519,8 +529,8 @@
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Constants.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Constants.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
<LastGenOutput>Constants1.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Resources\Icons.resx">
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -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
|
||||
@@ -15,7 +15,7 @@ namespace CampusAppWP8.Model.Campusmap
|
||||
/// <summary>
|
||||
/// Class for the MapModel of the mainCampus of cottbus
|
||||
/// </summary>
|
||||
public class CBMainMapModel : MapModel
|
||||
public class CBMainMapModel : CampusMapModel
|
||||
{
|
||||
#region Member
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace CampusAppWP8.Model.Campusmap
|
||||
this.ScaleY = 197648.8919266073;
|
||||
this.GeoOffsetX = 14.327159;
|
||||
this.GeoOffsetY = 51.766548;
|
||||
this.CampusId = CBMainMapModel.Campus;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
13
CampusAppWP8/CampusAppWP8/Model/Campusmap/CampusMapModel.cs
Normal file
13
CampusAppWP8/CampusAppWP8/Model/Campusmap/CampusMapModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CampusAppWP8.Model.Campusmap
|
||||
{
|
||||
public class CampusMapModel : MapModel
|
||||
{
|
||||
public string CampusId { get; protected set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <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 SpsModel();
|
||||
|
||||
foreach (PlaceModel place in places)
|
||||
{
|
||||
string placeLayerId = place.GetInformationsValue(Constants.PisInformationName_Layer);
|
||||
if (placeLayerId != null && placeLayerId.Equals(layerId))
|
||||
{
|
||||
this.Rooms.Places.Add(place);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
96
CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs
Normal file
96
CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <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>();
|
||||
|
||||
foreach (PlaceModel place in places)
|
||||
{
|
||||
if (place.ParentId.Equals(buildingId))
|
||||
{
|
||||
string placeLayerId = place.GetInformationsValue(Constants.PisInformationName_Layer);
|
||||
if (placeLayerId == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.Layers.ContainsKey(placeLayerId))
|
||||
{
|
||||
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))
|
||||
{
|
||||
this.Building = place;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
@@ -11,10 +11,11 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
using System.Collections.Generic;
|
||||
using System.Device.Location;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
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;
|
||||
@@ -35,7 +36,7 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
private readonly ProximityDevice device = ProximityDevice.GetDefault();
|
||||
|
||||
/// <summary>Variable for the map model.</summary>
|
||||
private MapModel map;
|
||||
private CampusMapModel campusMap;
|
||||
|
||||
/// <summary>
|
||||
/// List of information names
|
||||
@@ -56,9 +57,9 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
public CampusMapPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.map = new CBMainMapModel();
|
||||
this.MapCanvas.DataContext = this.map;
|
||||
this.map.ShowMapInfos += new CBMainMapModel.MapInfos(this.ShowMapInfo);
|
||||
this.campusMap = new CBMainMapModel();
|
||||
this.MapCanvas.DataContext = this.campusMap;
|
||||
this.campusMap.ShowMapInfos += new CBMainMapModel.MapInfos(this.ShowMapInfo);
|
||||
|
||||
ApplicationBarMenuItem menuItem1 = ApplicationBar.MenuItems[0] as ApplicationBarMenuItem;
|
||||
ApplicationBarMenuItem menuItem2 = ApplicationBar.MenuItems[1] as ApplicationBarMenuItem;
|
||||
@@ -86,7 +87,7 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
if (this.map.Spatial == null)
|
||||
if (this.campusMap.Spatial == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -134,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)
|
||||
@@ -153,13 +154,13 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
|
||||
foreach (string pid in pidList)
|
||||
{
|
||||
tmpPlace = this.map.Spatial.GetPlaceById(pid);
|
||||
tmpPlace = this.campusMap.Spatial.GetPlaceById(pid);
|
||||
if (tmpPlace != null)
|
||||
{
|
||||
placeList.Add(tmpPlace);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// add pins to map
|
||||
if (placeList.Count > 0)
|
||||
{
|
||||
@@ -236,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);
|
||||
}
|
||||
@@ -246,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;
|
||||
}
|
||||
@@ -276,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>();
|
||||
@@ -284,7 +291,7 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
this.informationsNames.Add(Constants.PisInformationName_ShortName);
|
||||
}
|
||||
|
||||
return this.map.Spatial.GetPlacesByInformation(query, true, this.informationsNames);
|
||||
return this.campusMap.Spatial.GetPlacesByInformation(query, true, this.informationsNames);
|
||||
}
|
||||
|
||||
/// <summary>Adds the pins.</summary>
|
||||
@@ -315,8 +322,8 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
/// <param name="assocPlaces">(Optional) List of places, whose are associative with the pin</param>
|
||||
private void AddPin(double x, double y, MapPinModel.PinType type, bool scroll = true, List<PlaceModel> assocPlaces = null)
|
||||
{
|
||||
Point scrollPoint = this.map.GetScrollPoint(this.map.ConverToPixelPoint(this.map.ConverToMapPoint(x, y)));
|
||||
MapCanvas.Children.Add(this.map.AddPinFromRefPoint(this.map.ConverToPixelPoint(this.map.ConverToMapPoint(x, y)), type, assocPlaces));
|
||||
Point scrollPoint = this.campusMap.GetScrollPoint(this.campusMap.ConverToPixelPoint(this.campusMap.ConverToMapPoint(x, y)));
|
||||
MapCanvas.Children.Add(this.campusMap.AddPinFromRefPoint(this.campusMap.ConverToPixelPoint(this.campusMap.ConverToMapPoint(x, y)), type, assocPlaces));
|
||||
|
||||
MapScroller.UpdateLayout();
|
||||
if (scroll)
|
||||
@@ -432,12 +439,56 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
msgText += AppResources.PlaceLabel_Name + ": ";
|
||||
msgText += place.GetInformationsValue(Constants.PisInformationName_Name);
|
||||
msgText = Wp8StringManager.AddNewLine(msgText);
|
||||
msgText += AppResources.PlaceLabel_ShortDesc + ": ";
|
||||
msgText += place.GetInformationsValue(Constants.PisInformationName_ShortDesc);
|
||||
msgText = Wp8StringManager.AddNewLine(msgText);
|
||||
|
||||
string shortDesc = place.GetInformationsValue(Constants.PisInformationName_ShortDesc);
|
||||
if (shortDesc == null)
|
||||
{
|
||||
shortDesc = place.GetInformationsValue(Constants.PisInformationName_Typ);
|
||||
}
|
||||
|
||||
if (shortDesc != null)
|
||||
{
|
||||
msgText += AppResources.PlaceLabel_ShortDesc + ": ";
|
||||
msgText += shortDesc;
|
||||
msgText = Wp8StringManager.AddNewLine(msgText);
|
||||
}
|
||||
}
|
||||
|
||||
MessageBoxes.ShowMainModelInfoMessageBox(msgText);
|
||||
|
||||
foreach (PlaceModel place in places)
|
||||
{
|
||||
|
||||
if (place.ParentId.Equals(this.campusMap.CampusId) && this.HasRooms(place.PlaceId))
|
||||
{
|
||||
MessageBoxResult msgResult = MessageBoxes.ShowPlaceInfoOkCancelMessageBox("Für " + place.GetInformationsValue((Constants.PisInformationName_Name)) + " gibt es eine Raumübersicht. Soll diese angezeigt werden");
|
||||
if (msgResult.Equals(MessageBoxResult.OK))
|
||||
{
|
||||
string urlString = Constants.PathCampusmap_RoomListPage;
|
||||
urlString += "?" + Constants.ParamBuildingId+ "=" + place.PlaceId;
|
||||
Uri url = new Uri(urlString as string, UriKind.Relative);
|
||||
this.NavigationService.Navigate(url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if a certain place has some rooms
|
||||
/// </summary>
|
||||
/// <param name="placeId">the place id</param>
|
||||
/// <returns>true, if the place has got rooms, otherwise false</returns>
|
||||
private bool HasRooms(string placeId)
|
||||
{
|
||||
foreach (PlaceModel place in this.campusMap.Spatial.Places)
|
||||
{
|
||||
if (place.ParentId.Equals(placeId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
48
CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml
Normal file
48
CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml
Normal file
@@ -0,0 +1,48 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.Pages.Campusmap.RoomListPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
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}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<!--Pivotsteuerelement-->
|
||||
<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>
|
||||
162
CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs
Normal file
162
CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs
Normal file
@@ -0,0 +1,162 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// <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;
|
||||
using CampusAppWP8.Utility.Lui.MessageBoxes;
|
||||
|
||||
/// <summary>
|
||||
/// Class of the RoomListPage
|
||||
/// </summary>
|
||||
public partial class RoomListPage : PhoneApplicationPage
|
||||
{
|
||||
#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()
|
||||
{
|
||||
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 (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();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region private
|
||||
/// <summary>
|
||||
/// Callback of the PlaceFile, if load failed
|
||||
/// </summary>
|
||||
private void PlacesFileIsFail()
|
||||
{
|
||||
MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoad);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback of the PlaceFile, if load was successful
|
||||
/// </summary>
|
||||
private void PlacesFileIsReady()
|
||||
{
|
||||
if (this.placeFile.Model != null)
|
||||
{
|
||||
this.SetupPivot();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method setup the PivotElement
|
||||
/// </summary>
|
||||
private void SetupPivot()
|
||||
{
|
||||
if (NavigationContext.QueryString.ContainsKey(Constants.ParamBuildingId))
|
||||
{
|
||||
this.building = new CampusBuildingModel(NavigationContext.QueryString[Constants.ParamBuildingId], 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoad);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoad);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <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>
|
||||
|
||||
@@ -525,4 +525,13 @@
|
||||
<data name="NCFMessageType_NDEF" xml:space="preserve">
|
||||
<value>NDEF</value>
|
||||
</data>
|
||||
<data name="ParamBuildingId" xml:space="preserve">
|
||||
<value>BuildingId</value>
|
||||
</data>
|
||||
<data name="PathCampusmap_RoomListPage" xml:space="preserve">
|
||||
<value>/Pages/Campusmap/RoomListPage.xaml</value>
|
||||
</data>
|
||||
<data name="PisInformationName_Layer" xml:space="preserve">
|
||||
<value>Ebene</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -573,6 +573,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die BuildingId ähnelt.
|
||||
/// </summary>
|
||||
public static string ParamBuildingId {
|
||||
get {
|
||||
return ResourceManager.GetString("ParamBuildingId", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt.
|
||||
/// </summary>
|
||||
@@ -699,6 +708,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Campusmap/RoomListPage.xaml ähnelt.
|
||||
/// </summary>
|
||||
public static string PathCampusmap_RoomListPage {
|
||||
get {
|
||||
return ResourceManager.GetString("PathCampusmap_RoomListPage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Departments/DepartmentFavoritePage.xaml ähnelt.
|
||||
/// </summary>
|
||||
@@ -942,6 +960,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>
|
||||
@@ -54,6 +54,15 @@ namespace CampusAppWP8.Utility.Lui.MessageBoxes
|
||||
return MessageBox.Show(text, AppResources.MsgBox_PlaceInfoHeader, MessageBoxButton.OK);
|
||||
}
|
||||
|
||||
/// <summary>Shows the place information message box (OKCancel-Box).</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
/// <param name="text">custom text for the box.</param>
|
||||
/// <returns>result of the UserInteraction</returns>
|
||||
public static MessageBoxResult ShowPlaceInfoOkCancelMessageBox(string text)
|
||||
{
|
||||
return MessageBox.Show(text, AppResources.MsgBox_PlaceInfoHeader, MessageBoxButton.OKCancel);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace CampusAppWP8.Utility
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue.AddRange(GetChild(child as DependencyObject, elemName));
|
||||
retValue.AddRange(Utilities.GetChild(child as DependencyObject, elemName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user