我的代码实现有问题。我目前正在使用 PushSharp 库,我想做的一件事是如果事件触发,我想根据它是什么事件返回一个真值或假值。这是代码:
public static bool SenddNotification()
{
var push = new PushBroker();
//Wire up the events for all the services that the broker registers
push.OnNotificationSent += NotificationSent;
push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
}
static bool DeviceSubscriptionChanged(object sender, string oldSubscriptionId, string newSubscriptionId, INotification notification)
{
//Currently this event will only ever happen for Android GCM
Console.WriteLine("Device Registration Changed: Old-> " + oldSubscriptionId + " New-> " + newSubscriptionId + " -> " + notification);
return false;
}
static bool NotificationSent(object sender, INotification notification)
{
Console.WriteLine("Sent: " + sender + " -> " + notification);
return true;
}
所以我想要的是如果事件触发,根据发生的情况返回真或假,然后最终在第一个方法中返回这个值