Update coding style.
[master-thesis.git] / Parasitemia / ParasitemiaUI / About.fs
1 module ParasitemiaUI.About
2
3 open System
4 open System.Windows
5 open System.Windows.Controls
6 open System.Diagnostics
7
8 let showWindow (parent : Window) =
9 let win = Views.AboutWindow ()
10 win.Owner <- parent
11
12 win.Left <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Left) + parent.ActualWidth / 2. - win.Width / 2.
13 win.Top <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Top) + parent.ActualHeight / 2. - win.Height / 2.
14
15 let version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version
16 let txtVersion = sprintf " %d.%d.%d" version.Major version.Minor version.Revision
17 win.txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun txtVersion
18
19 let navigateTo =
20 Navigation.RequestNavigateEventHandler (
21 fun obj args ->
22 Process.Start (ProcessStartInfo args.Uri.AbsoluteUri) |> ignore
23 args.Handled <- true
24 )
25
26 win.linkHESSO.RequestNavigate.AddHandler navigateTo;
27 win.linkCHUV.RequestNavigate.AddHandler navigateTo;
28 win.linkGBurri.RequestNavigate.AddHandler navigateTo;
29
30 #if DEBUG
31 win.txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun " - DEBUG"
32 #endif
33
34 win.butClose.Click.AddHandler (fun obj args -> win.Close ())
35
36 win.ShowDialog () |> ignore
37