Piaz files wasn't associated during setup.
[master-thesis.git] / Parasitemia / ParasitemiaUI / Analysis.fs
index 2ff0b1e..2506015 100644 (file)
@@ -21,8 +21,8 @@ open Types
 let showWindow (parent: Window) (state: State.State) : bool =
     let win = Views.AnalysisWindow()
     win.Root.Owner <- parent
-    win.Root.Left <- parent.Left + parent.ActualWidth / 2. - win.Root.Width / 2.
-    win.Root.Top <- parent.Top + parent.ActualHeight / 2. - win.Root.Height / 2.
+    win.Root.Left <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Left) + parent.ActualWidth / 2. - win.Root.Width / 2.
+    win.Root.Top <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Top) + parent.ActualHeight / 2. - win.Root.Height / 2.
 
     let logListener =
         { new Logger.IListener with
@@ -60,8 +60,12 @@ let showWindow (parent: Window) (state: State.State) : bool =
             imageSourceSelection.lblDateLastAnalysis.Content <- if srcImg.dateLastAnalysis.Ticks = 0L then "<Never>" else srcImg.dateLastAnalysis.ToString()
 
             imageSourceSelection.txtResolution.Text <- if srcImg.dateLastAnalysis.Ticks = 0L then "" else srcImg.config.Parameters.resolution.ToString()
-            imageSourceSelection.menuZoom50X.Click.AddHandler(fun obj args -> imageSourceSelection.txtResolution.Text <- "230000")
-            imageSourceSelection.menuZoom100X.Click.AddHandler(fun obj args -> imageSourceSelection.txtResolution.Text <- "460000")
+
+            for ppi in Utils.predefinedPPI do
+                let menu = MenuItem()
+                menu.Header <- ppi.ToString()
+                menu.Click.AddHandler(fun obj args -> imageSourceSelection.txtResolution.Text <- ppi.ppi.ToString())
+                imageSourceSelection.predefinedValuesMenu.Items.Add(menu) |> ignore
 
             imageSourceSelection.butPPICalculator.Click.AddHandler(fun obj args ->
                 match PPICalculator.showWindow win.Root with