let run (defaultConfig: Config) (fileToOpen: string option) =
let app = new Application()
let mainWindow = Views.MainWindow()
- let ctrl (name: string): 'a =
- mainWindow.Root.FindName(name) :?> 'a
+ let ctrl (name: string): 'a = mainWindow.Root.FindName(name) :?> 'a
let colorRBCHealthy = Brushes.YellowGreen
let colorRBCInfected = Brushes.Red
let menuStartAnalysis: MenuItem = ctrl "menuStartAnalysis"
let menuView: MenuItem = ctrl "menuView"
let menuHightlightRBC: MenuItem = ctrl "menuHightlightRBC"
+ let menuAbout: MenuItem = ctrl "menuAbout"
let txtPatient: TextBox = ctrl "txtPatient"
let txtGlobalParasitemia: TextBox = ctrl "txtGlobalParasitemia"
updateGUI())
menuAddSourceImage.Click.AddHandler(fun obj args ->
- let dialog = OpenFileDialog(Filter = "Image Files|*.png;*.jpg;*.tif;*.tiff")
+ let dialog = OpenFileDialog(Filter = "Image Files|*.png;*.jpg;*.tif;*.tiff", Multiselect = true)
let res = dialog.ShowDialog()
if res.HasValue && res.Value
then
- let srcImg = state.AddSourceImage dialog.FileName defaultConfig
- addPreview srcImg
+ let noSourceImage = state.SourceImages.Count() = 0
+
+ for filename in dialog.FileNames do
+ let srcImg = state.AddSourceImage filename defaultConfig
+ addPreview srcImg
+
updateGlobalParasitemia ()
- if state.SourceImages.Count() = 1
+
+ if noSourceImage
then
updateCurrentImage ())
-
menuAnalysis.SubmenuOpened.AddHandler(fun obj args -> menuStartAnalysis.IsEnabled <- state.SourceImages.Count() > 0)
menuStartAnalysis.Click.AddHandler(fun obj args ->
updateRBCFramesPreview ()
updateRBCFramesCurrent ())
+ menuAbout.Click.AddHandler(fun obj args -> About.showWindow mainWindow.Root)
+
// Zoom on the current image.
let adjustCurrentImageBorders (deltaX: float) (deltaY: float) =
borderCurrentImage.BorderThickness <-