windows about: add website links. #832

This commit is contained in:
Hylke Bons 2012-08-11 17:06:28 +01:00
parent ffefd683ce
commit a8327440fe

View file

@ -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));
};
}
}
}