필터 지우기
필터 지우기

Dynamic event registration like Mediator-Pattern

조회 수: 2 (최근 30일)
Ricardo Krause
Ricardo Krause 2019년 3월 18일
댓글: Ricardo Krause 2019년 3월 18일
Hi,
I try to develop a oop gui application with AppDesigner and mvc pattern ... and at the moment I struggle to decouple my controller from backend services.
I was thinking about using a mediator for event handling. So I can attach a producer with 'any' event and register some consumers for this event.
Like displayed below.
But know have the problem that the 'dynamic' registered event is unknown to the mediator.
Does someone how I could solve my issue? I'm sure I have to do it in part 'attach as consumer' :) but I don't know how :/ (at the moment)
> identifier: 'MATLAB:class:invalidEvent'
> message: 'Event 'TestEvent' is not defined for class 'Mediator'.'
  댓글 수: 1
Ricardo Krause
Ricardo Krause 2019년 3월 18일
with following change it seams to work
I keep the producer in a containers.Map and attach the listener directly to the producer from the map. So the consumer still don't know the producer

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by