Add a DPI calculator to help to find the correct image resolution.
[master-thesis.git] / Parasitemia / ParasitemiaUI / About.fs
index 44dd881..18f266f 100644 (file)
@@ -9,37 +9,28 @@ open System.Windows.Controls
 open System.Diagnostics
 
 let showWindow (parent: Window) =
-    let window = Views.AboutWindow()
-    window.Root.Owner <- parent
-    window.Root.Left <- parent.Left + parent.ActualWidth / 2. - window.Root.Width / 2.
-    window.Root.Top <- parent.Top + parent.ActualHeight / 2. - window.Root.Height / 2.
-
-    let ctrl (name: string): 'a = window.Root.FindName(name) :?> 'a
-
-    let butClose: Button = ctrl "butClose"
-    let txtAbout: TextBlock = ctrl "txtAbout"
-
-    let linkHESSO: Documents.Hyperlink = ctrl "linkHESSO"
-    let linkCHUV: Documents.Hyperlink = ctrl "linkCHUV"
-    let linkGBurri: Documents.Hyperlink = ctrl "linkGBurri"
+    let win = Views.AboutWindow()
+    win.Root.Owner <- parent
+    win.Root.Left <- parent.Left + parent.ActualWidth / 2. - win.Root.Width / 2.
+    win.Root.Top <- parent.Top + parent.ActualHeight / 2. - win.Root.Height / 2.
 
     let version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version
     let txtVersion = sprintf " %d.%d.%d" version.Major version.Minor version.Revision
-    txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun(txtVersion)
+    win.txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun(txtVersion)
 
     let navigateTo = Navigation.RequestNavigateEventHandler(fun obj args ->
         Process.Start(ProcessStartInfo(args.Uri.AbsoluteUri)) |> ignore
         args.Handled <- true)
 
-    linkHESSO.RequestNavigate.AddHandler(navigateTo);
-    linkCHUV.RequestNavigate.AddHandler(navigateTo);
-    linkGBurri.RequestNavigate.AddHandler(navigateTo);
+    win.linkHESSO.RequestNavigate.AddHandler(navigateTo);
+    win.linkCHUV.RequestNavigate.AddHandler(navigateTo);
+    win.linkGBurri.RequestNavigate.AddHandler(navigateTo);
 
 #if DEBUG
-    txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun(" - DEBUG")
+    win.txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun(" - DEBUG")
 #endif
 
-    butClose.Click.AddHandler(fun obj args -> window.Root.Close())
+    win.butClose.Click.AddHandler(fun obj args -> win.Root.Close())
 
-    window.Root.ShowDialog() |> ignore
+    win.Root.ShowDialog() |> ignore