示例#1
0
        public void MoveExperimentInScanMethodDecLevel(TreeNodeCollection addInMe, TreeNode expNode)
        {
            if ((expNode != null) && (expNode.Parent != null) &&
                (typeof(ExperimentContainer).IsAssignableFrom(expNode.Parent.Tag.GetType())))
            {
                // Inside a container
                ExperimentContainer container  = expNode.Parent.Tag as ExperimentContainer;
                TreeNode            parentNode = expNode.Parent;

                // Is level2 or higher?
                if ((parentNode.Parent != null) && (typeof(ExperimentContainer).IsAssignableFrom(parentNode.Parent.Tag.GetType())))
                {
                    ExperimentContainer ppContainer = parentNode.Parent.Tag as ExperimentContainer;
                    TreeNode            ppNode      = parentNode.Parent;

                    container.Remove(expNode.Tag as IExperiment);
                    ppContainer.Insert(parentNode.Index + 1, expNode.Tag as IExperiment);
                    parentNode.Nodes.Remove(expNode);
                    ppNode.Nodes.Insert(parentNode.Index + 1, expNode);
                }
                else
                {
                    container.Remove(expNode.Tag as IExperiment);
                    scanMethod.Insert(parentNode.Index + 1, expNode.Tag as IExperiment);
                    parentNode.Nodes.Remove(expNode);
                    addInMe.Insert(parentNode.Index + 1, expNode);
                }
            }
        }
示例#2
0
 public void MoveExperimentInScanMethodDown(TreeNodeCollection addInMe, TreeNode expNode)
 {
     if ((expNode != null) && (expNode.Parent == null) && (expNode.Index < (scanMethod.Count - 1)))
     {
         // Not in container and Index > 0
         scanMethod.Remove(expNode.Tag as IExperiment);
         scanMethod.Insert(expNode.Index + 1, expNode.Tag as IExperiment);
         addInMe.Remove(expNode);
         addInMe.Insert(expNode.Index + 1, expNode);
     }
     else if ((expNode != null) && (expNode.Parent != null) && (typeof(ExperimentContainer).IsAssignableFrom(expNode.Parent.Tag.GetType())) && (expNode.Index < (expNode.Parent.GetNodeCount(false) - 1)))
     {
         ExperimentContainer container = expNode.Parent.Tag as ExperimentContainer;
         TreeNode            parent    = expNode.Parent;
         container.Remove(expNode.Tag as IExperiment);
         container.Insert(expNode.Index + 1, expNode.Tag as IExperiment);
         parent.Nodes.Remove(expNode);
         parent.Nodes.Insert(expNode.Index + 1, expNode);
     }
 }