extend campusmap

This commit is contained in:
stubbfel
2013-09-24 16:21:26 +02:00
parent b075e5bb7e
commit 5c1891459b
14 changed files with 443 additions and 114 deletions

View File

@@ -114,8 +114,10 @@
<Compile Include="Model\BinaryModel.cs" />
<Compile Include="Model\Campusmap\CampusMapModel.cs" />
<Compile Include="Model\Campusmap\CBMainMapModel.cs" />
<Compile Include="Model\Campusmap\ClickAblePlacePinModel.cs" />
<Compile Include="Model\Campusmap\CurrentPositionPinModel.cs" />
<Compile Include="Model\Campusmap\HiddenPinPlaceModel.cs" />
<Compile Include="Model\Campusmap\InfoPlacePinModel.cs" />
<Compile Include="Model\Campusmap\SearchPlacePinModel.cs" />
<Compile Include="Model\Exams\ExamListModel.cs" />
<Compile Include="Model\Exams\ExamModel.cs" />

View File

@@ -51,7 +51,7 @@ namespace CampusAppWP8.File.Places
/// <summary>
/// Method load OfflineMap as Fallback
/// </summary>
private void FallBackLoad()
public void FallBackLoad()
{
SpsModel fallBackModel = XmlManager.DeserializationFileToModel<SpsModel>(Constants.FileMap_OfflineMap);
this.Model = fallBackModel;

View File

@@ -11,6 +11,7 @@ namespace CampusAppWP8.Model.Campusmap
using CampusAppWP8.File.Places;
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Resources;
using System.Collections.Generic;
/// <summary>
/// Class for the MapModel of the mainCampus of cottbus
@@ -29,7 +30,7 @@ namespace CampusAppWP8.Model.Campusmap
/// <summary>
/// Initializes a new instance of the <see cref="CBMainMapModel" /> class.
/// </summary>
public CBMainMapModel()
public CBMainMapModel(List<PlaceModel> placeList) : base (placeList,CBMainMapModel.Campus)
{
this.ImageSource = Constants.FileMap_CBMainMap;
this.ImageWidth = 2000;
@@ -41,19 +42,11 @@ namespace CampusAppWP8.Model.Campusmap
this.ScaleY = 197648.8919266073;
this.GeoOffsetX = 14.327159;
this.GeoOffsetY = 51.766548;
this.CampusId = CBMainMapModel.Campus;
}
#endregion
#region Method
/// <summary>Loads the spatial./.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
protected override void LoadSpatials()
{
}
#region Method
#endregion
}

View File

@@ -1,4 +1,5 @@
using System;
using CampusAppWP8.Model.GeoDb;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,6 +9,32 @@ namespace CampusAppWP8.Model.Campusmap
{
public class CampusMapModel : MapModel
{
public string CampusId { get; protected set; }
public CampusMapModel(List<PlaceModel> placeList,string campusId)
{
this.CampusId = campusId;
this.LoadSpatials(placeList);
this.IsReady = true;
}
/// <summary>Loads the spatial./.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
protected override void LoadSpatials(List<PlaceModel> placeList)
{
List<PlaceModel> campusPlaces = new List<PlaceModel>();
this.Spatial = new SpsModel();
foreach (PlaceModel place in placeList)
{
if (place.ParentId.Equals(this.CampusId) || place.PlaceId.Equals(this.CampusId))
{
campusPlaces.Add(place);
}
}
this.Spatial.AddPlaces(campusPlaces);
}
}
}

View File

@@ -0,0 +1,40 @@
using CampusAppWP8.Model.GeoDb;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CampusAppWP8.Model.Campusmap
{
public abstract class ClickAblePlacePinModel : MapPinModel
{
#region property
/// <summary>
/// Gets or sets Callback Function, to show place information of the Pin
/// </summary>
public MapModel.MapInfos CallBack { get; set; }
/// <summary>
/// Gets or sets place which are associative with this pin
/// </summary>
public List<PlaceModel> AssocPlaces { get; set; }
#endregion
#region Method
/// <summary>
/// Show Information of this pin places
/// </summary>
/// <param name="sender">sender of the Event</param>
/// <param name="e">MouseButtonEvent Arguments</param>
public void ShowInfo(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
this.CallBack(this.AssocPlaces);
}
#endregion
}
}

