private void AllJoynNotifier_SignalRaised(ISignal sender, IList<object> args)
{
Debug.WriteLine("Received Notification signal from " + sender.Name);
if (OnNotification == null) return;
string message = null;
try
{
var textStructs = ((IList<object>)args[NOTIFICATION_TEXT_ARGUMENT_INDEX]).Cast<AllJoynMessageArgStructure>();
/// textStructs has type a(ss), where the first element of the struct (i.e. x[0]) is the
/// language as per RFC 5646, while the second element (x[1]) is the message text.
var english = textStructs.First(x => ((string)x[0]).StartsWith("en"));
message = (string)english[1];
}
catch (Exception ex)
{
Debug.WriteLine("Exception in SignalRaised: " + ex.Message);
return;
}
Debug.WriteLine("Notification text: " + message);
OnNotification(message);
}
}