From 48ecdfc43001c444eff6ad442986049384674af2 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Sun, 17 Jan 2016 19:39:37 +0100 Subject: [PATCH] Add an about window. --- Parasitemia/Parasitemia/AssemblyInfo.fs | 18 +++++----- Parasitemia/Parasitemia/GUI/About.fs | 33 +++++++++++++++++++ Parasitemia/Parasitemia/GUI/AboutWindow.xaml | 24 ++++++++++++++ .../Parasitemia/GUI/AboutWindow.xaml.fs | 6 ++++ Parasitemia/Parasitemia/GUI/Analysis.fs | 3 +- Parasitemia/Parasitemia/GUI/GUI.fs | 20 +++++++---- Parasitemia/Parasitemia/GUI/MainWindow.xaml | 3 ++ Parasitemia/Parasitemia/Parasitemia.fsproj | 3 ++ 8 files changed, 92 insertions(+), 18 deletions(-) create mode 100644 Parasitemia/Parasitemia/GUI/About.fs create mode 100644 Parasitemia/Parasitemia/GUI/AboutWindow.xaml create mode 100644 Parasitemia/Parasitemia/GUI/AboutWindow.xaml.fs 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 + +