Exemplo n.º 1
0
        public override void Execute(ActivityContext context)
        {
            var query = ElementQuery.Get(this.Element);

            if (query == null)
            {
                return;
            }

            var elements = WinContext.Shared.GetElementsFromQuery(query);

            if (elements.Count() == 0)
            {
                throw new Exception("Element not found.");
            }
            if (elements.Count() > 1)
            {
                throw new Exception("Too many elements found.");
            }

            using (var input = new InputDriver())
            {
                var e = elements.First() as WinElement;
                e.Focus();
                e.Click();
            }
        }
Exemplo n.º 2
0
        public override void Execute(ActivityContext context)
        {
            var query = ElementQuery.Get(this.Element);

            if (query == null)
            {
                throw new Exception("Input 'Element' is required.");
            }

            var elements = WinContext.Shared.GetElementsFromQuery(query);

            if (elements.Count() == 0)
            {
                throw new Exception("Element not found.");
            }
            if (elements.Count() > 1)
            {
                throw new Exception("Too many elements found.");
            }

            var text = context.Get(this.Text);

            var e = elements.First() as WinElement;

            e.Focus();
            SendKeys.SendWait(text);
        }
Exemplo n.º 3
0
        public override void Execute(ActivityContext context)
        {
            var query = ElementQuery.Get(this.Element);

            var elements = WinContext.Shared.GetElementsFromQuery(query);

            if (elements.Count() == 0)
            {
                throw new Exception("Element not found.");
            }
            if (elements.Count() > 1)
            {
                throw new Exception("Too many elements found.");
            }

            var e = elements.First() as WinElement;

            var name = context.Get(this.PropertyName);

            if (e.GetType().GetProperty(name, BindingFlags.Public | BindingFlags.Instance) is PropertyInfo pi)
            {
                context.Set(this.PropertyValue, pi.GetValue(e)?.ToString() ?? string.Empty);
            }
            else
            {
                throw new Exception(string.Format("Element property '{0}' not found.", name));
            }
        }
Exemplo n.º 4
0
        public override bool Execute(ActivityContext context)
        {
            var query = ElementQuery.Get(this.Element);

            var elements = WinContext.Shared.GetElementsFromQuery(query);

            if (elements.Count() == 0)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 5
0
        public override bool Execute(ActivityContext context)
        {
            var query = ElementQuery.Get(this.Element);

            if (query == null)
            {
                throw new Exception("Input 'Element' is required.");
            }

            var elements = WinContext.Shared.GetElementsFromQuery(query);

            if (elements.Count() == 0)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 6
0
        public override void Execute(ActivityContext context)
        {
            var query = ElementQuery.Get(this.Element);

            var elements = WinContext.Shared.GetElementsFromQuery(query);

            if (elements.Count() == 0)
            {
                throw new Exception("Element not found.");
            }
            if (elements.Count() > 1)
            {
                throw new Exception("Too many elements found.");
            }

            var e = elements.First() as WinElement;

            e.Focus();

            context.Set(this.Value, e.Value);
        }