Save predefined PPI and sensor sizes in JSON files.
[master-thesis.git] / Parasitemia / ParasitemiaUI / DPICalculator.fs
index 5e9c19b..c1187ec 100644 (file)
@@ -8,15 +8,10 @@ open System.Windows.Shapes
 open System.Windows.Controls
 open System.Diagnostics
 
-open ParasitemiaCore.UnitsOfMeasure
 open ParasitemiaCore.Types
+open ParasitemiaCore.UnitsOfMeasure
 
-type SensorSize = {
-    w: float<mm>
-    h: float<mm>
-    txt: string } with
-    override this.ToString () =
-        sprintf "%g mm × %g mm%s" this.w this.h (if this.txt = "" then "" else " (" + this.txt + ")")
+open Types
 
 let showWindow (parent: Window) : int option =
     let win = Views.PPICalculatorWindow()
@@ -24,19 +19,7 @@ let showWindow (parent: Window) : int option =
     win.Root.Left <- parent.Left + parent.ActualWidth / 2. - win.Root.Width / 2.
     win.Root.Top <- parent.Top + parent.ActualHeight / 2. - win.Root.Height / 2.
 
-    let sensorSizes = [
-        { w = 5.76<mm>; h = 4.29<mm>; txt = "1/2.5″" }
-        { w = 7.6<mm>;  h = 5.7<mm>;  txt = "1/1.7″" }
-        { w = 8.6<mm>;  h = 6.6<mm>;  txt = "2/3″" }
-        { w = 13.2<mm>; h = 8.8<mm>;  txt = "1″" }
-        { w = 17.3<mm>; h = 13.<mm>;  txt = "" }
-        { w = 20.7<mm>; h = 13.8<mm>; txt = "" }
-        { w = 22.2<mm>; h = 14.8<mm>; txt = "" }
-        { w = 23.6<mm>; h = 15.7<mm>; txt = "" }
-        { w = 28.7<mm>; h = 19.<mm>;  txt = "" }
-        { w = 28.7<mm>; h = 19.<mm>;  txt = "" } ]
-
-    for size in sensorSizes do
+    for size in Utils.sensorSizes do
         win.cmbSensorSize.Items.Add(size) |> ignore
     win.cmbSensorSize.SelectedIndex <- 0