44dd881d4e84c42defd400ddb2ebba10f8b98d18
1
module ParasitemiaUI.About
5 open System.Windows.Media
6 open System.Windows.Markup
7 open System.Windows.Shapes
8 open System.Windows.Controls
9 open System.Diagnostics
11 let showWindow (parent
: Window) =
12 let window = Views.AboutWindow()
13 window.Root.Owner <- parent
14 window.Root.Left <- parent
.Left + parent
.ActualWidth / 2. - window.Root.Width / 2.
15 window.Root.Top <- parent
.Top + parent
.ActualHeight / 2. - window.Root.Height / 2.
17 let ctrl (name
: string): 'a = window.Root.FindName(name) :?> 'a
19 let butClose: Button = ctrl "butClose"
20 let txtAbout: TextBlock = ctrl "txtAbout"
22 let linkHESSO: Documents.Hyperlink = ctrl "linkHESSO"
23 let linkCHUV: Documents.Hyperlink = ctrl "linkCHUV"
24 let linkGBurri: Documents.Hyperlink = ctrl "linkGBurri"
26 let version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version
27 let txtVersion = sprintf
" %d.%d.%d" version.Major version.Minor version.Revision
28 txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun(txtVersion)
30 let navigateTo = Navigation.RequestNavigateEventHandler(fun obj args
->
31 Process.Start(ProcessStartInfo(args
.Uri.AbsoluteUri)) |> ignore
34 linkHESSO.RequestNavigate.AddHandler(navigateTo);
35 linkCHUV.RequestNavigate.AddHandler(navigateTo);
36 linkGBurri.RequestNavigate.AddHandler(navigateTo);
39 txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun(" - DEBUG")
42 butClose.Click.AddHandler(fun obj args
-> window.Root.Close())
44 window.Root.ShowDialog() |> ignore