Loading
Uniconta
Get Uniconta
  • Visit a Country Site
    • Danmark
    • Deutschland
    • Eesti
    • Ísland
    • Lithuania
    • Nederland
    • Norge
    • Österreich
    • United Kingdom
  • Search
  • Uniconta
    • Ledger
    • Customer
    • Sales Order
    • Vendor
    • Purchase
    • Inventory
    • Logistics
    • Project
    • Light Manufacturing
    • CRM
    • Dashboard
    • Company
    • Adaptability
  • Download
    • Uniconta for Windows
    • Uniconta for Mac
  • Resellers
    • Find a reseller
    • Become a reseller
    • Become an integration partner
    • Partner Portal Login
    • Partner Portal sign up
  • Developers
    • Become an integration partner
    • Documentation
    • Downloads
    • Samples
    • Support
  • Accountants
    • Become a Univisor
  • News
  • About us
    • About us
    • Management
    • Contact

Developers Unipedia

  • API
    • API
    • User defined fields
    • User defined tables
    • Saving a Session
    • Posting an Invoice
    • Post Invoice and get PDF
    • Localization
    • Attach physical voucher to entities
    • Server-Login User
    • How to find C# Property from Uniconta Label
    • Minimize network traffic and optimize speed
  • Plugins
    • Plugins
    • Debug Uniconta Plugins
    • Refreshing UI with plugins
    • How to use Uniconta Plugin
    • Develop a user plugin
    • Event Handling
    • Global Script
    • How to capture menu events
    • How to open a form in Uniconta from Plugin
    • Open new content in a IContentPluginBase plugin
    • Adding plugin in a menu
    • How to add user parameter in plugin menu
    • How to create plugin with Devexpress Library
    • Synchronize Entity Support in form page
    • Develop a PageEventBase Plugin
    • Logging Exceptions on local machine
    • Create Custom Uniconta Pages From Github Code
  • OData
    • CRUD operations in OData
    • ODATA REST API – Testing with Postman

How to capture menu events

410 461 May 24th, 2017 January 7th, 2021
Print Friendly, PDF & Email

There are 2 ways to capture menu events – Pre & Post.

  • Pre – runs after the menu is clicked but before its execution
  • Post – runs after the menu is clicked & executed.

Below is an example of the Plugin Code

////summary
//// The Execute method to execute on the basis of parameter passed
////summary
////Params UnicontaBaseEntity master :- To pass the master record
////Params UnicontaBaseEntity currentRow :- To pass the selceted record
////Params IEnurable<UnicontaBaseEntity> source :- To pass dataGrid datasource
////Params String Command :- pass the command
////Params String args :- pass the argument
////Returns ErrorCodes
public ErrorCodes Execute(UnicontaBaseEntity master, UnicontaBaseEntity currentRow, IEnumerable<UnicontaBaseEntity> source, string command, string args)
{
    ErrorCodes result = ErrorCodes.NoSucces;
    try
    {
        var str = command.Split('_');
        if (str[0] == "Pre" && str[1] == "EditDebtor")
        {
            MessageBox.Show(string.Format("Handled" + command));
            errorDescription = "Pre - EditDebtor: You can continue";
            result = ErrorCodes.Succes;
        }
        else if (str[0] == "Pre" && str[1] != "EditDebtor")
        {
            MessageBox.Show(string.Format("NotHandled" + command));
            errorDescription = "Pre - str: You can continue";
            result = ErrorCodes.NoSucces;
        }
        else if (str[0] == "Pre")
        {
            MessageBox.Show(string.Format("NotHandled" + command));
            errorDescription = "Pre: You can continue";
            result = ErrorCodes.NoSucces;
        }
        else if (str[0] == "Post")
        {
            MessageBox.Show(string.Format("AfterAction" + command));
            errorDescription = "Post: This is the Post Message";
            result = ErrorCodes.NoSucces;
        }
    }
    catch(Exception ex)
    {
        errorDescription = ex.Message;
    }
    return result;
}

Now you can add Pre or Post command that needs to be handled in the User Plugin.

  • Pre_ : To handle all pre actions
  • Pre_actionName: To handle specific pre action
  • Post_: To handle all post actions
  • Post_actionName: To handle specific post action

Categories: Developers Unipedia, Plugins

Get in touch with us

Uniconta

  • Uniconta
  • Subscription Terms
  • System Status

PARTNER

  • Resellers
  • Get Uniconta
  • Documentation

INFO

  • News
  • Video
  • Security

Support

  • Unipedia
  • API Support
  • Visit a Country Site
    • Danmark
    • Deutschland
    • Eesti
    • Ísland
    • Lithuania
    • Nederland
    • Norge
    • Österreich
    • United Kingdom
Uniconta
© Copyright 2019 | All rights reserved | info@uniconta.com | Terms & Conditions
Facebook Twitter LinkedIn Youtube