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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ////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