X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FAbout.fs;h=5d0a17d8e0e78c2d56e71a5019077f282319d262;hp=44dd881d4e84c42defd400ddb2ebba10f8b98d18;hb=3c43609ff19e07331977fb7b62757cc3abd73387;hpb=e588f9c954a54cb259b2c1f6f9e8d9dbd4639269 diff --git a/Parasitemia/ParasitemiaUI/About.fs b/Parasitemia/ParasitemiaUI/About.fs index 44dd881..5d0a17d 100644 --- a/Parasitemia/ParasitemiaUI/About.fs +++ b/Parasitemia/ParasitemiaUI/About.fs @@ -1,45 +1,37 @@ module ParasitemiaUI.About -open System open System.Windows -open System.Windows.Media -open System.Windows.Markup -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. +open ParasitemiaUIControls - let ctrl (name: string): 'a = window.Root.FindName(name) :?> 'a +let showWindow (parent : Window) = + let win = AboutWindow () + win.Owner <- parent - 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" + 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) + win.txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun txtVersion - let navigateTo = Navigation.RequestNavigateEventHandler(fun obj args -> - Process.Start(ProcessStartInfo(args.Uri.AbsoluteUri)) |> ignore - args.Handled <- true) + let navigateTo = + Navigation.RequestNavigateEventHandler ( + fun obj args -> + Process.Start (ProcessStartInfo (args.Uri.AbsoluteUri, UseShellExecute = true)) |> 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.Close ()) - window.Root.ShowDialog() |> ignore + win.ShowDialog () |> ignore