/
Howto provide a Command from the Dashboard.

Howto provide a Command from the Dashboard.

Tl;Dr;

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

services.AddTransient<IDashboardCommand, MyDashboardCommand>(); services.AddTransient<MyViewModel>();

Below a simple implementation of an IDashboardCommand showing a view to the AntUser.

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 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 event EventHandler CommandStateChanged; public CommandState GetCommandState() => CommandState.Normal; }

Conclusion

As you see, implementing an IDashboardCommandis 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.

Related content

Howto write an antony registry
Howto write an antony registry
More like this
Commands within the client
Commands within the client
More like this
Navigate to a configuration view
Navigate to a configuration view
More like this
Create a ICallCommand
Create a ICallCommand
More like this
Create a command within an flexobject
Create a command within an flexobject
More like this
Howto write an ChatCommand
Howto write an ChatCommand
More like this