add Phonebotton and import them to openinghours

This commit is contained in:
stubbfel
2013-07-08 12:31:53 +02:00
parent b3ef2ab81f
commit bc77d076c9
5 changed files with 100 additions and 49 deletions

View File

@@ -210,6 +210,7 @@
<Compile Include="Utility\Logger.cs" />
<Compile Include="Utility\HttpRequest.cs" />
<Compile Include="Utility\Lui\Button\GoToMapButton.cs" />
<Compile Include="Utility\Lui\Button\PhoneButton.cs" />
<Compile Include="Utility\Lui\Button\LinkButton.cs" />
<Compile Include="Utility\StringManager.cs" />
<Compile Include="Utility\URLList.cs" />

View File

@@ -114,11 +114,9 @@
</Grid.ColumnDefinitions>
<!--mail button-->
<lui:EmailButton Grid.Column="0" EmailAddress="{Binding EMailTitle}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisibleEMail}" Padding="0" Margin="-10"/>
<lui:EmailButton Grid.Column="0" EmailAddress="{Binding EMail}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisibleEMail}" Padding="0" Margin="-10"/>
<!--phone button-->
<Button Grid.Column="1" Tag="{Binding PhoneTitle}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisiblePhone}" Click="PhoneBtn_Click" Padding="0" Margin="-10">
<Image Source="{Binding Path=ThemelizedIcon.Phone, Source={StaticResource ThemelizedIcons}}"/>
</Button>
<lui:PhoneButton Grid.Column="1" Number="{Binding Phone}" DisplayName="{Binding Title}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisiblePhone}" Padding="0" Margin="-10"/>
<!--location button -->
<lui:GoToMapButton Grid.Column="2" SearchTerm="{Binding Building}" BorderBrush="Transparent" Background="Transparent" Height="100" Visibility="{Binding VisibleBuilding}" Padding="0" Margin="-10" />
</Grid>

View File

@@ -132,50 +132,6 @@ namespace CampusAppWP8.Pages.Openinghours
}
}
/// <summary>
/// Called on clicking on a mail button.
/// </summary>
/// <param name="sender">button object</param>
/// <param name="e">event args</param>
private void EMailBtn_Click(object sender, RoutedEventArgs e)
{
FrameworkElement tempUIElem = sender as FrameworkElement;
string[] info = tempUIElem.Tag.ToString().Split(':');
if ((info.Count() > 0) && (info[0] != null))
{
EmailComposeTask emailTask = new EmailComposeTask();
emailTask.To = "mailto:" + info[0];
emailTask.Show();
}
}
/// <summary>
/// Called on clicking on a phone button.
/// </summary>
/// <param name="sender">button object</param>
/// <param name="e">event args</param>
private void PhoneBtn_Click(object sender, RoutedEventArgs e)
{
FrameworkElement tempUIElem = sender as FrameworkElement;
PhoneCallTask phoneCallTask = new PhoneCallTask();
string[] info = tempUIElem.Tag.ToString().Split(':');
if ((info.Count() > 0) && (info[0] != null))
{
phoneCallTask.PhoneNumber = info[0];
}
if ((info.Count() > 1) && (info[1] != null))
{
phoneCallTask.DisplayName = info[1];
}
phoneCallTask.Show();
}
// private
#endregion
// Method

View File

@@ -69,7 +69,7 @@ namespace CampusAppWP8.Utility.Lui.Button
/// Overrides the OnClick-Method from button
/// </summary>
/// <remarks>
/// now method start the WebBrowserTask
/// now method start the MapTask
/// </remarks>
protected override void OnClick()
{

View File

@@ -0,0 +1,96 @@
//-----------------------------------------------------------------------
// <copyright file="PhoneButtonn.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.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 a Phonecall
/// </summary>
public class PhoneButton : System.Windows.Controls.Button
{
#region Members
/// <summary>
/// Register the PhoneProperty
/// </summary>
public static readonly DependencyProperty PhoneProperty = DependencyProperty.Register("Number", typeof(object), typeof(PhoneButton), new PropertyMetadata(false));
/// <summary>
/// Register the DisplayNameProperty
/// </summary>
public static readonly DependencyProperty DisplayNameProperty = DependencyProperty.Register("DisplayName", typeof(object), typeof(PhoneButton), new PropertyMetadata(false));
/// <summary>
/// Icon of the Button
/// </summary>
private static BitmapImage icon = new BitmapImage(new Uri(Icons.Phone, UriKind.Relative));
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="PhoneButton" /> class.
/// </summary>
public PhoneButton()
: base()
{
this.Content = new Image
{
Source = icon
};
}
#endregion
#region Proberties
/// <summary>
/// Gets or sets the PhoneNumber
/// </summary>
public object Number
{
get { return (object)this.GetValue(PhoneProperty); }
set { this.SetValue(PhoneProperty, value); }
}
/// <summary>
/// Gets or sets the DisplayName
/// </summary>
public object DisplayName
{
get { return (object)this.GetValue(DisplayNameProperty); }
set { this.SetValue(DisplayNameProperty, value); }
}
#endregion
#region Methods
/// <summary>
/// Overrides the OnClick-Method from button
/// </summary>
/// <remarks>
/// now method start the PhoneTask
/// </remarks>
protected override void OnClick()
{
PhoneCallTask phoneCallTask = new PhoneCallTask();
phoneCallTask.PhoneNumber = this.Number as string;
phoneCallTask.DisplayName = this.DisplayName as string;
phoneCallTask.Show();
}
#endregion
}
}