상속: IWoopsaNotification
 public void Add(WoopsaClientNotification notification)
 {
     _notifications.Add(notification);
 }
예제 #2
0
 public void Add(WoopsaClientNotification notification)
 {
     _notifications.Add(notification);
 }
 public WoopsaNotificationEventArgs(WoopsaClientNotification notification,
     WoopsaClientSubscription subscription)
 {
     Notification = notification;
     Subscription = subscription;
 }
 internal void Execute(WoopsaClientNotification notification)
 {
     if (Handler != null && !UnsubscriptionRequested)
         try
         {
             Handler(Channel, new WoopsaNotificationEventArgs(notification, this));
         }
         catch (Exception)
         {
             // TODO : how to manage exceptions thrown by notification handlers ?
         }
 }
        private int RetrieveNotification(out WoopsaClientNotifications notificationsResult, int lastNotificationId)
        {
            WoopsaJsonData results = WaitNotification(_subscriptionOpenChannel.Value, lastNotificationId);

            var notificationsList = new WoopsaClientNotifications();

            int count = 0;
            for (int i = 0; i < results.Length; i++)
            {
                WoopsaJsonData notification = results[i];
                var notificationValue = notification["Value"];
                var notificationSubscriptionId = notification["SubscriptionId"];
                var notificationId = notification["Id"];
                WoopsaValueType type = (WoopsaValueType)Enum.Parse(typeof(WoopsaValueType), notificationValue["Type"]);
                WoopsaValue value = WoopsaValue.CreateChecked(notificationValue["Value"], type, DateTime.Parse(notificationValue["TimeStamp"]));
                WoopsaClientNotification newNotification = new WoopsaClientNotification(value, notificationSubscriptionId);
                newNotification.Id = notificationId;
                notificationsList.Add(newNotification);
                count++;
            }
            notificationsResult = notificationsList;
            return count;
        }