...
Create a module and provide an IDashboardCommand
into antony’s DI Container. This command will be displayed in the RibbonBar of the Dashboard, if selector passes.
...
Example
Create a class, implement the IDashboardCommand
within, and register it within the DI Container
...
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() { 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”.
You might also create some more integrated logic like open a prefilled MailWindow, create an appointment directly from dashboard and so on and so far.