Example #1
0
        /// <summary>
        /// Writes the <see cref="ObservedNode.Value"/> and <see cref="ObservedNode.Unit"/>
        /// information of the <paramref name="node"/> specified to the console.
        /// </summary>
        /// <param name="node">The <see cref="ObservedNode"/> its value and unit information is to
        /// written.</param>
        private static void WriteValue(ObservedNode node)
        {
            if (node.Value != null)
            {
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write(node.Value);

                if (node.Unit == null)
                {
                    Console.Write("\t");
                }
                else
                {
                    Console.Write($" {node.Unit.DisplayName}\t");
                }

                Console.ResetColor();
            }
        }
Example #2
0
        /// <summary>
        /// Writes the <see cref="ObservedNode.Event"/> information of the <paramref name="node"/>
        /// specified to the console.
        /// </summary>
        /// <param name="node">The <see cref="ObservedNode"/> its event information is to
        /// be written.</param>
        private static void WriteEvent(ObservedNode node)
        {
            var eventData = node.Event;

            if (eventData != null)
            {
                var conditionData = node.Event as OpcCondition;

                if (conditionData == null || conditionData.IsRetained)
                {
                    Console.ForegroundColor = SeverityToColor(eventData.Severity);
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.DarkGray;
                }

                var eventTime = eventData.Time.ToLocalTime();
                var eventText = eventData.Message;

                Console.Write($"{eventTime.ToString("HH:mm:ss.fff")} - {eventText}");
                Console.ResetColor();
            }
        }