change GoToMap-Button -> now it use the campusmap
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
<placeInformation placeInformationName="name">Lehrgebäude Musikpädagogik</placeInformation>
|
||||
</place>
|
||||
<place id="127003463" parentId="1" refpoint="POINT(14.329434351923076 51.76722032307691)">
|
||||
<placeInformation placeInformationName="name">Informations, Kommunikations und Medienzentrum</placeInformation>
|
||||
<placeInformation placeInformationName="name">Informations, Kommunikations und Medienzentrum (IKMZ)</placeInformation>
|
||||
<placeInformation placeInformationName="typ">library</placeInformation>
|
||||
</place>
|
||||
<place id="127003745" parentId="1" refpoint="POINT(14.330883875 51.7678221)">
|
||||
@@ -81,7 +81,7 @@
|
||||
<placeInformation placeInformationName="name">Baustofflabor</placeInformation>
|
||||
</place>
|
||||
<place id="129258388" parentId="1" refpoint="POINT(14.322364300000002 51.76576072500001)">
|
||||
<placeInformation placeInformationName="name">Studentenwerk Frankfurt (Oder)</placeInformation>
|
||||
<placeInformation placeInformationName="name">Studentenwerk Frankfurt (Oder) (SW)</placeInformation>
|
||||
</place>
|
||||
<place id="129258396" parentId="1" refpoint="POINT(14.32840075 51.765809774999994)">
|
||||
<placeInformation placeInformationName="name">Zentralverwaltung Hubertstraße (ZVH)</placeInformation>
|
||||
@@ -167,7 +167,7 @@
|
||||
<placeInformation placeInformationName="name">Garagenkomplex</placeInformation>
|
||||
</place>
|
||||
<place id="145128365" parentId="1" refpoint="POINT(14.3245076125 51.7680148)">
|
||||
<placeInformation placeInformationName="name">Lehrgebäude 1C</placeInformation>
|
||||
<placeInformation placeInformationName="name">Lehrgebäude 1C (LG1C)</placeInformation>
|
||||
</place>
|
||||
<place id="145128368" parentId="1" refpoint="POINT(14.323577843750002 51.768762243750004)">
|
||||
<placeInformation placeInformationName="name">Lehrgebäude 3</placeInformation>
|
||||
@@ -210,7 +210,7 @@
|
||||
<placeInformation placeInformationName="typ">entrance</placeInformation>
|
||||
</place>
|
||||
<place id="145132460" parentId="1" refpoint="POINT(14.327332890909092 51.767140422727266)">
|
||||
<placeInformation placeInformationName="name">Hauptgebäude</placeInformation>
|
||||
<placeInformation placeInformationName="name">Hauptgebäude (HG)</placeInformation>
|
||||
</place>
|
||||
<place id="145132464" parentId="1" refpoint="POINT(14.327362925 51.76601645)">
|
||||
<placeInformation placeInformationName="name">Zentralverwaltung</placeInformation>
|
||||
|
||||
@@ -42,9 +42,21 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
MapCanvas.Children.Clear();
|
||||
this.AddPins(this.SearchPlaces("campus"));
|
||||
this.ShowCurrentPositionDispatcher();
|
||||
if (e.NavigationMode == NavigationMode.New)
|
||||
{
|
||||
MapCanvas.Children.Clear();
|
||||
|
||||
string alias = "campus";
|
||||
bool scroll = true;
|
||||
if (NavigationContext.QueryString.ContainsKey(Constants.ParamModelMap_SearchTermAlias))
|
||||
{
|
||||
alias = NavigationContext.QueryString[Constants.ParamModelMap_SearchTermAlias];
|
||||
scroll = false;
|
||||
}
|
||||
|
||||
this.AddPins(this.SearchPlaces(alias));
|
||||
this.ShowCurrentPositionDispatcher(scroll);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Button click method.</summary>
|
||||
@@ -68,9 +80,9 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
MapCanvas.Children.Clear();
|
||||
this.AddPins(this.SearchPlaces(query));
|
||||
this.AddPins(this.SearchPlaces(query));
|
||||
}
|
||||
|
||||
/// <summary>Searches for the first places.</summary>
|
||||
@@ -85,30 +97,35 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
/// <summary>Adds the pins.</summary>
|
||||
/// <remarks>Stubbfel, 19.08.2013.</remarks>
|
||||
/// <param name="places">The places.</param>
|
||||
private void AddPins(List<PlaceModel> places)
|
||||
/// <param name="scroll">(Optional) the scroll.</param>
|
||||
private void AddPins(List<PlaceModel> places, bool scroll = true)
|
||||
{
|
||||
foreach (PlaceModel place in places)
|
||||
{
|
||||
GeoCoordinate coor = place.GeoRefPoint;
|
||||
if (coor != null)
|
||||
{
|
||||
this.AddPin(coor.Longitude, coor.Latitude);
|
||||
this.AddPin(coor.Longitude, coor.Latitude, scroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Add Pin to an certain position.</summary>
|
||||
/// <remarks>Stubbfel, 19.08.2013.</remarks>
|
||||
/// <param name="x">longitude parameter.</param>
|
||||
/// <param name="y">latitude parameter.</param>
|
||||
private void AddPin(double x, double y)
|
||||
/// <param name="x"> longitude parameter.</param>
|
||||
/// <param name="y"> latitude parameter.</param>
|
||||
/// <param name="scroll">(Optional) the scroll.</param>
|
||||
private void AddPin(double x, double y, bool scroll = true)
|
||||
{
|
||||
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))));
|
||||
|
||||
MapScroller.UpdateLayout();
|
||||
MapScroller.ScrollToVerticalOffset(scrollPoint.Y);
|
||||
MapScroller.ScrollToHorizontalOffset(scrollPoint.X);
|
||||
if (scroll)
|
||||
{
|
||||
MapScroller.ScrollToVerticalOffset(scrollPoint.Y);
|
||||
MapScroller.ScrollToHorizontalOffset(scrollPoint.X);
|
||||
}
|
||||
|
||||
// XPoint.Text = x.ToString();
|
||||
// YPoint.Text = y.ToString();
|
||||
@@ -125,43 +142,56 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
|
||||
/// <summary>execute ShowCurrentPosition-Method via Dispatcher.</summary>
|
||||
/// <remarks>Stubbfel, 19.08.2013.</remarks>
|
||||
private void ShowCurrentPositionDispatcher()
|
||||
/// <param name="scroll">(Optional) the scroll.</param>
|
||||
private void ShowCurrentPositionDispatcher(bool scroll = true)
|
||||
{
|
||||
ProgressBar.Visibility = Visibility.Visible;
|
||||
|
||||
Thread thread = new Thread(new ThreadStart(this.ShowCurrentPosition));
|
||||
Thread thread = new Thread(delegate() { this.ShowCurrentPosition(scroll); });
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
/// <summary>Method add a pin on the at the position of the phone.</summary>
|
||||
/// <remarks>Stubbfel, 19.08.2013.</remarks>
|
||||
private void ShowCurrentPosition()
|
||||
/// <param name="scroll">(Optional) the scroll.</param>
|
||||
private void ShowCurrentPosition(bool scroll = true)
|
||||
{
|
||||
Utilities.DetermineAndStoreCurrentPositionForce();
|
||||
if (this.Dispatcher != null)
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() => this.SetPinToCurrentPosition()));
|
||||
this.Dispatcher.BeginInvoke(new Action(() => this.SetPinToCurrentPosition(scroll)));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SetPinToCurrentPosition();
|
||||
this.SetPinToCurrentPosition(scroll);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets pin to current position.</summary>
|
||||
/// <remarks>Stubbfel, 19.08.2013.</remarks>
|
||||
private void SetPinToCurrentPosition()
|
||||
/// <param name="scroll">(Optional) the scroll.</param>
|
||||
private void SetPinToCurrentPosition(bool scroll = true)
|
||||
{
|
||||
string lat = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Lat);
|
||||
string log = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Long);
|
||||
this.SetPinToPosition(lat, log, scroll);
|
||||
}
|
||||
|
||||
/// <summary>Sets pin to position.</summary>
|
||||
/// <remarks>Stubbfel, 27.08.2013.</remarks>
|
||||
/// <param name="latitude"> The latitude.</param>
|
||||
/// <param name="longitude">The longitude.</param>
|
||||
/// <param name="scroll"> (Optional) the scroll.</param>
|
||||
private void SetPinToPosition(string latitude, string longitude, bool scroll = true)
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
if (!double.TryParse(log, NumberStyles.Any, CultureInfo.InvariantCulture, out x) || !double.TryParse(lat, NumberStyles.Any, CultureInfo.InvariantCulture, out y))
|
||||
if (!double.TryParse(longitude, NumberStyles.Any, CultureInfo.InvariantCulture, out x) || !double.TryParse(latitude, NumberStyles.Any, CultureInfo.InvariantCulture, out y))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.AddPin(x, y);
|
||||
this.AddPin(x, y, scroll);
|
||||
ProgressBar.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,6 +519,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die SearchAlias ähnelt.
|
||||
/// </summary>
|
||||
public static string ParamModelMap_SearchTermAlias {
|
||||
get {
|
||||
return ResourceManager.GetString("ParamModelMap_SearchTermAlias", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die pivotindex ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -432,4 +432,7 @@
|
||||
<data name="AppSetting_OnlyWifi" xml:space="preserve">
|
||||
<value>OnlyWifi</value>
|
||||
</data>
|
||||
<data name="ParamModelMap_SearchTermAlias" xml:space="preserve">
|
||||
<value>SearchAlias</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -73,11 +73,14 @@ namespace CampusAppWP8.Utility.Lui.Button
|
||||
/// </remarks>
|
||||
protected override void OnClick()
|
||||
{
|
||||
MapsTask mapsTask = new MapsTask();
|
||||
mapsTask.Center = new GeoCoordinate(51.766788, 14.326681);
|
||||
mapsTask.SearchTerm = this.SearchTerm as string;
|
||||
mapsTask.ZoomLevel = 15;
|
||||
mapsTask.Show();
|
||||
string urlString = Constants.PathCampusmap_Campusmap;
|
||||
if (this.SearchTerm != null)
|
||||
{
|
||||
urlString += "?" + Constants.ParamModelMap_SearchTermAlias + "=" + this.SearchTerm;
|
||||
}
|
||||
Uri url = new Uri(urlString as string, UriKind.Relative);
|
||||
Page page = App.RootFrame.Content as Page;
|
||||
page.NavigationService.Navigate(url);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user