X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FAbout.fs;h=908ccd5d17efdceac5e45fe7e3f56235a8fe49e2;hb=2e3cd07dd099944059ef5e7a7f5ef57ffe3d677b;hp=5f1be66a321c843b823f1c0cba953dd5bc8822b8;hpb=f765276ea9abd8be286a17fae45509dde749812b;p=master-thesis.git diff --git a/Parasitemia/ParasitemiaUI/About.fs b/Parasitemia/ParasitemiaUI/About.fs index 5f1be66..908ccd5 100644 --- a/Parasitemia/ParasitemiaUI/About.fs +++ b/Parasitemia/ParasitemiaUI/About.fs @@ -9,25 +9,29 @@ 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 win = Views.AboutWindow() + win.Root.Owner <- parent - let ctrl (name: string): 'a = window.Root.FindName(name) :?> 'a - - let butClose: Button = ctrl "butClose" - let txtAbout: TextBlock = ctrl "txtAbout" + win.Root.Left <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Left) + parent.ActualWidth / 2. - win.Root.Width / 2. + win.Root.Top <- (if parent.WindowState = WindowState.Maximized then 0. else 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) + + 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