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);
        }
 public WoopsaSubscriptionServiceSubscriptionMonitorClient(
     WoopsaSubscriptionChannel channel,
     WoopsaBaseClientObject root,
     int subscriptionId, string propertyPath,
     TimeSpan monitorInterval, TimeSpan publishInterval) :
     base(channel, root, subscriptionId, propertyPath, monitorInterval, publishInterval)
 {
 }
Ejemplo n.º 3
0
 public WoopsaClientProperty(WoopsaBaseClientObject container, string name, WoopsaValueType type, WoopsaPropertyGet get, WoopsaPropertySet set)
     : base(container, name, type, get, set)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container", string.Format("The argument '{0}' of the WoopsaClientProperty constructor cannot be null!", "container"));
     }
 }
Ejemplo n.º 4
0
        private bool FindWoopsaClientAlongPath(WoopsaContainer root, string path,
                                               out WoopsaBaseClientObject client, out string relativePath)
        {
            OnBeforeWoopsaModelAccess();
            try
            {
                string[]        pathParts = path.Split(WoopsaConst.WoopsaPathSeparator);
                WoopsaContainer container = root;
                bool            found     = false;

                client       = null;
                relativePath = string.Empty;
                for (int i = 0; i < pathParts.Length; i++)
                {
                    if (container is WoopsaBaseClientObject)
                    {
                        client = (WoopsaBaseClientObject)container;
                        for (int j = i; j < pathParts.Length; j++)
                        {
                            relativePath += WoopsaConst.WoopsaPathSeparator + pathParts[j];
                        }
                        found = true;
                        break;
                    }
                    else if (container == null)
                    {
                        break;
                    }
                    else if (!string.IsNullOrEmpty(pathParts[i]))
                    {
                        container = container.ByNameOrNull(pathParts[i]) as WoopsaContainer;
                    }
                }
                return(found);
            }
            finally
            {
                OnAfterWoopsaModelAccess();
            }
        }
Ejemplo n.º 5
0
 public WoopsaClientProperty(WoopsaBaseClientObject container, string name, WoopsaValueType type, WoopsaPropertyGet get)
     : this(container, name, type, get, null)
 {
 }
 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);
 }
 public WoopsaSubscriptionServiceSubscriptionMonitorClient(
     WoopsaSubscriptionChannel channel,
     WoopsaBaseClientObject root,
     int subscriptionId, string propertyPath,
     TimeSpan monitorInterval, TimeSpan publishInterval)
     : base(channel, root, subscriptionId, propertyPath, monitorInterval, publishInterval)
 {
 }
        private bool FindWoopsaClientAlongPath(WoopsaContainer root, string path,
            out WoopsaBaseClientObject client, out string relativePath)
        {
            OnBeforeWoopsaModelAccess();
            try
            {
                string[] pathParts = path.Split(WoopsaConst.WoopsaPathSeparator);
                WoopsaContainer container = root;
                bool found = false;

                client = null;
                relativePath = string.Empty;
                for (int i = 0; i < pathParts.Length; i++)
                {
                    if (container is WoopsaBaseClientObject)
                    {
                        client = (WoopsaBaseClientObject)container;
                        for (int j = i; j < pathParts.Length; j++)
                            relativePath += WoopsaConst.WoopsaPathSeparator + pathParts[j];
                        found = true;
                        break;
                    }
                    else if (container == null)
                        break;
                    else if (!string.IsNullOrEmpty(pathParts[i]))
                        container = container.ByNameOrNull(pathParts[i]) as WoopsaContainer;
                }
                return found;
            }
            finally
            {
                OnAfterWoopsaModelAccess();
            }
        }
Ejemplo n.º 9
0
 public WoopsaClientProperty(WoopsaBaseClientObject container, string name, WoopsaValueType type, WoopsaPropertyGet get)
     : this(container, name, type, get, null)
 {
 }
Ejemplo n.º 10
0
 public WoopsaClientProperty(WoopsaBaseClientObject container, string name, WoopsaValueType type, WoopsaPropertyGet get, WoopsaPropertySet set)
     : base(container, name, type, get, set)
 {
     if (container == null)
         throw new ArgumentNullException("container", string.Format("The argument '{0}' of the WoopsaClientProperty constructor cannot be null!", "container"));
 }