Пример #1
0
        private void selectItem(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node is Animation)
            {
                string AnimName = e.Node.Text;
                AnimName = Regex.Match(AnimName, @"([A-Z][0-9][0-9])(.*)").Groups[0].ToString();
                if (AnimName.Length > 3)
                {
                    AnimName = AnimName.Substring(3);
                }

                Animation running = new Animation(AnimName);
                running.ReplaceMe((Animation)e.Node);
                running.Tag = e.Node;

                Queue <TreeNode> NodeQueue = new Queue <TreeNode>();
                foreach (TreeNode n in treeView1.Nodes)
                {
                    NodeQueue.Enqueue(n);
                }
                while (NodeQueue.Count > 0)
                {
                    try
                    {
                        TreeNode n        = NodeQueue.Dequeue();
                        string   NodeName = Regex.Match(n.Text, @"([A-Z][0-9][0-9])(.*)").Groups[0].ToString();
                        if (NodeName.Length <= 3)
                        {
                            Console.WriteLine(NodeName);
                        }
                        else
                        {
                            NodeName = NodeName.Substring(3);
                        }
                        if (n is Animation)
                        {
                            if (n == e.Node)
                            {
                                continue;
                            }
                            if (NodeName.Equals(AnimName))
                            {
                                running.Children.Add(n);
                            }
                        }
                        if (n is AnimationGroupNode)
                        {
                            foreach (TreeNode tn in n.Nodes)
                            {
                                NodeQueue.Enqueue(tn);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                if (Viewport.Instance.animationPanel1 != null)
                {
                    Console.WriteLine("running" + running.Text);
                    Viewport.Instance.animationPanel1.CurrentAnimation = running;
                }
            }
        }