Пример #1
0
            public static string ParseTopic(onvif.services.TopicExpressionType topic)
            {
                string topicString = "";

                topic.Any.ForEach(node => {
                    topicString += "value: " + node.Value;
                });

                return(topicString);
            }
        TopicExpressionType GetTopicExression() {
            var parts = (from Selector ctrl in valuesTopicExpr.Items
                        where ctrl.SelectedItem != string.Empty
                        select (string)ctrl.SelectedItem).ToArray();
            
            string dialect = @"http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet";
            if (parts.Length == 1 && !parts.First().EndsWith("//."))
                dialect = @"http://docs.oasis-open.org/wsn/t-1/TopicExpression/Concrete";

            var expr = string.Join("|", parts);

            var topicExpr = new TopicExpressionType() {
                Dialect = dialect,
                Any = new XmlNode[] { new XmlDocument().CreateTextNode(expr) }
            };
            return topicExpr;
        }