diff --git a/CampusAppWP8/CampusAppWP8/File/Campusmap/Offlinemap.xml b/CampusAppWP8/CampusAppWP8/File/Campusmap/Offlinemap.xml
index 8d4a1592..aa72c656 100644
--- a/CampusAppWP8/CampusAppWP8/File/Campusmap/Offlinemap.xml
+++ b/CampusAppWP8/CampusAppWP8/File/Campusmap/Offlinemap.xml
@@ -50,7 +50,7 @@
Lehrgebäude Musikpädagogik
- Informations, Kommunikations und Medienzentrum
+ Informations, Kommunikations und Medienzentrum (IKMZ)
library
@@ -81,7 +81,7 @@
Baustofflabor
- Studentenwerk Frankfurt (Oder)
+ Studentenwerk Frankfurt (Oder) (SW)
Zentralverwaltung Hubertstraße (ZVH)
@@ -167,7 +167,7 @@
Garagenkomplex
- Lehrgebäude 1C
+ Lehrgebäude 1C (LG1C)
Lehrgebäude 3
@@ -210,7 +210,7 @@
entrance
- Hauptgebäude
+ Hauptgebäude (HG)
Zentralverwaltung
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs
index ddc82665..deaa55c5 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs
@@ -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);
+ }
}
/// Button click method.
@@ -68,9 +80,9 @@ namespace CampusAppWP8.Pages.Campusmap
{
return;
}
-
+
MapCanvas.Children.Clear();
- this.AddPins(this.SearchPlaces(query));
+ this.AddPins(this.SearchPlaces(query));
}
/// Searches for the first places.
@@ -85,30 +97,35 @@ namespace CampusAppWP8.Pages.Campusmap
/// Adds the pins.
/// Stubbfel, 19.08.2013.
/// The places.
- private void AddPins(List places)
+ /// (Optional) the scroll.
+ private void AddPins(List 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);
}
}
}
/// Add Pin to an certain position.
/// Stubbfel, 19.08.2013.
- /// longitude parameter.
- /// latitude parameter.
- private void AddPin(double x, double y)
+ /// longitude parameter.
+ /// latitude parameter.
+ /// (Optional) the scroll.
+ 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
/// execute ShowCurrentPosition-Method via Dispatcher.
/// Stubbfel, 19.08.2013.
- private void ShowCurrentPositionDispatcher()
+ /// (Optional) the scroll.
+ 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();
}
/// Method add a pin on the at the position of the phone.
/// Stubbfel, 19.08.2013.
- private void ShowCurrentPosition()
+ /// (Optional) the scroll.
+ 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);
}
}
/// Sets pin to current position.
/// Stubbfel, 19.08.2013.
- private void SetPinToCurrentPosition()
+ /// (Optional) the scroll.
+ private void SetPinToCurrentPosition(bool scroll = true)
{
string lat = App.LoadFromAppState(Constants.GeoWatch_CurrentPosition_Lat);
string log = App.LoadFromAppState(Constants.GeoWatch_CurrentPosition_Long);
+ this.SetPinToPosition(lat, log, scroll);
+ }
+
+ /// Sets pin to position.
+ /// Stubbfel, 27.08.2013.
+ /// The latitude.
+ /// The longitude.
+ /// (Optional) the scroll.
+ 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;
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
index e8d7a953..0de55340 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
@@ -519,6 +519,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die SearchAlias ähnelt.
+ ///
+ public static string ParamModelMap_SearchTermAlias {
+ get {
+ return ResourceManager.GetString("ParamModelMap_SearchTermAlias", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die pivotindex ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index 00beecb5..ef601ff0 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -432,4 +432,7 @@
OnlyWifi
+
+ SearchAlias
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/GoToMapButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/GoToMapButton.cs
index e20930e2..19521cc9 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/GoToMapButton.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/GoToMapButton.cs
@@ -73,11 +73,14 @@ namespace CampusAppWP8.Utility.Lui.Button
///
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
}