Add two buttons to select or unselect all image to analyse
[master-thesis.git] / Parasitemia / ParasitemiaUI / Analysis.fs
index 43987d1..928c15f 100644 (file)
@@ -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<ImageSourceSelection> do
+                srcImgCtrl.chkSelection.IsChecked <- true
+    )
+
+    win.butUnselectAll.Click.AddHandler (
+        fun obj args ->
+            for srcImgCtrl in win.stackSourceImagesSelection.Children |> Seq.cast<ImageSourceSelection> do
+                srcImgCtrl.chkSelection.IsChecked <- false
+    )
+
     win.butClose.Click.AddHandler (fun obj args -> win.Close ())
 
     win.butStart.Click.AddHandler (
@@ -125,6 +137,8 @@ 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 <- ""
@@ -152,6 +166,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 ()