Merge branch 'feature/#83' into develop

This commit is contained in:
stubbfel
2013-07-08 11:37:43 +02:00
6 changed files with 87 additions and 44 deletions

View File

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

View File

@@ -6,6 +6,7 @@
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
@@ -30,7 +31,7 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Button Content="{Binding Title}" Background="Gray" BorderBrush="Gray" Foreground="Black" Margin="-10,-10,-10,-10" Click="LinkBtn_Click" Tag="{Binding Link}"/>
<lui:LinkButton Content="{Binding Title}" Background="Gray" BorderBrush="Gray" Foreground="Black" Margin="-10,-10,-10,-10" Url="{Binding Link}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
@@ -49,7 +50,7 @@
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Button Content="{Binding Title}" Background="Gray" BorderBrush="Gray" Foreground="Black" Margin="-10,-10,-10,-10" Click="LinkBtn_Click" Tag="{Binding Link}"/>
<lui:LinkButton Content="{Binding Title}" Background="Gray" BorderBrush="Gray" Foreground="Black" Margin="-10,-10,-10,-10" Url="{Binding Link}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>

View File

@@ -150,26 +150,6 @@ namespace CampusAppWP8.Pages.Links
this.ClubLinkPanel.ItemsSource = this.clubLinkFeed.Model.Links;
}
/// <summary>
/// Method open the Link in IE
/// </summary>
/// <param name="sender">clicked bottom</param>
/// <param name="e">some RoutedEventArgs</param>
private void LinkBtn_Click(object sender, RoutedEventArgs e)
{
FrameworkElement linkBtn = sender as FrameworkElement;
if (linkBtn.Tag == null)
{
return;
}
Uri linkUrl = new Uri(linkBtn.Tag as string, UriKind.Absolute);
WebBrowserTask webBrowserTask = new WebBrowserTask();
webBrowserTask.Uri = linkUrl;
webBrowserTask.Show();
}
#endregion
#endregion

View File

@@ -41,9 +41,7 @@
<StackPanel>
<Button Content="{Binding Name}" Background="Gray" BorderBrush="Gray" Foreground="Black" Margin="-10,-10,-10,-10" Click="ToggleOptions"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Visibility="Collapsed">
<Button Name="Link" Tag="{Binding Url}" Click="ShowWebpage" Height="75">
<Image Source="{Binding Path=ThemelizedIcon.Link, Source={StaticResource ThemelizedIcons}}" />
</Button>
<lui:LinkButton Height="75" Url="{Binding Url}" />
<lui:EmailButton Height="75" EmailAddress="{Binding Email}"/>
</StackPanel>
</StackPanel>

View File

@@ -102,25 +102,6 @@ namespace CampusAppWP8.Pages.StudentCouncil
}
}
/// <summary>
/// Method navigate to StudentCouncilWebPage
/// </summary>
/// <param name="sender">Caller of the function</param>
/// <param name="e">some EventArgs</param>
private void ShowWebpage(object sender, RoutedEventArgs e)
{
FrameworkElement linkBtn = sender as FrameworkElement;
if (linkBtn.Tag == null)
{
return;
}
Uri linkUrl = new Uri(linkBtn.Tag as string, UriKind.Absolute);
WebBrowserTask webBrowserTask = new WebBrowserTask();
webBrowserTask.Uri = linkUrl;
webBrowserTask.Show();
}
/// <summary>
/// Method initialize the Feed
/// </summary>

View File

@@ -0,0 +1,82 @@
//-----------------------------------------------------------------------
// <copyright file="LinkButton.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 the Webrowser, which an certain url
/// </summary>
public class LinkButton : System.Windows.Controls.Button
{
#region Members
/// <summary>
/// Register the EmailProperty
/// </summary>
public static readonly DependencyProperty LinkProperty = DependencyProperty.Register("Url", typeof(object), typeof(LinkButton), new PropertyMetadata(false));
/// <summary>
/// Icon of the Button
/// </summary>
private static BitmapImage icon = new BitmapImage(new Uri(Icons.Link, UriKind.Relative));
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="LinkButton" /> class.
/// </summary>
public LinkButton()
: base()
{
this.Content = new Image
{
Source = icon
};
}
#endregion
#region Proberties
/// <summary>
/// Gets or sets the Url
/// </summary>
public object Url
{
get { return (object)this.GetValue(LinkProperty); }
set { this.SetValue(LinkProperty, value); }
}
#endregion
#region Methods
/// <summary>
/// Overrides the OnClick-Method from button
/// </summary>
/// <remarks>
/// now method start the WebBrowserTask
/// </remarks>
protected override void OnClick()
{
Uri linkUrl = new Uri(this.Url as string, UriKind.Absolute);
WebBrowserTask webBrowserTask = new WebBrowserTask();
webBrowserTask.Uri = linkUrl;
webBrowserTask.Show();
}
#endregion
}
}