Example #1
0
        /// <summary>
        /// Возвращает строковое представление стратегии поиска.
        /// </summary>
        public override string ToString()
        {
            var info = this.infoList[0];
            var str  = AutomationPropertyHelper.GetPropertyName(info.Property) + ": " + info.Value;

            for (var i = 1; i < this.infoList.Count; ++i)
            {
                info = this.infoList[i];
                var condition        = info.ConditionType.ToString().ToLower();
                var propertyName     = AutomationPropertyHelper.GetPropertyName(info.Property);
                var propertyKeyValue = propertyName + ": " + info.Value;
                str = string.Format("({0}) {1} {2}", str, condition, propertyKeyValue);
            }

            return(str);
        }
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();
            var propertyName  = this.ExecutedCommand.Parameters["NAME"].ToString();

            var element = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey);

            try
            {
                var property      = AutomationPropertyHelper.GetAutomationProperty(propertyName);
                var propertyValue = element.GetAutomationPropertyValue <object>(property);
                return(this.JsonResponse(ResponseStatus.Success, propertyValue));
            }
            catch (Exception)
            {
                return(this.JsonResponse());
            }
        }