0

In my WP SignalR application I'm using this code:

_dataHub.Subscribe("ReceiveMessage").Received += list => App.RootFrame.Dispatcher.BeginInvoke(() => Messages.Add(list[0].ToString()));

But I have to use similar code to subscribe to my SignalR server application.

I tried this one:

 _dataHub.Subscribe("ReceiveMessage").Received += list => Dispatcher.CurrentDispatcher.BeginInvoke(() => Messages.Add(list[0].ToString()));

I'm having delegate issue with that. Any help?

Tobia Tesan
  • 1,938
  • 17
  • 29

1 Answers1

0

As described in error you are providing lambda expression instead of delegate. Use Action like this:

_dataHub.Subscribe("ReceiveMessage").Received += list => 
             Dispatcher.CurrentDispatcher.BeginInvoke((Action)(() => 
                                         Messages.Add(list[0].ToString())));
Rohit Vats
  • 79,502
  • 12
  • 161
  • 185