From a8327440fe8198f9a6024f93b4296fe263af1958 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 11 Aug 2012 17:06:28 +0100 Subject: [PATCH] windows about: add website links. #832 --- SparkleShare/Windows/SparkleAbout.cs | 55 +++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/SparkleShare/Windows/SparkleAbout.cs b/SparkleShare/Windows/SparkleAbout.cs index a6630c14..1b8a2c25 100644 --- a/SparkleShare/Windows/SparkleAbout.cs +++ b/SparkleShare/Windows/SparkleAbout.cs @@ -16,8 +16,10 @@ using System; -using System.ComponentModel; +using System.ComponentModel; +using System.Diagnostics; using System.Windows; +using System.Windows.Input; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; @@ -41,12 +43,10 @@ namespace SparkleShare { Icon = SparkleUIHelpers.GetImageSource("sparkleshare-app", "ico"); WindowStartupLocation = WindowStartupLocation.CenterScreen; - Closing += Close; CreateAbout (); - Controller.ShowWindowEvent += delegate { Dispatcher.BeginInvoke ((Action) delegate { Show (); @@ -117,7 +117,10 @@ namespace SparkleShare { Width = 318 }; - + SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress); + SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress); + SparkleLink report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress); + Canvas canvas = new Canvas (); canvas.Children.Add (image); @@ -134,7 +137,19 @@ namespace SparkleShare { canvas.Children.Add (credits); Canvas.SetLeft (credits, 294); - Canvas.SetTop (credits, 142); + Canvas.SetTop (credits, 142); + + canvas.Children.Add (website_link); + Canvas.SetLeft (website_link, 289); + Canvas.SetTop (website_link, 222); + + canvas.Children.Add (credits_link); + Canvas.SetLeft (credits_link, 289 + website_link.ActualWidth + 60); + Canvas.SetTop (credits_link, 222); + + canvas.Children.Add (report_problem_link); + Canvas.SetLeft (report_problem_link, 289 + website_link.ActualWidth + credits_link.ActualWidth + 115); + Canvas.SetTop (report_problem_link, 222); Content = canvas; } @@ -146,4 +161,34 @@ namespace SparkleShare { args.Cancel = true; } } + + + public class SparkleLink : Label { + + public SparkleLink (string title, string address) + { + FontSize = 11; + Cursor = Cursors.Hand; + Foreground = new SolidColorBrush (Color.FromRgb (135, 178, 227)); + + TextDecoration underline = new TextDecoration () { + Pen = new Pen (new SolidColorBrush (Color.FromRgb (135, 178, 227)), 1), + PenThicknessUnit = TextDecorationUnit.FontRecommended + }; + + TextDecorationCollection collection = new TextDecorationCollection (); + collection.Add (underline); + + TextBlock text_block = new TextBlock () { + Text = title, + TextDecorations = collection + }; + + Content = text_block; + + MouseUp += delegate { + Process.Start (new ProcessStartInfo (address)); + }; + } + } }