//######################################
        // GetProperties
        //######################################

        private PropertyOrphanCollection GetProperties()
        {
            var obj = Value as SensorOrDeviceOrGroupOrProbe;

            if (obj != null && Options.Contains(TreeParseOption.Properties))
            {
                Token.ThrowIfCancellationRequested();

                var properties = ObjectManager.Property.Objects(obj.Id);
                var orphans    = properties.Select(p => ObjectManager.Property.Orphan(p, null)).Cast <PropertyOrphan>();

                return(PrtgOrphan.PropertyCollection(orphans));
            }

            return(null);
        }
        private async Task <PropertyOrphanCollection> GetPropertiesAsync()
        {
            var obj = Value as SensorOrDeviceOrGroupOrProbe;

            if (obj != null && Options.Contains(TreeParseOption.Properties))
            {
                Token.ThrowIfCancellationRequested();

                var properties = await ObjectManager.Property.ObjectsAsync(obj.Id, Token).ConfigureAwait(false);

                var orphans = properties.Select(p => ObjectManager.Property.Orphan(p, null)).Cast <PropertyOrphan>();

                return(PrtgOrphan.PropertyCollection(orphans));
            }

            return(null);
        }
Esempio n. 3
0
 /// <summary>
 /// Creates a new <see cref="PropertyNodeCollection"/> for representing a collection of property nodes.
 /// </summary>
 /// <param name="children">The children to use for this collection.</param>
 /// <returns>A collection that encapsulates the specified children.</returns>
 public static PropertyNodeCollection PropertyCollection(IEnumerable <PropertyNode> children) =>
 PrtgOrphan.PropertyCollection(GetOrphans(children)?.Cast <PropertyOrphan>()).ToStandaloneNode <PropertyNodeCollection>();