X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FAbout.fs;h=452573a11bf8fe0f1062dad28b9c2e7876bf74f1;hb=b87b35b922551f122228df1fd9c530bbb807935a;hp=5f9ce8184837ab872f5fa95742c43bf5d2a7c121;hpb=4bfa3cbdc6145e6944f02e24829ab2ef3a851ac1;p=master-thesis.git diff --git a/Parasitemia/ParasitemiaUI/About.fs b/Parasitemia/ParasitemiaUI/About.fs index 5f9ce81..452573a 100644 --- a/Parasitemia/ParasitemiaUI/About.fs +++ b/Parasitemia/ParasitemiaUI/About.fs @@ -8,26 +8,30 @@ open System.Windows.Shapes 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 showWindow (parent : Window) = + let win = Views.AboutWindow() + win.Owner <- parent - let ctrl (name: string): 'a = window.Root.FindName(name) :?> 'a - - let butClose: Button = ctrl "butClose" - let txtAbout: TextBlock = ctrl "txtAbout" + win.Left <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Left) + parent.ActualWidth / 2. - win.Width / 2. + win.Top <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Top) + parent.ActualHeight / 2. - win.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) + let txtVersion = sprintf " %d.%d.%d" version.Major version.Minor version.Revision + 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.Close()) - window.Root.ShowDialog() |> ignore + win.ShowDialog() |> ignore