From: Greg Burri Date: Sun, 17 Jan 2016 18:39:37 +0000 (+0100) Subject: Add an about window. X-Git-Tag: 1.0.11~48 X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=commitdiff_plain;h=48ecdfc43001c444eff6ad442986049384674af2 Add an about window. --- diff --git a/Parasitemia/Parasitemia/AssemblyInfo.fs b/Parasitemia/Parasitemia/AssemblyInfo.fs index 269e427..1027e98 100644 --- a/Parasitemia/Parasitemia/AssemblyInfo.fs +++ b/Parasitemia/Parasitemia/AssemblyInfo.fs @@ -4,20 +4,20 @@ open System.Reflection open System.Runtime.CompilerServices open System.Runtime.InteropServices -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [] [] [] -[] +[] [] -[] +[] [] [] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [] @@ -25,13 +25,13 @@ open System.Runtime.InteropServices [] // Version information for an assembly consists of the following four values: -// +// // Major Version -// Minor Version +// Minor Version // Build Number // Revision -// -// You can specify all the values or you can default the Build and Revision Numbers +// +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [] [] diff --git a/Parasitemia/Parasitemia/GUI/About.fs b/Parasitemia/Parasitemia/GUI/About.fs new file mode 100644 index 0000000..bc8f3e5 --- /dev/null +++ b/Parasitemia/Parasitemia/GUI/About.fs @@ -0,0 +1,33 @@ +module Parasitemia.GUI.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. + + let ctrl (name: string): 'a = window.Root.FindName(name) :?> 'a + + let butClose: Button = ctrl "butClose" + let txtAbout: TextBlock = ctrl "txtAbout" + + 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) + +#if DEBUG + txtAbout.Inlines.FirstInline.ElementEnd.InsertTextInRun(" - DEBUG") +#endif + + butClose.Click.AddHandler(fun obj args -> window.Root.Close()) + + window.Root.ShowDialog() |> ignore + diff --git a/Parasitemia/Parasitemia/GUI/AboutWindow.xaml b/Parasitemia/Parasitemia/GUI/AboutWindow.xaml new file mode 100644 index 0000000..3cb0de4 --- /dev/null +++ b/Parasitemia/Parasitemia/GUI/AboutWindow.xaml @@ -0,0 +1,24 @@ + + + + + + + + + + Parasitemia + + HES-SO / + CHUV + + Grégory Burri + +