RBCFrameFromExisting srcImg rbc (win.canvasCurrentImage.Children.[currentCanvas] :?> Views.RBCFrame)
else
let f = RBCFrame srcImg rbc
- f.Opacity <- 0.7
win.canvasCurrentImage.Children.Add(f) |> ignore
f
displayStatusMessage "Document saved"
with
| :? IOException as ex ->
- Log.Error(ex.ToString())
+ Log.Error "%O" ex
MessageBox.Show(sprintf "The document cannot be save in \"%s\"" state.FilePath, "Error saving the document", MessageBoxButton.OK, MessageBoxImage.Error) |> ignore
let saveCurrentDocumentAsNewFile () =
updateGUI ()
with
| :? IOException as ex ->
- Log.Error(ex.ToString())
+ Log.Error "%O" ex
state.FilePath <- previousFilePath
MessageBox.Show(sprintf "The document cannot be loaded from \"%s\"" filepath, "Error loading the document", MessageBoxButton.OK, MessageBoxImage.Error) |> ignore
Export.exportResults state dialog.FileName
with
| :? IOException as ex ->
- Log.Error(ex.ToString())
+ Log.Error "%O" ex
MessageBox.Show(sprintf "The results cannot be exported in \"%s\"" state.FilePath, "Error exporting the files", MessageBoxButton.OK, MessageBoxImage.Error) |> ignore
let importImage () =
addPreview srcImg
with
| _ as ex ->
- Log.Error(ex.ToString())
+ Log.Error "%O" ex
MessageBox.Show(sprintf "Unable to read the image from \"%s\"" filename, "Error adding an image", MessageBoxButton.OK, MessageBoxImage.Error) |> ignore
updateGlobalParasitemia ()
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())
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)
)
) |> 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 ())