Search Results for

    Show / Hide Table of Contents

    Interface IDefaultMenuInserter

    Inherit from this in order to update default menus with third party functionality

    Namespace: LemonEdge.API.Core.Migrations
    Assembly: LemonEdge.API.Core.Migrations.dll
    Syntax
    public interface IDefaultMenuInserter
    Remarks

    To ensure the standard and admin menus are always upgraded the way you require, you can implement this interface.

    It will always be called when the system is upgrading and updates the menu

    For example:
    public class MenuUpgrader : LemonEdge.Connections.Database.Migrations.Core.IDefaultMenuInserter
    {
        public async Task UpdateDefaultMenus(IDefaultMenuItemCreator menuCreator)
        {
            var adminMainMenu = menuCreator.GetCurrentMenu(menuCreator.AdminRoleID);
            var userMainMenu = menuCreator.GetCurrentMenu(menuCreator.StandardRoleID);
    
        //Remove standard menu commands we do not want
        foreach (var item in adminMainMenu.Union(userMainMenu).
            Where(x =$gt;
                x.ItemID == Commands.Companies.ToShortGuid() || x.ItemID == Commands.People.ToShortGuid() || x.ItemID == Commands.EntitySets.ToShortGuid() ||
                x.ItemID == Commands.InstrumentCapitalAccountDataSettings.ToShortGuid() || x.ItemID == Commands.Instruments.ToShortGuid() ||
                x.ItemID == Commands.InstrumentSets.ToShortGuid()
            ).ToArray())
        await menuCreator.RemoveMenuItem(item);
    
        //Add our new commands to Home
        short tabIndex = -1;
        short groupIndex = 0;
        short itemIndex = 0;
        var adminName = "Home";
        var userName = "Home";
    
        var customMenuButton = LemonEdge.Core.Client.CommandAttribute.GetDescriptors(typeof(Entities.MyEntityHelper), Entities.MyEntityHelper.customCommandID);
    
        await menuCreator.CreateMenuItem(menuCreator.AdminRoleID, tabIndex, adminName, false, groupIndex, "Custom", itemIndex, customMenuButton, activateOnLoad: false, addToMenuBar: false, addToUserMenuBar: false, addToQuickAccess: false, visible: true, addToSimplified: false);
        await menuCreator.CreateMenuItem(menuCreator.StandardRoleID, tabIndex, userName, false, groupIndex, "Custom", itemIndex, customMenuButton, activateOnLoad: false, addToMenuBar: false, addToUserMenuBar: false, addToQuickAccess: false, visible: true, addToSimplified: false);
        itemIndex++;
        //etc...
    }
    

    }

    Methods

    UpdateDefaultMenus(IDefaultMenuItemCreator)

    A process called by the system to allow custom modules to upgrade the standard menus

    Declaration
    Task UpdateDefaultMenus(IDefaultMenuItemCreator menuCreator)
    Parameters
    Type Name Description
    IDefaultMenuItemCreator menuCreator

    A menu creator interface that the system implements to ensure the standard menu commands are updated as required

    Returns
    Type Description
    Task

    A task indicating the completion of the custom menu upgrade process

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)

    See Also

    IDefaultMenuItemCreator
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.