Managed Operations. Getting Started

In this lesson you will learn, how to implement an application method using the Managed Operations service. We will design the SimpleOperation class that exposes the ExecuteCore method. We will implement execution of this method as a Synchronous Managed Operation with a progress bar. The launch of the operation will be initiated using the Simple Action startSimpleOperation. Then we will look at other ways to display a running process. Follow the steps described below.

  • Add XafariManagedOperationsModule and XafariManagedOperationsCfgModule to the required project (for instance, to the Module Project). XafariManagedOperationsCfgModule provides a viewing and editing the Managed Operations at runtime. To learn more, refer to the Managed Operations in Application topic.
  • Add XafariManagedOperationsWinModule to the Windows Forms Application Project.
  • Add XafariManagedOperationsWebModule to the Web Application Project.
  • Add a new class to the Module Project, name it SimpleOperation. Replace the automatically generated code with the following code.
  • Add a new View Controller to the Module Project, name it StartManagedOperationViewController.
  • Add a new Simple Action to the StartManagedOperationViewController View Controller, name it startSimpleOperation. Use the following code to handle the startSimpleOperation_Execute event:
  • It is necessary to ensure user access to the Managed Operations List View. To do this, invoke the Model Editor, navigate to the NavigationItems|Items|Default|Items node, add a new Navigation Item, and set the View property to "ManagedOperationStorage_ListView", as shown in the figure below.

managed_operations_6

  • To see the result, run the WinForms or ASP.NET application.
  • Select Operations in the main menu and click the startSimpleOperation action. You can see the launch and execution of the ExecuteCore method under the Managed Operations.

managed_operations_7

Note:

Select the local type (Local) of the displayed operations in the ManagedOperationStorage_ListView toolbar.

  • After termination you can invoke a Detail View of the executed operation and see the log.

Win:

managed_operations_8

You can view the code used in this topic in the Operation1.cs file and SyncManagedOperationsWindowController.cs file  (SyncProgress_Execute method) of the Xafari Northwind demo installed with Xafari.

Note:

In this example, the execution of the Synchronous Managed Operation was displayed in the progress bar. It is also possible to use the infinite scrolling bar or the Detail View of the executed operation. The respective examples are included in the Xafari Northwind demo application.

managed_operations_9

Display modes are provided by the SyncManagedOperationHelper class. It is possible to change the display mode in the StartSimpleOperation_Execute event handler (see the code above).

  • infinite scrolling bar:
  • example

SyncManagedOperationHelper.CreateHelper(managedOperation).InitShowViewParametersMarquee(e.ShowViewParameters, true);

  • Detail View:
  • example

SyncManagedOperationHelper.CreateHelper(managedOperation).InitShowViewParameters(e.ShowViewParameters, false);

Note:

We saw an example of creating a Synchronous Managed Operation. The Asynchronous Managed Operation gives the end user more possibilities to control the execution. Examples of such operations are included in demo application Xafari Northwind.

managed_operations_9_1

The Learn More topic explains, how to implement an Asynchronous Managed Operation.