diff options
Diffstat (limited to 'Samples/common/src')
| -rw-r--r-- | Samples/common/src/Extensions.cs | 6 | ||||
| -rw-r--r-- | Samples/common/src/SampleBase.cs | 30 | ||||
| -rw-r--r-- | Samples/common/src/SampleBaseForEditor.cs | 20 |
3 files changed, 28 insertions, 28 deletions
diff --git a/Samples/common/src/Extensions.cs b/Samples/common/src/Extensions.cs index b4b0a1e5..7647dbc9 100644 --- a/Samples/common/src/Extensions.cs +++ b/Samples/common/src/Extensions.cs @@ -8,11 +8,11 @@ namespace Samples { public static CommandGroup GetCommands (this System.IO.DirectoryInfo di) => new CommandGroup( - new Command ("Set as root", ()=> {SampleBaseForEditor.CurrentProgramInstance.CurrentDir = di.FullName;}) - ); + new ActionCommand ("Set as root", ()=> {SampleBaseForEditor.CurrentProgramInstance.CurrentDir = di.FullName;}) + ); public static CommandGroup GetCommands (this System.IO.FileInfo fi) => new CommandGroup( - new Command ("Delete", (sender0) => { + new ActionCommand ("Delete", (sender0) => { MessageBox.ShowModal (SampleBaseForEditor.CurrentProgramInstance, MessageBox.Type.YesNo, $"Delete {fi.Name}?").Yes += (sender, e) => { System.IO.File.Delete(fi.FullName); Widget listContainer = ((sender0 as Widget).LogicalParent as Widget).DataSource as Widget; diff --git a/Samples/common/src/SampleBase.cs b/Samples/common/src/SampleBase.cs index 1c516bfa..0622c2cf 100644 --- a/Samples/common/src/SampleBase.cs +++ b/Samples/common/src/SampleBase.cs @@ -48,43 +48,43 @@ namespace Samples static void showMsgBox (object sender) { Widget w = sender as Widget; - Command cmd = w.DataSource as Command; + ActionCommand cmd = w.DataSource as ActionCommand; MessageBox.ShowModal(w.IFace, MessageBox.Type.Information, $"{cmd?.Caption} CLICKED"); } #region Test values for Binding public CommandGroup Commands, AllCommands; public CommandGroup EditCommands = new CommandGroup("Edit Commands", - new Command("Edit command 1", (sender) => showMsgBox (sender)), - new Command("Edit command 2 a bit longer", (sender) => showMsgBox (sender), null, false), - new Command("Edit command three", (sender) => showMsgBox (sender)), + new ActionCommand("Edit command 1", (sender) => showMsgBox (sender)), + new ActionCommand("Edit command 2 a bit longer", (sender) => showMsgBox (sender), null, false), + new ActionCommand("Edit command three", (sender) => showMsgBox (sender)), new CommandGroup("Subedit menu", - new Command("Subedit command 1", (sender) => showMsgBox (sender)), - new Command("Subedit command 2 a bit longer", (sender) => showMsgBox (sender), null, false), - new Command("Subedit command three", (sender) => showMsgBox (sender)) + new ActionCommand("Subedit command 1", (sender) => showMsgBox (sender)), + new ActionCommand("Subedit command 2 a bit longer", (sender) => showMsgBox (sender), null, false), + new ActionCommand("Subedit command three", (sender) => showMsgBox (sender)) ) ); public CommandGroup FileCommands = new CommandGroup("File Commands", - new Command("File command 1", (sender) => showMsgBox (sender), "#Icons.gavel.svg"), - new Command("File command 2 a bit longer", (sender) => showMsgBox (sender)), - new Command("File command three", (sender) => showMsgBox (sender)) + new ActionCommand("File command 1", (sender) => showMsgBox (sender), "#Icons.gavel.svg"), + new ActionCommand("File command 2 a bit longer", (sender) => showMsgBox (sender)), + new ActionCommand("File command three", (sender) => showMsgBox (sender)) ); - public Command SingleCommand => new Command("Single command 1", (sender) => showMsgBox (sender), "#Icons.gavel.svg"); + public ActionCommand SingleCommand => new ActionCommand("Single command 1", (sender) => showMsgBox (sender), "#Icons.gavel.svg"); public ToggleCommand CMDToggleBoolVal => new ToggleCommand ("Toggle", this, "BoolVal", "#Icons.gavel.svg", true); public ToggleCommand CMDToggleBoolValField => new ToggleCommand ("ToggleField", this, "boolVal", "#Icons.gavel.svg", true); void initCommands() { Commands = new CommandGroup("commands msg boxes", - new Command("Action 1", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 1 clicked")), - new Command("Action two", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 2 clicked"), null, false), - new Command("Action three", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 3 clicked")) + new ActionCommand("Action 1", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 1 clicked")), + new ActionCommand("Action two", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 2 clicked"), null, false), + new ActionCommand("Action three", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 3 clicked")) ); AllCommands = new CommandGroup ("All Commands", FileCommands, EditCommands, new CommandGroup ("Combined commands", FileCommands, EditCommands), - new Command("Action A", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu A clicked")) + new ActionCommand("Action A", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu A clicked")) ); } public int intValue = 500; diff --git a/Samples/common/src/SampleBaseForEditor.cs b/Samples/common/src/SampleBaseForEditor.cs index 6c6b60b8..47b93103 100644 --- a/Samples/common/src/SampleBaseForEditor.cs +++ b/Samples/common/src/SampleBaseForEditor.cs @@ -129,20 +129,20 @@ namespace Samples public new bool IsDirty => source != origSource; - public Command CMDNew, CMDOpen, CMDSave, CMDSaveAs, CMDQuit, CMDShowLeftPane, + public ActionCommand CMDNew, CMDOpen, CMDSave, CMDSaveAs, CMDQuit, CMDShowLeftPane, CMDUndo, CMDRedo, CMDCut, CMDCopy, CMDPaste, CMDHelp, CMDAbout, CMDOptions; public CommandGroup EditorCommands => new CommandGroup (CMDUndo, CMDRedo, CMDCut, CMDCopy, CMDPaste, CMDSave, CMDSaveAs); protected virtual void initCommands () { - CMDNew = new Command ("New", new Action (onNewFile), "#Icons.blank-file.svg"); - CMDSave = new Command ("Save", new Action (onSave), "#Icons.save.svg", false); - CMDSaveAs = new Command ("Save As...", new Action (onSaveAs), "#Icons.save.svg"); - CMDQuit = new Command ("Quit", new Action (() => base.Quit ()), "#Icons.exit.svg"); - CMDUndo = new Command ("Undo", new Action (undo),"#Icons.undo.svg", false); - CMDRedo = new Command ("Redo", new Action (redo),"#Icons.redo.svg", false); - CMDCut = new Command ("Cut", new Action (cut), "#Icons.scissors.svg", false); - CMDCopy = new Command ("Copy", new Action (copy), "#Icons.copy-file.svg", false); - CMDPaste= new Command ("Paste", new Action (paste), "#Icons.paste-on-document.svg", false); + CMDNew = new ActionCommand ("New", new Action (onNewFile), "#Icons.blank-file.svg"); + CMDSave = new ActionCommand ("Save", new Action (onSave), "#Icons.save.svg", false); + CMDSaveAs = new ActionCommand ("Save As...", new Action (onSaveAs), "#Icons.save.svg"); + CMDQuit = new ActionCommand ("Quit", new Action (() => base.Quit ()), "#Icons.exit.svg"); + CMDUndo = new ActionCommand ("Undo", new Action (undo),"#Icons.undo.svg", false); + CMDRedo = new ActionCommand ("Redo", new Action (redo),"#Icons.redo.svg", false); + CMDCut = new ActionCommand ("Cut", new Action (cut), "#Icons.scissors.svg", false); + CMDCopy = new ActionCommand ("Copy", new Action (copy), "#Icons.copy-file.svg", false); + CMDPaste= new ActionCommand ("Paste", new Action (paste), "#Icons.paste-on-document.svg", false); } |