452573a11bf8fe0f1062dad28b9c2e7876bf74f1
[master-thesis.git] / Parasitemia / ParasitemiaUI / About.fs
1 module ParasitemiaUI.About
2
3 open System
4 open System.Windows
5 open System.Windows.Media
6 open System.Windows.Markup
7 open System.Windows.Shapes
8 open System.Windows.Controls
9 open System.Diagnostics
10
11 let showWindow (parent : Window) =
12 let win = Views.AboutWindow()
13 win.Owner <- parent
14
15 win.Left <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Left) + parent.ActualWidth / 2. - win.Width / 2.
16 win.Top <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Top) + parent.ActualHeight / 2. - win.Height / 2.
17
18 let version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version
19 let txtVersion = sprintf " %d.%d.%d" version.Major version.Minor version.Revision
20 win.txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun(txtVersion)
21
22 let navigateTo = Navigation.RequestNavigateEventHandler(fun obj args ->
23 Process.Start(ProcessStartInfo(args.Uri.AbsoluteUri)) |> ignore
24 args.Handled <- true)
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