Показать сообщение отдельно
Старый 22.12.2016, 21:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
stoneridgesoftware: Event Handler Methods in Dynamics 365 for Operations (AX7)
Источник: https://stoneridgesoftware.com/event...ethods-in-ax7/
==============

*Please note: New Dynamics AX (AX7) has been renamed Dynamics 365 for Operations.

In Dynamics 365 for Operations (AX7) the preferred mechanism for customizations to existing objects is to use event handlers to react to various events rather than overriding methods on tables, forms, and classes. For example, to change what happens when a button is clicked in AX 2012 you override the clicked method and put code either before or after the super() call. In Dynamics 365 for Operations (AX7) you can react to the OnClicked event by copying the event handler method for the event and pasting the method into a class. Below is an example of an event handler method that reacts to the OnClicked event of a button on a form.

[FormControlEventHandler(formControlStr(HcmWorker, ArgsExampleButton), FormControlEventType::Clicked)] public static void ArgsExampleButton_OnClicked(FormControl sender, FormControlEventArgs e) { Args args = new Args(); Form formToCall = new Form('ArgsDemo_Callee'); FormButtonControl callerButton = sender as FormButtonControl; //Retrieves the button that we're reacting to FormRun form = callerButton.formRun(); //Gets the running HcmWorker form //Get the HcmWorker that was selected in the HcmWorker form FormDataSource hcmWorker_ds = form.dataSource(formDataSourceStr(HcmWorker, HcmWorker)) as FormDataSource; HcmWorker hcmWorker = hcmWorker_ds.cursor(); //Set up args with all of the information you've retrieved args.caller(form); args.object(formToCall ); args.record(hcmWorker); form = ClassFactory.formRunClass(args); form.init(); form.run(); form.wait(); }



Источник: https://stoneridgesoftware.com/event...ethods-in-ax7/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.