...
Code Block |
---|
public class MyDashboardCommand: IDashboardCommand, IModuleSelector<DashboardCommandSelector> { public IModuleSelector<DashboardCommandSelector> Selector => this; public AntonyPriority GetPriority(DashboardCommandSelector selectorParameter) => AntonyPriority.Explicit; private Func<MyViewModel> _viewModel; public MyDashboardCommand(Func<MyViewModel> viewModel) { _viewModel = viewModel; } public AntonyCommandInfo ActionInfo => new AntonyCommandInfoBuilder() .WithSvgImage(Resources.logo) .WithDisplayName("MyViewCommand") .WithGeneralPageName() .WithGroupName("MyModule") .WithLargeRibbonImage() .Build(); public event EventHandler CommandStateChanged; public Task ExecuteAsync(IntPtr parentWindow, IProgressReporter reporter) { var viewModel = _viewModel(); var view = new MyView(); view.DataContext = viewModel; ElementHost.EnableModelessKeyboardInterop(view); // needs a antony is WinForms view.Show(); return Task.CompletedTask; } public CommandState GetCommandState() public event EventHandler {CommandStateChanged; public CommandState GetCommandState() => return CommandState.Normal; } } |
Conclusion
As you see, implementing an IDashboardCommand
is easy. You can use this ExtensionPoint to provide a simple shortcut to external programms for example like “Open MyERP”.
...