X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FAnalysis.fs;h=1747fc26bf082f2a9de5b059089a16766f95fec6;hp=43987d1cf3d890ab15f79c4e3003dc9301093ddd;hb=8866c578f1210295bdcf04c8212eae81d52d630a;hpb=95f9edf71456c8bf89a91850800f66efc2c9d4da diff --git a/Parasitemia/ParasitemiaUI/Analysis.fs b/Parasitemia/ParasitemiaUI/Analysis.fs index 43987d1..1747fc2 100644 --- a/Parasitemia/ParasitemiaUI/Analysis.fs +++ b/Parasitemia/ParasitemiaUI/Analysis.fs @@ -20,7 +20,7 @@ let showWindow (parent : Window) (state : State.State) : bool = let logListener = { new Logger.IListener with - member this.NewEntry severity _header mess = + member this.NewEntry severity header mess = win.Dispatcher.Invoke ( fun () -> win.textLog.Inlines.Add (Documents.Run mess) @@ -107,6 +107,18 @@ let showWindow (parent : Window) (state : State.State) : bool = else Some parameters + win.butSelectAll.Click.AddHandler ( + fun obj args -> + for srcImgCtrl in win.stackSourceImagesSelection.Children |> Seq.cast do + srcImgCtrl.chkSelection.IsChecked <- true + ) + + win.butUnselectAll.Click.AddHandler ( + fun obj args -> + for srcImgCtrl in win.stackSourceImagesSelection.Children |> Seq.cast do + srcImgCtrl.chkSelection.IsChecked <- false + ) + win.butClose.Click.AddHandler (fun obj args -> win.Close ()) win.butStart.Click.AddHandler ( @@ -125,11 +137,16 @@ let showWindow (parent : Window) (state : State.State) : bool = MessageBox.Show ("No image selected", "Cannot start analysis", MessageBoxButton.OK, MessageBoxImage.Information) |> ignore else win.stackSourceImagesSelection.IsEnabled <- false + win.butSelectAll.IsEnabled <- false + win.butUnselectAll.IsEnabled <- false analysisPerformed <- false win.butStart.IsEnabled <- false win.textLog.Text <- "" win.butClose.Content <- "Abort" + let sw = System.Diagnostics.Stopwatch () + sw.Start () + async { let maybeResults = ParasitemiaCore.Analysis.doMultipleAnalysis @@ -142,7 +159,7 @@ let showWindow (parent : Window) (state : State.State) : bool = | Some results -> for id, cells in results do state.SetResult id cells - Logger.Log.Info "All analyses terminated successfully" + Logger.Log.Info $"All analyses terminated successfully (total time: %d{sw.ElapsedMilliseconds} ms)" atLeastOneAnalysisPerformed <- true analysisPerformed <- true | None -> @@ -152,6 +169,8 @@ let showWindow (parent : Window) (state : State.State) : bool = fun () -> win.progress.Value <- if maybeResults.IsSome then 100. else 0. win.stackSourceImagesSelection.IsEnabled <- true + win.butSelectAll.IsEnabled <- true + win.butUnselectAll.IsEnabled <- true win.butStart.IsEnabled <- true win.butClose.Content <- "Close" updateSourceImages () @@ -165,7 +184,7 @@ let showWindow (parent : Window) (state : State.State) : bool = win.ShowDialog () |> ignore - Logger.Log.RmListener (logListener) + Logger.Log.RemoveListener (logListener) lock monitor ( fun () ->