Save imported image in the same format (WIP)
[master-thesis.git] / Parasitemia / ParasitemiaUI / Utils.fs
index 4dcb7d4..a536853 100644 (file)
@@ -103,4 +103,19 @@ let argsHelp =
     "Interactive mode:\n" +
     (sprintf "  %s [<document-file>] [--debug]\n" programName) +
     "    <document-file> : 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
+
+// Inspired by https://github.com/fsprojects/FSharp.ViewModule/blob/master/src/FSharp.ViewModule/FunCommand.fs
+type FunCommand (execute : obj -> unit, canExecute : obj -> bool) =
+    let canExecuteChanged = Event<EventHandler, EventArgs> ()
+
+    interface Input.ICommand with
+        [<CLIEvent>]
+        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