AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 27.03.2009, 13:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,493 / 847 (79) +++++++
Регистрация: 28.10.2006
axaptapedia: Event broker
Источник: http://www.axaptapedia.com/Event_broker
==============

Summary: /* Implementaion */

==Purpose==
* To allow [http://en.wikipedia.org/wiki/Event-driven_programming event driven programming]
* To have [http://en.wikipedia.org/wiki/Loose_coupling loose coupling] between classes
* A (partial) implementation of the [http://en.wikipedia.org/wiki/Observer_pattern Observer pattern]

==Download==

==Implementaion==
Three classes are provided:

# ''SysEventListener'', which is the interface class for a "listener"
#* ''gotEvent'', which every listener must implement
# ''SysEventInfo'', which is an implementation for a listener, which simply put received information on the [[Infolog]]
#* ''main'', contains a simple test case
# ''SysEventBroker'', which client classes use to notify listeners, it implements the following methods:
#* ''addListener'', to register a lisener
#* ''removeListener'', to unregister a listener
#* ''fireEvent'', to fire an event and to notify listeners via the ''gotEvent'' method

==Global broker==
Client classes need to share the SysEventBroker instance.
A possible solution is to use the global Infolog object.

In the Info.classDeclation add:

SysEventBroker eventBroker;


Add a new method:

public SysEventBroker eventBroker()
{
if (!eventBroker)
eventBroker = SysEventBroker::construct();
return eventBroker;
}


Beware, Infolog lives at the client, all notified infomation is sent to the client.
You could make the same implementation in the Application class which lives at the server.
But you must then remember to use the same broker.

==Warning==
This is no silver bullet, do not misuse!
Do not not use when standard method calls and argument passing is the easy solution.
Do not forget to unregister the listener, even if an exception is thrown. Use try/catch!

[[Category:Development tools]]


Источник: http://www.axaptapedia.com/Event_broker
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axaptapedia: Event broker Blog bot DAX Blogs 0 03.04.2009 15:05
axaptapedia: Event broker Blog bot DAX Blogs 0 30.03.2009 17:05
axaptapedia: Observer pattern Blog bot DAX Blogs 0 27.03.2009 19:05
AX UK: Dynamics Partner Networking Event - 9th Feb, Cardinal Place, London Blog bot DAX Blogs 0 10.01.2009 01:08

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 19:35.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.