X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FAnalysis.fs;fp=Parasitemia%2FParasitemiaUI%2FAnalysis.fs;h=9b9ed510f0da0b5766e38f1c451b2655faa87655;hp=24f9adbcaa743661dbebb0243cb2f5f80f1c13b0;hb=6c70577f0bcc17881c753f7a527d2ff4672bb6aa;hpb=3990946e49fe34e9adcf0e04b0418cd16676e6fe diff --git a/Parasitemia/ParasitemiaUI/Analysis.fs b/Parasitemia/ParasitemiaUI/Analysis.fs index 24f9adb..9b9ed51 100644 --- a/Parasitemia/ParasitemiaUI/Analysis.fs +++ b/Parasitemia/ParasitemiaUI/Analysis.fs @@ -117,30 +117,34 @@ let showWindow (parent: Window) (state: State.State) : bool = then MessageBox.Show("No image selected", "Cannot start analysis", MessageBoxButton.OK, MessageBoxImage.Information) |> ignore else + stackSourceImagesSelection.IsEnabled <- false analysisPerformed <- false butStart.IsEnabled <- false butClose.Content <- "Abort" + async { - let results = + let maybeResults = ParasitemiaCore.Analysis.doMultipleAnalysis imagesToProcess - (Some (fun progress -> window.Root.Dispatcher.Invoke(fun () -> progressBar.Value <- float progress))) + (Some (fun progress -> window.Root.Dispatcher.Invoke(fun () -> progressBar.Value <- float progress); not analysisCancelled)) lock monitor ( fun() -> - if not analysisCancelled - then + match maybeResults with + | Some results -> for id, cells in results do state.SetResult (int id) cells window.Root.Dispatcher.Invoke(fun () -> + stackSourceImagesSelection.IsEnabled <- true butStart.IsEnabled <- true butClose.Content <- "Close" updateSourceImages ()) Logger.Log.User("All analyses terminated successfully") atLeastOneAnalysisPerformed <- true - analysisPerformed <- true) + analysisPerformed <- true + | None -> ()) } |> Async.Start | _ -> ())