コード例 #1
0
        //######################################
        // 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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        private async Task <TriggerOrphanCollection> GetTriggersAsync()
        {
            var obj = Value as SensorOrDeviceOrGroupOrProbe;

            if (obj != null && obj.NotificationTypes.TotalTriggers > 0 && Options.Contains(TreeParseOption.Triggers))
            {
                Token.ThrowIfCancellationRequested();

                var triggers = await ObjectManager.Trigger.ObjectsAsync(Value.Id.Value, Token).ConfigureAwait(false);

                if (triggers.Count == 0)
                {
                    return(null);
                }

                var orphans = triggers.Select(t => ObjectManager.Trigger.Orphan(t, null)).Cast <TriggerOrphan>();

                return(PrtgOrphan.TriggerCollection(orphans));
            }

            return(null);
        }
コード例 #4
0
ファイル: TriggerFactory.cs プロジェクト: vijaydairyf/PrtgAPI
 /// <summary>
 /// Encapsulates a <see cref="NotificationTrigger"/> and its children as a <see cref="TriggerOrphan"/>.
 /// </summary>
 /// <param name="value">The notification trigger to encapsulate.</param>
 /// <param name="children">The children of the notification trigger.</param>
 /// <returns>A <see cref="TriggerOrphan"/> encapsulating the specified <see cref="NotificationTrigger"/> and children.</returns>
 public override PrtgOrphan Orphan(ITreeValue value, IEnumerable <PrtgOrphan> children) =>
 PrtgOrphan.Trigger((NotificationTrigger)value);
コード例 #5
0
ファイル: ProbeFactory.cs プロジェクト: loftwah/PrtgAPI
 /// <summary>
 /// Encapsulates a <see cref="Probe"/> and its children as a <see cref="ProbeOrphan"/>.
 /// </summary>
 /// <param name="value">The probe to encapsulate.</param>
 /// <param name="children">The children of the probe.</param>
 /// <returns>A <see cref="ProbeOrphan"/> encapsulating the specified <see cref="Probe"/> and children.</returns>
 public override PrtgOrphan Orphan(ITreeValue value, IEnumerable <PrtgOrphan> children) =>
 PrtgOrphan.Probe((Probe)value, children);
コード例 #6
0
 /// <summary>
 /// Creates a new <see cref="TriggerNode"/> from a non-inherited notification trigger.
 /// </summary>
 /// <param name="trigger">The notification trigger this node represents.</param>
 /// <returns>A node containing the specified notification trigger.</returns>
 public static TriggerNode Trigger(NotificationTrigger trigger) =>
 PrtgOrphan.Trigger(trigger).ToStandaloneNode <TriggerNode>();
コード例 #7
0
 /// <summary>
 /// Creates a new <see cref="ProbeNode"/> from a probe and its children.
 /// </summary>
 /// <param name="probe">The probe this node represents.</param>
 /// <param name="children">The children of this node.</param>
 /// <returns>A node containing the specified probe and a copy of the children that point to this node as their parent.</returns>
 public static ProbeNode Probe(Probe probe, IEnumerable <PrtgNode> children) =>
 PrtgOrphan.Probe(probe, GetOrphans(children)).ToStandaloneNode <ProbeNode>();
コード例 #8
0
 /// <summary>
 /// Creates a new <see cref="GroupNode"/> from a group and its children.
 /// </summary>
 /// <param name="group">The group this node represents.</param>
 /// <param name="children">The children of this node.</param>
 /// <returns>A node containing the specified group and a copy of the children that point to this node as their parent.</returns>
 public static GroupNode Group(Group group, IEnumerable <PrtgNode> children) =>
 PrtgOrphan.Group(group, GetOrphans(children)).ToStandaloneNode <GroupNode>();
コード例 #9
0
 internal override bool IsNameEqual(string name, StringComparison comparison, PrtgNode node) =>
 PrtgOrphan.IsTableNameEqual(name, comparison, node.Orphan);
コード例 #10
0
 /// <summary>
 /// Encapsulates a <see cref="Sensor"/> and its children as a <see cref="SensorOrphan"/>.
 /// </summary>
 /// <param name="value">The sensor to encapsulate.</param>
 /// <param name="children">The children of the sensor.</param>
 /// <returns>A <see cref="SensorOrphan"/> encapsulating the specified <see cref="Sensor"/> and children.</returns>
 public override PrtgOrphan Orphan(ITreeValue value, IEnumerable <PrtgOrphan> children) =>
 PrtgOrphan.Sensor((Sensor)value, children);
