85 lines
2.4 KiB
C#
85 lines
2.4 KiB
C#
//-----------------------------------------------------------------------
|
|
// <copyright file="GoToMapButton.cs" company="BTU/IIT">
|
|
// Company copyright tag.
|
|
// </copyright>
|
|
// <author>stubbfel</author>
|
|
// <sience>08.07.2013</sience>
|
|
//----------------------------------------------------------------------
|
|
namespace CampusAppWP8.Utility.Lui.Button
|
|
{
|
|
using System;
|
|
using System.Device.Location;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Media.Imaging;
|
|
using CampusAppWP8.Resources;
|
|
using Microsoft.Phone.Tasks;
|
|
|
|
/// <summary>
|
|
/// This class create an Button which open a Map
|
|
/// </summary>
|
|
public class GoToMapButton : System.Windows.Controls.Button
|
|
{
|
|
#region Members
|
|
|
|
/// <summary>
|
|
/// Register the SearchTermProperty
|
|
/// </summary>
|
|
public static readonly DependencyProperty SearchTermProperty = DependencyProperty.Register("SearchTerm", typeof(object), typeof(GoToMapButton), new PropertyMetadata(false));
|
|
|
|
/// <summary>
|
|
/// Icon of the Button
|
|
/// </summary>
|
|
private static BitmapImage icon = new BitmapImage(new Uri(Icons.Campus, UriKind.Relative));
|
|
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="GoToMapButton" /> class.
|
|
/// </summary>
|
|
public GoToMapButton()
|
|
: base()
|
|
{
|
|
this.Content = new Image
|
|
{
|
|
Source = icon
|
|
};
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Proberties
|
|
|
|
/// <summary>
|
|
/// Gets or sets the Url
|
|
/// </summary>
|
|
public object SearchTerm
|
|
{
|
|
get { return (object)this.GetValue(SearchTermProperty); }
|
|
set { this.SetValue(SearchTermProperty, value); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <summary>
|
|
/// Overrides the OnClick-Method from button
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// now method start the MapTask
|
|
/// </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();
|
|
}
|
|
#endregion
|
|
}
|
|
}
|