In order to create custom menu, the developer needs to write custom code using the iVend Add-on framework.
Steps for creating a Menu and a Menu Category in the Management Console:
“ConsoleMenuCategoryCommandBase” class
1. For Menu Category, create a class let us say “MANAGEMENT CONSOLEMenuCategory.cs” and extend it with
using CXS.Retail.Extensibility.Menu;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
1. Define the base class properties as shown in the below code:
namespace SampleAddOn2
{
//For adding Menu category
public class MANAGEMENT CONSOLEMenuCategory : ConsoleMenuCategoryCommandBase
{
public MANAGEMENT CONSOLEMenuCategory()
: base()
{
base.Id = "SampleCatgeory";
base.Caption = "Sample Configuration";
base.Position = 1;
base.IsVisible = true;
base.Group = CXS.Retail.Extensibility.ConsoleMenuGroup.Administration;
base.ToolTip = "Sample Configuration ";
}
}
}
“ConsoleMenuItemCommandBase” class
3. For Menu Item, create class - let us say “MANAGEMENT CONSOLEMenuItems” and extend it with:
4. Define the base class properties as shown in the below code and add business logic on the overridden execute method of “ConsoleMenuItemCommandBase” class.
class MANAGEMENT CONSOLEMenuItems : ConsoleMenuItemCommandBase
{
public MANAGEMENT CONSOLEMenuItems():base()
{
base.Category = CXS.Retail.Extensibility.ConsoleMenuCategory.CustomGroup;
base.CategoryId = "SampleCatgeory";
base.Id = "Custom Menu";
base.Caption = "Custom Menu";
base.Position = 1;
base.IsVisible = true;
base.IsEnabled = true;
base.ToolTip = "Custom Menu";
}
public override void Execute()
{
MessageBox.Show("Custom Menu clicked !!");
}
}
5. Add Menu category and Menu item on Add-on Start method.
public override void Start()
{
base.Start();
// add menu category and menu item.
AppExtensibilityContext.AddConsoleMenuCategory(new MANAGEMENT CONSOLEMenuCategory());
AppExtensibilityContext.AddConsoleMenuItem(new MANAGEMENT CONSOLEMenuItems());
}