Navigate to a configuration view
General
This page describes the possibility to open a configuration view within the antony client or the antonyHub. You might use it, if you detect a setting is not set or the user needs to configure something or a specific use-case.
TL;DR
Inject the
IClientConfigurationService
within the ClientGet the identifier of the setting to open or use a shortcut
Call
NavigateToConfiguration
Method
Long Description
To navigate to a configuration page you need to use the IClientConfigurationService
. Starting version 2.22.111 of antony, you can simply use this service by injecting it from DI.
This service only provides a single method NavigateToConfiguration
. Calling this method will open a new antony settings window with the given identifier as a selected node. The identifier you provide within this method is NOT the name or identifier of the configuration you want to show, but the name of the view. It might be a good idea to equalize them, as you develop a new module.
Precisely the identifier is the content of the AntonySettingsMenuNode.Identifier
property within antony or AntonyHubMenuNode.Identifier
within the antonyHub.
Below a simple example will open the Zoom settings from the TrainCommand on the dashboard. We simply know the identifier to navigate to as we are within the same module. To get the identifier of a foreign module you might inject an IEnumerable<…MenuNode> to detect the correct identifier. We don't provide another way till now.
public class TrainCommand : IDashboardCommand
{
// implementing selector and so on ...
private IClientConfigurationService _clientConfigurationService;
public TrainCommand(IClientConfigurationService clientConfigurationService)
{
_clientConfigurationService = clientConfigurationService;
}
Task ExecuteAsync(IntPtr parentWindow, IProgressReporter reporter);
{
_clientConfigurationService.NavigateToConfiguration("zoom_setting");
_clientConfigurationService.NavigateToDefaultMailBoxConfiguration();
}
}
The second line within the example will open the DefaultMailBoxConfigurationView. This is a shortcut to navigate to a well known navigation page which is included within antony by default. It is highly recommended to use these shortcuts. You can see the available shortcuts within the IClientConfigurationServiceExtensions
class defined within the ExtensionInterfaces
Conclusion
With the described interface it is possible to open a configuration window. It can be used within the specific use-cases within your module. For example “You cannot use my cool feature, as you dont have a configured default mailbox. Do you want to open the settings?”. This may your module becomes more user friendly.