View File

@@ -26,6 +26,7 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageHeight = 60;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -34;
this.Tag = MapPinModel.CurrendPositionPlacePinString;
}
#endregion

View File

@@ -11,5 +11,10 @@ namespace CampusAppWP8.Model.Campusmap
/// <remarks>Stubbfel, 27.08.2013.</remarks>
public class HiddenPinPlaceModel : MapPinModel
{
public HiddenPinPlaceModel()
{
this.Tag = MapPinModel.HiddenPlacePinString;
}
}
}

View File

@@ -0,0 +1,30 @@
using CampusAppWP8.Resources;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CampusAppWP8.Model.Campusmap
{
public class InfoPlacePinModel : ClickAblePlacePinModel
{
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="SearchPlacePinModel" /> class.
/// </summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
public InfoPlacePinModel()
{
this.ImageSource = Icons.Info;
this.ImageWidth = 60;
this.ImageHeight = 60;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -27;
this.Tag = MapPinModel.PinTypeToString(PinType.InfoPlace);
}
#endregion
}
}

View File

@@ -22,12 +22,20 @@ namespace CampusAppWP8.Model.Campusmap
{
#region Constructors
public MapModel()
{
this.IsReady = false;
}
/// <summary>
/// Initializes a new instance of the <see cref="MapModel" /> class.
/// </summary>
public MapModel()
public MapModel(List<PlaceModel> placeList)
{
this.LoadSpatials();
this.IsReady = false;
this.LoadSpatials(placeList);
this.IsReady = true;
}
#endregion
@@ -48,6 +56,8 @@ namespace CampusAppWP8.Model.Campusmap
#endregion
#region Property
public bool IsReady { get; protected set; }
/// <summary>
/// Gets or sets the ImageSource of the map
/// </summary>
@@ -246,8 +256,10 @@ namespace CampusAppWP8.Model.Campusmap
/// <summary>Loads the spatial./</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
protected virtual void LoadSpatials()
protected virtual void LoadSpatials(List<PlaceModel> placeList)
{
this.Spatial = new SpsModel();
this.Spatial.AddPlaces(placeList);
}
#endregion
@@ -275,11 +287,18 @@ namespace CampusAppWP8.Model.Campusmap
((SearchPlacePinModel)pin).AssocPlaces = places;
((SearchPlacePinModel)pin).CallBack = this.ShowMapInfos;
break;
case MapPinModel.PinType.InfoPlace:
pin = new InfoPlacePinModel();
pinImg.MouseLeftButtonDown += new MouseButtonEventHandler(((InfoPlacePinModel)pin).ShowInfo);
((InfoPlacePinModel)pin).AssocPlaces = places;
((InfoPlacePinModel)pin).CallBack = this.ShowMapInfos;
break;
default:
pin = new HiddenPinPlaceModel();
break;
}
pinImg.Tag = pin.Tag;
return pin;
}

View File

