From: Greg Burri Date: Fri, 2 Apr 2021 20:10:48 +0000 (+0200) Subject: Remove the dependency to ViewModule X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;h=3e1a96b6a5648ec75f019b40d4ce4b7e9cae3650;p=master-thesis.git Remove the dependency to ViewModule --- diff --git a/Parasitemia/ParasitemiaUI/GUI.fs b/Parasitemia/ParasitemiaUI/GUI.fs index 69ae1f9..3b67894 100644 --- a/Parasitemia/ParasitemiaUI/GUI.fs +++ b/Parasitemia/ParasitemiaUI/GUI.fs @@ -590,7 +590,7 @@ let run (defaultConfig : Config) (fileToOpen : string option) = // Save. win.InputBindings.Add ( Input.KeyBinding ( - ViewModule.FunCommand ((fun obj -> saveCurrentDocument ()), (fun obj -> true)), + Utils.FunCommand ((fun obj -> saveCurrentDocument ()), (fun obj -> true)), Input.KeyGesture (Input.Key.S, Input.ModifierKeys.Control) ) ) |> ignore @@ -598,7 +598,7 @@ let run (defaultConfig : Config) (fileToOpen : string option) = // Save as. win.InputBindings.Add ( Input.KeyBinding ( - ViewModule.FunCommand ((fun obj -> saveCurrentDocumentAsNewFile ()), (fun obj -> true)), + Utils.FunCommand ((fun obj -> saveCurrentDocumentAsNewFile ()), (fun obj -> true)), Input.KeyGesture (Input.Key.S, Input.ModifierKeys.Control ||| Input.ModifierKeys.Shift) ) ) |> ignore @@ -606,7 +606,7 @@ let run (defaultConfig : Config) (fileToOpen : string option) = // Open. win.InputBindings.Add ( Input.KeyBinding ( - ViewModule.FunCommand ((fun obj -> askLoadFile ()), (fun obj -> true)), + Utils.FunCommand ((fun obj -> askLoadFile ()), (fun obj -> true)), Input.KeyGesture (Input.Key.O, Input.ModifierKeys.Control) ) ) |> ignore @@ -614,7 +614,7 @@ let run (defaultConfig : Config) (fileToOpen : string option) = // New file. win.InputBindings.Add ( Input.KeyBinding ( - ViewModule.FunCommand ((fun obj -> newFile ()), (fun obj -> true)), + Utils.FunCommand ((fun obj -> newFile ()), (fun obj -> true)), Input.KeyGesture (Input.Key.N, Input.ModifierKeys.Control) ) ) |> ignore @@ -622,7 +622,7 @@ let run (defaultConfig : Config) (fileToOpen : string option) = // Export results. win.InputBindings.Add ( Input.KeyBinding ( - ViewModule.FunCommand ((fun obj -> exportResults ()), (fun obj -> true)), + Utils.FunCommand ((fun obj -> exportResults ()), (fun obj -> true)), Input.KeyGesture (Input.Key.E, Input.ModifierKeys.Control) ) ) |> ignore @@ -630,7 +630,7 @@ let run (defaultConfig : Config) (fileToOpen : string option) = // Import an image. win.InputBindings.Add ( Input.KeyBinding ( - ViewModule.FunCommand ((fun obj -> importImage ()), (fun obj -> true)), + Utils.FunCommand ((fun obj -> importImage ()), (fun obj -> true)), Input.KeyGesture (Input.Key.A, Input.ModifierKeys.Control) ) ) |> ignore @@ -638,7 +638,7 @@ let run (defaultConfig : Config) (fileToOpen : string option) = // Show analysis dialog. win.InputBindings.Add ( Input.KeyBinding ( - ViewModule.FunCommand ((fun obj -> showAnalysisWindow ()), (fun obj -> state.SourceImages.Count () > 0)), + Utils.FunCommand ((fun obj -> showAnalysisWindow ()), (fun obj -> state.SourceImages.Count () > 0)), Input.KeyGesture (Input.Key.Y, Input.ModifierKeys.Control) ) ) |> ignore @@ -646,7 +646,7 @@ let run (defaultConfig : Config) (fileToOpen : string option) = // Toggle RBC highlight. win.InputBindings.Add ( Input.KeyBinding ( - ViewModule.FunCommand ( + Utils.FunCommand ( ( fun obj -> win.menuHightlightRBC.IsChecked <- not win.menuHightlightRBC.IsChecked diff --git a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj index 70626b0..11d01bb 100644 --- a/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj +++ b/Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj @@ -44,7 +44,6 @@ - diff --git a/Parasitemia/ParasitemiaUI/Utils.fs b/Parasitemia/ParasitemiaUI/Utils.fs index 4dcb7d4..927e441 100644 --- a/Parasitemia/ParasitemiaUI/Utils.fs +++ b/Parasitemia/ParasitemiaUI/Utils.fs @@ -103,4 +103,18 @@ let argsHelp = "Interactive mode:\n" + (sprintf " %s [] [--debug]\n" programName) + " : a PIAZ file to automatically open at startup\n" + - " --debug : output information like intermediate images in the current directory (it takes more CPU and memory)" \ No newline at end of file + " --debug : output information like intermediate images in the current directory (it takes more CPU and memory)" + +open System +open System.Windows + +type FunCommand (execute : obj -> unit, canExecute : obj -> bool) = + let canExecuteChanged = Event () + + interface Input.ICommand with + [] + member this.CanExecuteChanged = canExecuteChanged.Publish + + member this.CanExecute (param : obj) = canExecute param + + member this.Execute (param : obj) = execute param \ No newline at end of file diff --git a/Parasitemia/Tests/ParasitemiaCore.Tests/ParasitemiaCore.Tests.fsproj b/Parasitemia/Tests/ParasitemiaCore.Tests/ParasitemiaCore.Tests.fsproj index 45f05bb..ef3112b 100644 --- a/Parasitemia/Tests/ParasitemiaCore.Tests/ParasitemiaCore.Tests.fsproj +++ b/Parasitemia/Tests/ParasitemiaCore.Tests/ParasitemiaCore.Tests.fsproj @@ -12,7 +12,7 @@ - +