Barcode Scan Commands: To Define the List of Commands

This activity will walk you through the process of defining the list of commands that are available in a scan mode.

Story

Suppose that you are creating a custom scan mode for a barcode-driven form. You need to define two new scan commands for this scan mode. One command, RemoveCommand, will be inherited from the base barcode scan class, which is the WMSBase class. The other, ConfirmCommand, will be introduced in this scan mode. In this activity, you will define the list of commands.
Tip: You will define the ConfirmCommand class in Barcode Scan Commands: To Implement a Custom Command.

Process Overview

You will create particular instances of scan commands in the ScanMode<TScanBasis>.CreateCommands() method.

System Preparation

Before you begin performing the step of this activity, do the following:

  1. Prepare an MYOB Acumatica instance by performing the Test Instance: To Deploy an Instance prerequisite activity.
  2. Create a barcode scan class by performing the Barcode Scan Class: To Create a Barcode Scan Class prerequisite activity.
  3. Create the scan mode and define its required properties by performing the Barcode Scan Mode: To Define the Required Properties prerequisite activity.

Step: Defining the List of Commands

To define the list of commands, in the scan mode class, add the following code.

public sealed class CountMode : ScanMode
{
    ...
  
    protected override IEnumerable<ScanCommand<INScanCount>> CreateCommands()
    {
        yield return new RemoveCommand(); 
        yield return new ConfirmCommand(); 
    }
  
    ...
}