Exemple #1
0
        public static bool ActivateInstance(string instance)
        {
            var sel = SelectionExt.SelectInstances(instance);

            if (sel.Count2 > 1)
            {
                throw new MultipleSelectionException("More than one node selected");
            }

            Activate();

            return(true);
        }
Exemple #2
0
        public bool SelectNode()
        {
            string tempName = GetProductName();

            var sel = SelectionExt.SelectInstances(tempName);

            if (sel.Count2 == 1)
            {
                return(true);
            }

            // problems if you dont load(design mode) in the entire tree to find the correct one

            bool found = false;
            var  lim   = sel.Count2 + 1;

            for (int i = 1; i < lim; i++)
            {
                var tempLeaf = (Product)sel.Item2(i).LeafProduct;
                var t1       = tempLeaf.GetRootRelationship().RemoveAtWithNegative(-1).ToList();
                var t2       = this.GetRootRelationship().RemoveAtWithNegative(-1).ToList();

                for (int j = t2.Count; j <= t1.Count; j++)
                {
                    t1.RemoveAtWithNegative(-1).ToList();
                }

                if (t1.Compare1(t2))
                {
                    found = true;
                }
                else
                {
                    sel.Remove2(i);
                    i--;
                    lim--;
                }
            }
            return(found);
        }
Exemple #3
0
        public static Product GetLeafProduct(string instance)
        {
            var sel = SelectionExt.SelectInstances(instance);

            return((Product)sel.GetLeafProducts().FirstOrDefault());
        }
Exemple #4
0
        public static Document GetDocument(string instance)
        {
            var sel = SelectionExt.SelectInstances(instance);

            return(sel.GetDocuments().FirstOrDefault());
        }