@@ -17,6 +17,17 @@ namespace CampusAppWP8.Model.Campusmap
{
#region Member
private static string infoPlacePinString = MapPinModel.PinTypeToString(PinType.InfoPlace);
private static string hiddenPlacePinString = MapPinModel.PinTypeToString(PinType.Hidden);
private static string searchPlacePinString = MapPinModel.PinTypeToString(PinType.SearchPlace);
private static string currendPositionPlacePinString = MapPinModel.PinTypeToString(PinType.CurrentPosition);
/// <summary>
/// Variable of the actual position of the pin
/// </summary>
@@ -46,7 +57,10 @@ namespace CampusAppWP8.Model.Campusmap
SearchPlace = 1,
/// <summary>An enum constant representing the current position option.</summary>
CurrentPosition = 2
CurrentPosition = 2,
/// <summary>An enum constant representing the info place option.</summary>
InfoPlace = 3
}
#endregion
@@ -114,6 +128,55 @@ namespace CampusAppWP8.Model.Campusmap
}
}
}
public object Tag { get; set; }
public static string CurrendPositionPlacePinString
{
get { return MapPinModel.currendPositionPlacePinString; }
}
public static string SearchPlacePinString
{
get { return MapPinModel.searchPlacePinString; }
}
public static string HiddenPlacePinString
{
get { return MapPinModel.hiddenPlacePinString; }
}
public static string InfoPlacePinString
{
get { return MapPinModel.infoPlacePinString; }
}
#endregion
#region Method
public static string PinTypeToString(PinType type)
{
string result = null;
switch (type)
{
case PinType.CurrentPosition:
result = "CurrentPositionPin";
break;
case PinType.Hidden:
result = "HiddenPin";
break;
case PinType.InfoPlace:
result = "InfoPin";
break;
case PinType.SearchPlace:
result = "SearchPlacePin";
break;
default:
result = string.Empty;
break;
}
return result;
}
#endregion
}
}

View File

@@ -14,7 +14,7 @@ namespace CampusAppWP8.Model.Campusmap
/// <summary>Search pin place model.</summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
public class SearchPlacePinModel : MapPinModel
public class SearchPlacePinModel : ClickAblePlacePinModel
{
#region Constructor
@@ -29,34 +29,7 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageHeight = 60;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -27;
}
#endregion
#region property
/// <summary>
/// Gets or sets Callback Function, to show place information of the Pin
/// </summary>
public MapModel.MapInfos CallBack { get; set; }
/// <summary>
/// Gets or sets place which are associative with this pin
/// </summary>
public List<PlaceModel> AssocPlaces { get; set; }
#endregion
#region Method
/// <summary>
/// Show Information of this pin places
/// </summary>
/// <param name="sender">sender of the Event</param>
/// <param name="e">MouseButtonEvent Arguments</param>
public void ShowInfo(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
this.CallBack(this.AssocPlaces);
this.Tag = MapPinModel.SearchPlacePinString;
}
#endregion

View File

@@ -39,21 +39,10 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<!-- <StackPanel Grid.Column="0">
<TextBlock Text="Lat:" />
<TextBox Name="YPoint" Text="51,767747" InputScope="Number" />
</StackPanel>
<StackPanel Grid.Column="1">
<TextBlock Text="Long:" />
<TextBox Name="XPoint" Text="14,327545" InputScope="Number" />
</StackPanel>
<Button Grid.Column="2" Click="Button_Click">
<Image Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="60"/>
</Button>-->
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBox Name="QString" InputScope="Text" AcceptsReturn="False" />
</StackPanel>
<Button Grid.Column="1" Click="Button_Click2">
<Button Grid.Column="1" Click="SearchByText">
<Image Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="60"/>
</Button>
</Grid>
@@ -74,6 +63,7 @@
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="Scan QR-Code" Click="SearchPlaceByQR_Click" />
<shell:ApplicationBarMenuItem Text="Scan NFC-Tag" Click="SearchPlaceByNFC_Click"/>
<shell:ApplicationBarMenuItem Text="Gebäudeinfos einblenden" Click="ShowBuildingsInformation" />
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

View File

