Exemplo n.º 1
0
        private void Highlight_Click(object sender, RoutedEventArgs e)
        {
            ModelItem  loadFrom = ModelItem.Parent;
            string     loadFromSelectorString = "";
            IESelector anchor = null;

            while (loadFrom.Parent != null)
            {
                var p = loadFrom.Properties.Where(x => x.Name == "Selector").FirstOrDefault();
                if (p != null)
                {
                    loadFromSelectorString = loadFrom.GetValue <string>("Selector");
                    anchor = new IESelector(loadFromSelectorString);
                    break;
                }
                loadFrom = loadFrom.Parent;
            }

            HighlightImage = IEExtensions.GetImageSourceFromResource(".x.png");
            NotifyPropertyChanged("HighlightImage");

            string SelectorString = ModelItem.GetValue <string>("Selector");
            int    maxresults     = ModelItem.GetValue <int>("MaxResults");
            var    selector       = new IESelector(SelectorString);
            var    elements       = new List <IEElement>();

            if (anchor != null)
            {
                var _base = IESelector.GetElementsWithuiSelector(anchor, null, 10);
                foreach (var _e in _base)
                {
                    var res = IESelector.GetElementsWithuiSelector(selector, _e, maxresults);
                    elements.AddRange(res);
                }
            }
            else
            {
                var res = IESelector.GetElementsWithuiSelector(selector, null, maxresults);
                elements.AddRange(res);
            }

            if (elements.Count() > 0)
            {
                HighlightImage = IEExtensions.GetImageSourceFromResource("check.png");
                NotifyPropertyChanged("HighlightImage");
            }
            foreach (var ele in elements)
            {
                ele.Highlight(false, System.Drawing.Color.Red, TimeSpan.FromSeconds(1));
            }
        }
Exemplo n.º 2
0
 public GetElementDesigner()
 {
     InitializeComponent();
     HighlightImage = IEExtensions.GetImageSourceFromResource("search.png");
     Loaded        += (sender, e) =>
     {
         var Variables = ModelItem.Properties[nameof(GetElement.Variables)].Collection;
         if (Variables != null && Variables.Count == 0)
         {
             Variables.Add(new Variable <int>("Index", 0));
             Variables.Add(new Variable <int>("Total", 0));
         }
     };
 }
Exemplo n.º 3
0
 public GetElementDesigner()
 {
     InitializeComponent();
     HighlightImage = IEExtensions.GetImageSourceFromResource("search.png");
 }