Navigation to order initiated by the plugin (continued)
In API V8, they took the second step towards the ability to show dialog boxes and navigate to the order at the initiative of the plugin from different screens.
In one of the previous news we talked about ways to navigate to an order using plugin buttons or from the order editing screen. Now this navigation is supported from other screens:
IAdditionalOperationsScreen
— Additional operationsIOpenOrdersScreen
— Open ordersIClosedOrdersScreen
— Closed ordersIDocumentsScreen
— DocumentsIPreliminaryOrdersScreen
— Preliminary ordersISectionSchemaScreen
— Section schemaIOrdersByTablesScreen
— Orders by tablesIOrdersByWaiterScreen
— Orders by waiterITabsByWaiterScreen
— Tabs by waitersIDeliveriesScreen
— DeliveriesIReservesScreen
— Reserves
To understand that we are on a screen that supports working with the UI, we need to subscribe to the event
ScreenChanged
.
If the screen that came to the event is one of the screens listed above, you can call a new method
TryExecuteUiOperation
,
to which you need to pass a link to the callback, which iikoFront will call as soon as such an opportunity arises.
If there is no action, this will happen immediately, and if other operations are being performed at this moment, the callback will be called immediately upon their completion.
In any case, the TryExecuteUiOperation
method will return control after calling the callback.
If the callback throws an exception, it will be thrown out of TryExecuteUiOperation
.
If at the time of calling TryExecuteUiOperation
another operation was in progress, which ultimately led to exit from the current screen,
callback cannot be called either immediately or delayed, and the TryExecuteUiOperation
method will throw an OperationCanceledException
exception.
A progressbar is shown while the callback is running. The callback will be sent
IViewManager
with the ability to show dialog boxes and
change text on progressbar,
and also with the possibility
navigate to order.
Navigation is only possible in an open order. When calling the method, the corresponding rights of the currently logged in employee at the front are checked. The same ones that are checked when navigating by pressing the buttons on the front itself. Navigation to delivery order is not yet possible.