@@ -26,6 +26,7 @@ namespace CampusAppWP8.Pages.Campusmap
using Microsoft.Phone.Shell;
using Windows.Networking.Proximity;
using CampusAppWP8.File.Places;
using System.Windows.Controls;
/// <summary>Class for the campusMap page.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
@@ -63,9 +64,7 @@ namespace CampusAppWP8.Pages.Campusmap
public CampusMapPage()
{
this.InitializeComponent();
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;
@@ -91,6 +90,15 @@ namespace CampusAppWP8.Pages.Campusmap
#endregion
#region Events
public delegate void LoadingPlace(string args);
public event LoadingPlace OnLoadingPlace;
private string lastQuery;
private bool buildInfoEnable;
#endregion
#region Method
#region protected
@@ -101,26 +109,22 @@ namespace CampusAppWP8.Pages.Campusmap
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (this.campusMap.Spatial == null)
{
return;
}
if (e.NavigationMode == NavigationMode.New)
{
MapCanvas.Children.Clear();
this.ClearMap();
bool scroll = true;
string alias = "campus";
if (NavigationContext.QueryString.ContainsKey(Constants.ParamModelMap_SearchTermAlias))
{
alias = NavigationContext.QueryString[Constants.ParamModelMap_SearchTermAlias];
this.AddPins(this.SearchPlaces(alias), MapPinModel.PinType.SearchPlace);
string alias = NavigationContext.QueryString[Constants.ParamModelMap_SearchTermAlias];
this.ShowPlacesByQueryAsSearchPin(alias);
scroll = false;
}
else
{
this.AddPins(this.SearchPlaces(alias), MapPinModel.PinType.Hidden);
this.ShowPlacesByQueryAsHiddenPin("campus");
}
this.ShowCurrentPositionDispatcher(scroll);
@@ -134,7 +138,7 @@ namespace CampusAppWP8.Pages.Campusmap
string searchPid = Wp8StringManager.FilterPlaceIdinQRResultString(qrcodeResult);
if (searchPid != null)
{
this.AddPinsByPids(new List<string>() { searchPid }, MapPinModel.PinType.SearchPlace);
this.ShowAllPlacesByPlaceIdAsSearchPin(searchPid);
}
}
}
@@ -143,23 +147,182 @@ namespace CampusAppWP8.Pages.Campusmap
#region private
private void FileIsReady()
private void SetLastQuery(string query, Action<string> action)
{
this.lastQuery = query;
this.OnLoadingPlace = new CampusMapPage.LoadingPlace(action);
}
private void ShowPlacesByQueryAsHiddenPin(string query)
{
if (!this.IsMapReady())
{
this.SetLastQuery(query, this.ShowPlacesByQueryAsHiddenPin);
}
else
{
this.ShowPlacesByQuery(query, MapPinModel.PinType.Hidden, false);
}
}
private void ShowPlacesByQueryAsSearchPin(string query)
{
if (!this.IsMapReady())
{
this.SetLastQuery(query, this.ShowPlacesByQueryAsSearchPin);
}
else
{
bool allPlaces = false;
if (Wp8StringManager.IsDigitsOnly(query))
{
allPlaces = true;
}
this.ShowPlacesByQuery(query, MapPinModel.PinType.SearchPlace, allPlaces);
}
}
private void ShowPlacesByQuery(string query, MapPinModel.PinType pintype, bool allPlaces)
{
this.AddPins(this.SearchPlaces(query, allPlaces), pintype);
}
private void showPlacesByPlaceId(string placeId, MapPinModel.PinType pintype, bool allPlaces)
{
this.AddPinsByPids(new List<string>() { placeId }, pintype, false, allPlaces);
}
private void ShowAllPlacesByPlaceIdAsSearchPin(string placeId)
{
if (!this.IsMapReady())
{
this.SetLastQuery(placeId, this.ShowAllPlacesByPlaceIdAsSearchPin);
}
else
{
this.showPlacesByPlaceId(placeId, MapPinModel.PinType.SearchPlace, true);
}
}
private void ShowPlacesByPlaceIdAsSearchPin(string placeId)
{
if (!this.IsMapReady())
{
this.SetLastQuery(placeId, this.ShowPlacesByPlaceIdAsSearchPin);
}
else
{
this.showPlacesByPlaceId(placeId, MapPinModel.PinType.SearchPlace, false);
}
}
private void ShowAllCampusBuilding(string placeId)
{
if (!this.IsMapReady())
{
this.SetLastQuery(placeId, ShowAllCampusBuilding);
}
else
{
this.AddPins(this.campusMap.Spatial.Places.ToList(), MapPinModel.PinType.InfoPlace, false);
}
}
private bool IsMapReady()
{
if (this.campusMap == null || !campusMap.IsReady)
{
return false;
}
return true;
}
private void FileIsReady()
{
this.campusMap = new CBMainMapModel(this.file.Model.Places.ToList());
this.MapCanvas.DataContext = this.campusMap;
this.campusMap.ShowMapInfos += new CBMainMapModel.MapInfos(this.ShowMapInfo);
if (this.OnLoadingPlace != null)
{
this.OnLoadingPlace(this.lastQuery);
}
}
/// <summary>Button click method.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
/// <param name="sender">caller object.</param>
/// <param name="e"> some EventArgs.</param>
private void SearchByText(object sender, RoutedEventArgs e)
{
string query = QString.Text.Trim();
if (query.Equals(string.Empty))
{
return;
}
this.ClearMap(new List<string>() { MapPinModel.SearchPlacePinString });
this.ShowPlacesByQueryAsSearchPin(query);
}
private void ShowBuildingsInformation(object sender, EventArgs e)
{
if (!this.buildInfoEnable)
{
this.ShowAllCampusBuilding("");
this.buildInfoEnable = true;
}
else
{
this.ClearMap(new List<string>() { MapPinModel.InfoPlacePinString });
this.buildInfoEnable = false;
}
}
private void ClearMap(List<string> removeTags = null)
{
if (removeTags == null)
{
MapCanvas.Children.Clear();
}
else
{
List<UIElement> childs = MapCanvas.Children.ToList();
foreach (UIElement child in childs)
{
Image childImg = child as Image;
if (childImg == null)
{
continue;
}
string imgTag = childImg.Tag.ToString().Trim();
if (removeTags.Contains(imgTag))
{
MapCanvas.Children.Remove(child);
}
}
}
}
/// <summary>
/// Method adds pin to the map by given list of placeId
/// </summary>
/// <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, bool allPlaces = false)
{
// clear canvas
if (clearCanvas)
{
MapCanvas.Children.Clear();
this.ClearMap();
}
else
{
this.ClearMap(new List<string>() { MapPinModel.PinTypeToString(pinType) });
}
// null and empty list assert
@@ -170,10 +333,19 @@ namespace CampusAppWP8.Pages.Campusmap
List<PlaceModel> placeList = new List<PlaceModel>();
PlaceModel tmpPlace;
SpsModel spatial;
if (allPlaces)
{
spatial = this.file.Model;
}
else
{
spatial = this.campusMap.Spatial;
}
foreach (string pid in pidList)
{
tmpPlace = this.campusMap.Spatial.GetPlaceById(pid);
tmpPlace = spatial.GetPlaceById(pid);
if (tmpPlace != null)
{
placeList.Add(tmpPlace);
@@ -243,11 +415,11 @@ namespace CampusAppWP8.Pages.Campusmap
// add pins to map
if (this.Dispatcher != null)
{
this.Dispatcher.BeginInvoke(new Action(() => this.AddPinsByPids(new List<string>() { searchPid }, MapPinModel.PinType.SearchPlace)));
this.Dispatcher.BeginInvoke(new Action(() => this.ShowAllPlacesByPlaceIdAsSearchPin(searchPid)));
}
else
{
this.AddPinsByPids(new List<string>() { searchPid }, MapPinModel.PinType.SearchPlace);
this.ShowAllPlacesByPlaceIdAsSearchPin(searchPid);
}
}
else
@@ -273,33 +445,26 @@ namespace CampusAppWP8.Pages.Campusmap
}
}
/// <summary>Button click method.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
/// <param name="sender">caller object.</param>
/// <param name="e"> some EventArgs.</param>
private void Button_Click2(object sender, RoutedEventArgs e)
{
string query = QString.Text.Trim();
if (query.Equals(string.Empty))
{
return;
}
MapCanvas.Children.Clear();
this.AddPins(this.SearchPlaces(query), MapPinModel.PinType.SearchPlace);
}
/// <summary>Searches for the first places.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
/// <param name="query">The query.</param>
/// <returns>The found places.</returns>
private List<PlaceModel> SearchPlaces(string query)
private List<PlaceModel> SearchPlaces(string query, bool allPlaces = false)
{
SpsModel spatial;
if (allPlaces)
{
spatial = this.file.Model;
}
else
{
spatial = this.campusMap.Spatial;
}
// if query is an id
if (Wp8StringManager.IsDigitsOnly(query))
{
return new List<PlaceModel>() { this.campusMap.Spatial.GetPlaceById(query) };
return new List<PlaceModel>() { spatial.GetPlaceById(query) };
}
if (this.informationsNames == null)
@@ -310,7 +475,8 @@ namespace CampusAppWP8.Pages.Campusmap
this.informationsNames.Add(Constants.PisInformationName_ShortName);
}
return this.campusMap.Spatial.GetPlacesByInformation(query, true, this.informationsNames);
return spatial.GetPlacesByInformation(query, true, this.informationsNames);
}
/// <summary>Adds the pins.</summary>
@@ -322,6 +488,10 @@ namespace CampusAppWP8.Pages.Campusmap
{
foreach (PlaceModel place in places)
{
if (place == null)
{
continue;
}
GeoCoordinate coor = place.GeoRefPoint;
if (coor != null)
{
@@ -350,9 +520,6 @@ namespace CampusAppWP8.Pages.Campusmap
MapScroller.ScrollToVerticalOffset(scrollPoint.Y);
MapScroller.ScrollToHorizontalOffset(scrollPoint.X);
}
// XPoint.Text = x.ToString();
// YPoint.Text = y.ToString();
}
/// <summary>On clicking the update button in the ApplicationBar.</summary>
@@ -480,15 +647,15 @@ namespace CampusAppWP8.Pages.Campusmap
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;
}
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;
}
}
}
}
@@ -500,7 +667,7 @@ namespace CampusAppWP8.Pages.Campusmap
/// <returns>true, if the place has got rooms, otherwise false</returns>
private bool HasRooms(string placeId)
{
foreach (PlaceModel place in this.campusMap.Spatial.Places)
foreach (PlaceModel place in this.file.Model.Places)
{
if (place.ParentId.Equals(placeId))
{

View File

@@ -10,6 +10,7 @@ namespace CampusAppWP8.Pages.Dev
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Windows;
using System.Windows.Navigation;
@@ -18,6 +19,7 @@ namespace CampusAppWP8.Pages.Dev
using CampusAppWP8.Utility.NDEF;
using Microsoft.Phone.Controls;
using Windows.Networking.Proximity;
using CampusAppWP8.File.Places;
/// <summary>Nfc page.</summary>
/// <remarks>Stubbfel, 22.08.2013.</remarks>
@@ -34,6 +36,8 @@ namespace CampusAppWP8.Pages.Dev
/// <summary>List of ndefs.</summary>
private List<NDEFMessage> ndefList;
private PlacesFile file;
#endregion
#region Constructor
@@ -43,14 +47,30 @@ namespace CampusAppWP8.Pages.Dev
public NFC()
{
this.InitializeComponent();
if (this.file == null)
{
this.file = new PlacesFile();
}
this.file.OnLoaded += new PlacesFile.OnIO(this.FileIsReady);
this.file.LoadData();
this.actNDEFIndex = 0;
}
private void FileIsReady()
{
this.ndefList = new List<NDEFMessage>();
MapModel map = new CBMainMapModel();
MapModel map = new CBMainMapModel(this.file.Model.Places.ToList());
foreach (PlaceModel place in map.Spatial.Places)
{
this.ndefList.Add(new NDEFMessage(place.ToNfcString(), NDEFMessage.TYPEVAL.TEXT));
}
this.actNDEFIndex = 0;
this.Writecontent.Text = this.ndefList[this.actNDEFIndex].GetContent();
}
#endregion
@@ -65,7 +85,6 @@ namespace CampusAppWP8.Pages.Dev
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
this.Writecontent.Text = this.ndefList[this.actNDEFIndex].GetContent();
}
#endregion