Can I send only a token through MVVM Light Messenger?

I refactored the code that I originally used Messengerin the MVVM Foundation, now uses it Messengerin the MVVM Light Toolit. One thing I cannot find an equivalent for is the case when all you want to do is send a token (i.e. the Token acts as a unique identifier for the message and the message itself).

Original code (MVVM Foundation) - one line does it all

// send code
mvvmFoundationMessenger.NotifyColleagues("QuestionTimedOut");

// register code
mvvmFoundationMessenger.Register(
    "QuestionTimedOut",
    () => UpdateOnQuestionTimedOut());

New code (MVVM Light) - is there a more elegant solution than this?

// send code
mvvmLightMessenger.Send("QuestionTimedOut", "QuestionTimedOut");

// register code
mvvmLightMessenger.Register<string>(
    this,
    "QuestionTimedOut",
    token => UpdateOnQuestionTimedOut());

I understand that I could explicitly update NotificationMessage, but this will add even more code.

+5
source share
2

. MVVM Light VNext.

+5

MvvmLight Messenger .

0

All Articles