public void load()
        {

            lbId.Content = id;
            if (Factory.Instance.i.rules.xpathCollection != null)
                this.rule = (from x in Factory.Instance.i.rules.xpathCollection where x.id == id select x).FirstOrDefault();

            if (this.rule != null)
            {
                txtXpath.Text = rule.xpath;
                xpathSingle1.load(rule.id, true, new IntelliScraper.Db.xpathCollection());
                
            }
        }
Exemplo n.º 2
0
        public void load(string id,bool isFromCollection,IntelliScraper.Db.xpathCollection coll)
        {
            this.id = id;
            this.isFromCollection = isFromCollection;
            this.coll = coll;
            treeView1.Items.Clear();
            if (!string.IsNullOrEmpty(id))
            {
                this.id = id;
                if (!isFromCollection)
                {
                    if (Factory.Instance.i.rules.xpathSingle != null)
                        this.rule = (from x in Factory.Instance.i.rules.xpathSingle where x.id == id select x).FirstOrDefault();
                }
                else
                {
                    if(coll.xpathSingle != null)
                        this.rule = coll.xpathSingle;// (from x in coll.xpathSingle where x.id == id select x).FirstOrDefault();
                }
            }

            if (this.rule != null)
            {
                
                this.ruleName.Text = rule.id;
                TreeViewItem attributesT = new TreeViewItem();
                attributesT.Header = "Attributes";
                attributesT.IsExpanded = true;


                if (rule.attributes != null)
                {
                    foreach (IntelliScraper.Db.xpathSingleAttributes attr in rule.attributes)
                    {
                        TreeViewItem i = new TreeViewItem();
                        i.Header = attr.id;
                        attributesT.Items.Add(i);
                        i.MouseUp += new MouseButtonEventHandler(i_MouseUp);
                        i.ContextMenu = Resources["cMenu"] as ContextMenu;

                    }                    
                }
                treeView1.Items.Add(attributesT);

                
                if (rule.postProcessTriggerGroup != null)
                {
                    TreeViewItem ppGr = new TreeViewItem();
                    ppGr.Header = "Post Process Group Rule";
                    ppGr.IsExpanded = true;
                    foreach (var r in rule.postProcessTriggerGroup)
                    {
                        TreeViewItem piT = new TreeViewItem();
                        piT.Header = r.id;
                        piT.Tag = "groupPP";
                        ppGr.Items.Add(piT);
                        piT.MouseUp += new MouseButtonEventHandler(piT_MouseUp);
                        piT.ContextMenu = Resources["grMenu"] as ContextMenu;
                    }
                    treeView1.Items.Add(ppGr);
                }

                
               
            }

            //Load Process data
            List<string> ppId = new List<string>();
            foreach (var o in Factory.Instance.getAllPostProcessObj())
            {
                string _id = (string)o.GetType().GetProperty("id").GetValue(o, null);
              
            }

            
        }