X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FDPICalculator.fs;h=2cdc184aa36555d2364351841d1c7dff86be67ca;hp=c8d25c86f6865d38e3b0136d85bd754c9f7eaecd;hb=2d712781def419c9acc98368f7102b19b064f16d;hpb=d715615d0b1da40fd10e9dbabbd4530cd5125a19 diff --git a/Parasitemia/ParasitemiaUI/DPICalculator.fs b/Parasitemia/ParasitemiaUI/DPICalculator.fs index c8d25c8..2cdc184 100644 --- a/Parasitemia/ParasitemiaUI/DPICalculator.fs +++ b/Parasitemia/ParasitemiaUI/DPICalculator.fs @@ -14,13 +14,13 @@ open ParasitemiaCore.UnitsOfMeasure open Types let showWindow (parent : Window) : int option = - let win = Views.PPICalculatorWindow() + let win = Views.PPICalculatorWindow () win.Owner <- parent win.Left <- parent.Left + parent.ActualWidth / 2. - win.Width / 2. win.Top <- parent.Top + parent.ActualHeight / 2. - win.Height / 2. for size in Utils.sensorSizes do - win.cmbSensorSize.Items.Add(size) |> ignore + win.cmbSensorSize.Items.Add (size) |> ignore win.cmbSensorSize.SelectedIndex <- 0 let resolution (w_p : float) (w_mm : float) (zoom : float) : float = @@ -30,7 +30,7 @@ let showWindow (parent : Window) : int option = let { w = w; h = h } = win.cmbSensorSize.SelectedValue :?> SensorSize let ratio = h / w - let parseDouble txt errorMess = match Double.TryParse(txt) with true, value -> Success value | _ -> Fail errorMess + let parseDouble txt errorMess = match Double.TryParse (txt) with true, value -> Success value | _ -> Fail errorMess match (result { @@ -39,17 +39,17 @@ let showWindow (parent : Window) : int option = let wPixel = 1. * sqrt (sensorResolution * 1e6 / ratio) return! Success (float <| resolution wPixel w zoom) }) with - | Success res -> win.txtImageResolution.Text <- (int (res / 1000.) * 1000).ToString() + | Success res -> win.txtImageResolution.Text <- int (res / 1000.) * 1000 |> string | Fail mess -> win.txtImageResolution.Text <- mess - win.butCancel.Click.AddHandler(fun obj args -> win.DialogResult <- Nullable(false); win.Close()) - win.butOK.Click.AddHandler(fun obj args -> win.DialogResult <- Nullable(true); win.Close()) + win.butCancel.Click.AddHandler (fun obj args -> win.DialogResult <- Nullable (false); win.Close ()) + win.butOK.Click.AddHandler (fun obj args -> win.DialogResult <- Nullable (true); win.Close ()) - win.cmbSensorSize.SelectionChanged.AddHandler(fun obj arg -> updateCurrentResolution ()) - win.txtSensorResolution.TextChanged.AddHandler(fun obj arg -> updateCurrentResolution ()) - win.txtZoom.TextChanged.AddHandler(fun obj arg -> updateCurrentResolution ()) + win.cmbSensorSize.SelectionChanged.AddHandler (fun obj arg -> updateCurrentResolution ()) + win.txtSensorResolution.TextChanged.AddHandler (fun obj arg -> updateCurrentResolution ()) + win.txtZoom.TextChanged.AddHandler (fun obj arg -> updateCurrentResolution ()) - let result = win.ShowDialog() + let result = win.ShowDialog () if result.HasValue && result.Value then match Int32.TryParse win.txtImageResolution.Text with | true, res -> Some res