protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         if (_clientSubscription != null)
         {
             _clientSubscription.Dispose();
             _clientSubscription = null;
         }
     }
 }
 public WoopsaNotificationEventArgs(WoopsaClientNotification notification,
     WoopsaClientSubscription subscription)
 {
     Notification = notification;
     Subscription = subscription;
 }
 public WoopsaSubscriptionServiceSubscriptionServerSubClient(
     WoopsaSubscriptionChannel channel,
     WoopsaContainer root,
     int subscriptionId, string propertyPath,
     TimeSpan monitorInterval, TimeSpan publishInterval,
     WoopsaBaseClientObject subClient, string relativePropertyPath)
     : base(channel, root, subscriptionId, propertyPath, monitorInterval, publishInterval)
 {
     bool isSingleNotification =
         monitorInterval == WoopsaSubscriptionServiceConst.MonitorIntervalLastPublishedValueOnly &&
         publishInterval == WoopsaSubscriptionServiceConst.PublishIntervalOnce;
     EventHandler<WoopsaNotificationEventArgs> handler;
     if (isSingleNotification)
         handler =
             (sender, e) =>
             {
                 EnqueueNewMonitoredValue(e.Notification.Value);
                 DoPublish(); // there is not publish timer, force publishing the unique notification
             };
     else
         handler =
             (sender, e) =>
             {
                 EnqueueNewMonitoredValue(e.Notification.Value);
             };
     _clientSubscription = subClient.Subscribe(relativePropertyPath, handler,
             monitorInterval, publishInterval);
 }
 internal WoopsaClientSubscription Subscribe(string servicePath, string relativePath,
     EventHandler<WoopsaNotificationEventArgs> handler,
     TimeSpan monitorInterval, TimeSpan publishInterval)
 {
     WoopsaClientSubscription subscription =
         new WoopsaClientSubscription(this, servicePath, relativePath, monitorInterval, publishInterval, handler);
     lock (_subscriptions)
     {
         _subscriptions.Add(subscription);
         SubscriptionsChanged = true;
     }
     EnsureServiceThreadStarted();
     return subscription;
 }