コード例 #11
0
 internal static PrtgNodeGrouping Grouping(IEnumerable <PrtgNode> children) =>
 PrtgOrphan.Grouping(GetOrphans(children)).ToStandaloneNode <PrtgNodeGrouping>();
コード例 #12
0
 /// <summary>
 /// Creates a new <see cref="TriggerNodeCollection"/> for representing a collection of trigger nodes.
 /// </summary>
 /// <param name="children">The children to use for this collection.</param>
 /// <returns>A collection that encapsulates the specified children.</returns>
 public static TriggerNodeCollection TriggerCollection(IEnumerable <TriggerNode> children) =>
 PrtgOrphan.TriggerCollection(GetOrphans(children)?.Cast <TriggerOrphan>()).ToStandaloneNode <TriggerNodeCollection>();
コード例 #13
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>();
コード例 #14
0
 /// <summary>
 /// Creates a new <see cref="PropertyNode"/> from a property.
 /// </summary>
 /// <param name="property">The property this node represents.</param>
 /// <returns>A node containing the specified property.</returns>
 public static PropertyNode Property(PropertyValuePair property) =>
 PrtgOrphan.Property(property).ToStandaloneNode <PropertyNode>();
コード例 #15
0
ファイル: DeviceFactory.cs プロジェクト: vijaydairyf/PrtgAPI
 /// <summary>
 /// Encapsulates a <see cref="Device"/> and its children as a <see cref="DeviceOrphan"/>.
 /// </summary>
 /// <param name="value">The device to encapsulate.</param>
 /// <param name="children">The children of the device.</param>
 /// <returns>A <see cref="DeviceOrphan"/> encapsulating the specified <see cref="Device"/> and children.</returns>
 public override PrtgOrphan Orphan(ITreeValue value, IEnumerable <PrtgOrphan> children) =>
 PrtgOrphan.Device((IDevice)value, children);
コード例 #16
0
 /// <summary>
 /// Creates a new <see cref="SensorNode"/> from a sensor and its children.
 /// </summary>
 /// <param name="sensor">The sensor this node represents.</param>
 /// <param name="children">The children of this node.</param>
 /// <returns>A node containing the specified sensor and a copy of the children that point to this node as their parent.</returns>
 public static SensorNode Sensor(Sensor sensor, IEnumerable <PrtgNode> children) =>
 PrtgOrphan.Sensor(sensor, GetOrphans(children)).ToStandaloneNode <SensorNode>();
コード例 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PrtgNode"/> class with the orphan this node encapsulates and the parent to use for this node.
 /// </summary>
 /// <param name="orphan">The orphan this node encapsulates.</param>
 /// <param name="parent">The parent of this node.</param>
 internal PrtgNode(PrtgOrphan orphan, PrtgNode parent) : base(orphan, parent)
 {
 }
コード例 #18
0
 /// <summary>
 /// Creates a new <see cref="DeviceNode"/> from a device and its children.
 /// </summary>
 /// <param name="device">The device this node represents.</param>
 /// <param name="children">The children of this node.</param>
 /// <returns>A node containing the specified device and a copy of the children that point to this node as their parent.</returns>
 public static DeviceNode Device(Device device, IEnumerable <PrtgNode> children) =>
 PrtgOrphan.Device(device, GetOrphans(children)).ToStandaloneNode <DeviceNode>();
コード例 #19
0
 /// <summary>
 /// Encapsulates a <see cref="Group"/> and its children as a <see cref="GroupOrphan"/>.
 /// </summary>
 /// <param name="value">The group to encapsulate.</param>
 /// <param name="children">The children of the group.</param>
 /// <returns>A <see cref="GroupOrphan"/> encapsulating the specified <see cref="Group"/> and children.</returns>
 public override PrtgOrphan Orphan(ITreeValue value, IEnumerable <PrtgOrphan> children) =>
 PrtgOrphan.Group((IGroup)value, children);
コード例 #20
0
 /// <summary>
 /// Encapsulates a <see cref="PropertyValuePair"/> and its children as a <see cref="PropertyOrphan"/>.
 /// </summary>
 /// <param name="value">The property to encapsulate.</param>
 /// <param name="children">The children of the property.</param>
 /// <returns>A <see cref="PropertyOrphan"/> encapsulating the specified <see cref="PropertyValuePair"/> and children.</returns>
 public override PrtgOrphan Orphan(ITreeValue value, IEnumerable <PrtgOrphan> children) =>
 PrtgOrphan.Property((PropertyValuePair)value);