// 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
// 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
// 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
// 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
// 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
// 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
// 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
// Toggle RBC highlight.
win.InputBindings.Add (
Input.KeyBinding (
- ViewModule.FunCommand (
+ Utils.FunCommand (
(
fun obj ->
win.menuHightlightRBC.IsChecked <- not win.menuHightlightRBC.IsChecked
"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
+
+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