From ecf48cdb4f085eb6f53b42f9d4eac67b44a92d70 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Wed, 29 Mar 2017 12:59:54 +0200 Subject: [PATCH] Add some key shortcut. --- .../ParasitemiaCore/ParasitemiaCore.fsproj | 5 +-- Parasitemia/ParasitemiaCore/packages.config | 2 +- Parasitemia/ParasitemiaUI/GUI.fs | 45 ++++++++++++++----- .../ParasitemiaUI/ParasitemiaUI.fsproj | 5 +-- .../ParasitemiaUI/XAML/MainWindow.xaml | 4 +- Parasitemia/ParasitemiaUI/packages.config | 2 +- 6 files changed, 43 insertions(+), 20 deletions(-) diff --git a/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj b/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj index f3210a9..a0dda64 100644 --- a/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj +++ b/Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj @@ -78,9 +78,8 @@ ..\packages\FSharp.Collections.ParallelSeq.1.0.2\lib\net40\FSharp.Collections.ParallelSeq.dll True - - ..\packages\FSharp.Core.4.0.0.1\lib\net40\FSharp.Core.dll - True + + ..\packages\FSharp.Core.4.1.2\lib\net45\FSharp.Core.dll ..\packages\MathNet.Numerics.3.17.0\lib\net40\MathNet.Numerics.dll diff --git a/Parasitemia/ParasitemiaCore/packages.config b/Parasitemia/ParasitemiaCore/packages.config index 0bdf2f7..cbdda29 100644 --- a/Parasitemia/ParasitemiaCore/packages.config +++ b/Parasitemia/ParasitemiaCore/packages.config @@ -1,7 +1,7 @@  - + diff --git a/Parasitemia/ParasitemiaUI/GUI.fs b/Parasitemia/ParasitemiaUI/GUI.fs index ade197e..985c8a4 100644 --- a/Parasitemia/ParasitemiaUI/GUI.fs +++ b/Parasitemia/ParasitemiaUI/GUI.fs @@ -438,6 +438,16 @@ let run (defaultConfig : Config) (fileToOpen : string option) = if noSourceImage then updateCurrentImage () + let showAnalysisWindow () = + if Analysis.showWindow win state then + updateGlobalParasitemia () + updateCurrentImage () + + let setHighlightRBC (highlight : bool) = + displayHealthy <- highlight + updateRBCFramesPreview () + updateRBCFramesCurrent () + win.txtPatient.TextChanged.AddHandler(fun obj args -> state.PatientID <- win.txtPatient.Text) win.menuExit.Click.AddHandler(fun obj args -> win.Close()) @@ -451,17 +461,9 @@ let run (defaultConfig : Config) (fileToOpen : string option) = win.menuAnalysis.SubmenuOpened.AddHandler(fun obj args -> win.menuStartAnalysis.IsEnabled <- state.SourceImages.Count() > 0) - win.menuStartAnalysis.Click.AddHandler(fun obj args -> - if Analysis.showWindow win state then - updateGlobalParasitemia () - updateCurrentImage () - ) + win.menuStartAnalysis.Click.AddHandler(fun obj args -> showAnalysisWindow ()) - win.menuHightlightRBC.Click.AddHandler(fun obj args -> - displayHealthy <- win.menuHightlightRBC.IsChecked - updateRBCFramesPreview () - updateRBCFramesCurrent () - ) + win.menuHightlightRBC.Click.AddHandler(fun obj args -> setHighlightRBC win.menuHightlightRBC.IsChecked) win.menuAbout.Click.AddHandler(fun obj args -> About.showWindow win) @@ -601,6 +603,29 @@ let run (defaultConfig : Config) (fileToOpen : string option) = ) ) |> ignore + // Show analysis dialog. + win.InputBindings.Add( + Input.KeyBinding( + ViewModule.FunCommand((fun obj -> showAnalysisWindow ()), (fun obj -> state.SourceImages.Count() > 0)), + Input.KeyGesture(Input.Key.Y, Input.ModifierKeys.Control) + ) + ) |> ignore + + // Toggle RBC highlight. + win.InputBindings.Add( + Input.KeyBinding( + ViewModule.FunCommand( + ( + fun obj -> + win.menuHightlightRBC.IsChecked <- not win.menuHightlightRBC.IsChecked + setHighlightRBC win.menuHightlightRBC.IsChecked + ), + (fun obj -> true) + ), + Input.KeyGesture(Input.Key.H, Input.ModifierKeys.Control) + ) + ) |> ignore + // Viewport preview. win.scrollViewCurrentImage.ScrollChanged.AddHandler(fun obj args -> updateViewportPreview ()) diff --git a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj index 96b0732..365cc93 100644 --- a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj +++ b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj @@ -99,9 +99,8 @@ ..\..\..\Emgu\emgucv-windesktop 3.1.0.2282\bin\Emgu.CV.World.dll - - ..\packages\FSharp.Core.4.0.0.1\lib\net40\FSharp.Core.dll - True + + ..\packages\FSharp.Core.4.1.2\lib\net45\FSharp.Core.dll ..\packages\FSharp.ViewModule.Core.1.0.7.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\FSharp.ViewModule.dll diff --git a/Parasitemia/ParasitemiaUI/XAML/MainWindow.xaml b/Parasitemia/ParasitemiaUI/XAML/MainWindow.xaml index e84bd54..9ce3f20 100644 --- a/Parasitemia/ParasitemiaUI/XAML/MainWindow.xaml +++ b/Parasitemia/ParasitemiaUI/XAML/MainWindow.xaml @@ -19,10 +19,10 @@ - + - + diff --git a/Parasitemia/ParasitemiaUI/packages.config b/Parasitemia/ParasitemiaUI/packages.config index 79af972..432eb3c 100644 --- a/Parasitemia/ParasitemiaUI/packages.config +++ b/Parasitemia/ParasitemiaUI/packages.config @@ -1,7 +1,7 @@  - + -- 2.45.2