82 lines
2.3 KiB
C#
82 lines
2.3 KiB
C#
//-----------------------------------------------------------------------
|
|
// <copyright file="EmailButton.cs" company="BTU/IIT">
|
|
// Company copyright tag.
|
|
// </copyright>
|
|
// <author>stubbfel</author>
|
|
// <sience>04.07.2013</sience>
|
|
//----------------------------------------------------------------------
|
|
namespace CampusAppWP8.Utility.Lui.Button
|
|
{
|
|
using System;
|
|
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 start the Email-Client
|
|
/// </summary>
|
|
public class EmailButton : System.Windows.Controls.Button
|
|
{
|
|
#region Members
|
|
|
|
/// <summary>
|
|
/// Register the EmailProperty
|
|
/// </summary>
|
|
public static readonly DependencyProperty EmailProperty = DependencyProperty.Register("EmailAddress", typeof(object), typeof(EmailButton), new PropertyMetadata(false));
|
|
|
|
/// <summary>
|
|
/// Icon of the Button
|
|
/// </summary>
|
|
private static BitmapImage icon = new BitmapImage(new Uri(Icons.WebMail, UriKind.Relative));
|
|
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="EmailButton" /> class.
|
|
/// </summary>
|
|
public EmailButton()
|
|
: base()
|
|
{
|
|
this.Content = new Image
|
|
{
|
|
Source = icon
|
|
};
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Proberties
|
|
|
|
/// <summary>
|
|
/// Gets or sets the EmailAddress
|
|
/// </summary>
|
|
public object EmailAddress
|
|
{
|
|
get { return (object)this.GetValue(EmailProperty); }
|
|
set { this.SetValue(EmailProperty, value); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <summary>
|
|
/// Overrides the OnClick-Method from button
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// now method start the EmailComposeTask
|
|
/// </remarks>
|
|
protected override void OnClick()
|
|
{
|
|
EmailComposeTask emailTask = new EmailComposeTask();
|
|
emailTask.To = "mailto:" + this.EmailAddress.ToString();
|
|
emailTask.Show();
|
|
}
|
|
#endregion
|
|
}
|
|
}
|