Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     TimeCounter.Start();
     _tree.FullUpdate();
     //_model.Root.Nodes[0].Text = "Child";
     button1.Text = TimeCounter.Finish().ToString();
 }
Ejemplo n.º 2
0
        private void _load_Click(object sender, EventArgs e)
        {
            label3.Text = "Working";
            Application.DoEvents();

            _treeView.Model = null;
            _model          = null;
            GC.Collect(3);

            TimeCounter.Start();

            _model = new TreeModel();
            for (int i = 0; i < 10; i++)
            {
                _model.Root.Nodes.Add(new Node(i.ToString()));
                for (int n = 0; n < 500; n++)
                {
                    _model.Root.Nodes[i].Nodes.Add(new Node(n.ToString()));
                    for (int k = 0; k < 5; k++)
                    {
                        _model.Root.Nodes[i].Nodes[n].Nodes.Add(new Node(k.ToString()));
                    }
                }
            }

            _treeView.Model = _model;

            label3.Text = TimeCounter.Finish().ToString();
        }
Ejemplo n.º 3
0
        private void _load2_Click(object sender, EventArgs e)
        {
            label5.Text = "Working";
            Application.DoEvents();

            _treeView2.Nodes.Clear();

            TimeCounter.Start();
            _treeView2.BeginUpdate();

            List <TreeNode> list = new List <TreeNode>();

            for (int i = 0; i < 10; i++)
            {
                list.Add(new TreeNode(i.ToString()));
                for (int n = 0; n < 500; n++)
                {
                    list[i].Nodes.Add(n.ToString());
                    for (int k = 0; k < 5; k++)
                    {
                        list[i].Nodes[n].Nodes.Add(k.ToString());
                    }
                }
            }
            _treeView2.Nodes.AddRange(list.ToArray());

            _treeView2.EndUpdate();
            label5.Text = TimeCounter.Finish().ToString();
        }
Ejemplo n.º 4
0
        private void EndPerformanceCount(PaintEventArgs e)
        {
            double time = TimeCounter.Finish();

            _totalTime += time;
            string debugText = string.Format("FPS {0:0.0}; Avg. FPS {1:0.0}",
                                             1 / time, 1 / (_totalTime / _paintCount));

            e.Graphics.FillRectangle(Brushes.White, new Rectangle(DisplayRectangle.Width - 150, DisplayRectangle.Height - 20, 150, 20));
            e.Graphics.DrawString(debugText, Control.DefaultFont, Brushes.Gray,
                                  new PointF(DisplayRectangle.Width - 150, DisplayRectangle.Height - 20));
        }
Ejemplo n.º 5
0
        public void ClearTest()
        {
            Node node = new Node("");
            int  num  = 125000;

            for (int i = 0; i < num; i++)
            {
                node.Nodes.Add(new Node());
            }
            Assert.AreEqual(num, node.Nodes.Count);

            TimeCounter.Start();
            node.Nodes.Clear();
            Console.WriteLine("Clear: {0}", TimeCounter.Finish());

            Assert.AreEqual(0, node.Nodes.Count);
        }
Ejemplo n.º 6
0
        public void NodesTest()
        {
            TreeNodeAdv target = new TreeNodeAdv(null);

            Aga.Controls.UnitTests.Aga_Controls_Tree_TreeNodeAdvAccessor accessor = new Aga.Controls.UnitTests.Aga_Controls_Tree_TreeNodeAdvAccessor(target);
            Collection <TreeNodeAdv> nodes = accessor.Nodes;

            TimeCounter.Start();
            for (int i = 0; i < 125000; i++)
            {
                nodes.Add(new TreeNodeAdv(null));
            }
            Console.WriteLine("Add: {0}", TimeCounter.Finish());

            TimeCounter.Start();
            accessor.Nodes.Clear();
            Console.WriteLine("Clear: {0}", TimeCounter.Finish());
            Assert.AreEqual(0, accessor.Nodes.Count);
        }
Ejemplo n.º 7
0
        private void _expand_Click(object sender, EventArgs e)
        {
            if (_treeView.Root.Children.Count > 0)
            {
                label4.Text = "Working";
                Application.DoEvents();

                TimeCounter.Start();

                if (_treeView.Root.Children[0].IsExpanded)
                {
                    _treeView.CollapseAll();
                }
                else
                {
                    _treeView.ExpandAll();
                }

                label4.Text = TimeCounter.Finish().ToString();
            }
        }
Ejemplo n.º 8
0
        private void _expand2_Click(object sender, EventArgs e)
        {
            if (_treeView2.Nodes.Count > 0)
            {
                label6.Text = "Working";
                Application.DoEvents();

                TimeCounter.Start();

                //treeView1.BeginUpdate();
                if (_treeView2.Nodes[0].IsExpanded)
                {
                    _treeView2.CollapseAll();
                }
                else
                {
                    _treeView2.ExpandAll();
                }
                //treeView1.EndUpdate();

                label6.Text = TimeCounter.Finish().ToString();
            }
        }
Ejemplo n.º 9
0
        private void _load_Click(object sender, EventArgs e)
        {
            label3.Text = "Working";
            Application.DoEvents();

            _treeView.Model = null;
            _model          = null;
            GC.Collect(3);

            TimeCounter.Start();

            _model = new TreeModel();
            for (int i = 0; i < 10; i++)
            {
                Node node = new Node(i.ToString());
                node.Image = Properties.Resources.P;

                _model.Root.Nodes.Add(node);
                for (int n = 0; n < 500; n++)
                {
                    Node node1 = new Node(n.ToString());
                    node1.Image = Properties.Resources.c1;
                    node.Nodes.Add(node1);
                    for (int k = 0; k < 5; k++)
                    {
                        Node node2 = new Node(k.ToString());
                        node2.Image = Properties.Resources.c2;
                        node1.Nodes.Add(node2);
                    }
                }
            }

            _treeView.Model = _model;

            label3.Text = TimeCounter.Finish().ToString();
        }
Ejemplo n.º 10
0
        public void TestMethod()
        {
            Bitmap    b    = new Bitmap(500, 50);
            Graphics  gr   = Graphics.FromImage(b);
            int       num  = 5000;
            string    text = "Some Text String";
            Rectangle rect = new Rectangle(0, 0, 500, 50);

            TimeCounter.Start();
            for (int i = 0; i < num; i++)
            {
                TextRenderer.MeasureText(text, Control.DefaultFont);
                TextRenderer.DrawText(gr, text, Control.DefaultFont, rect, Color.Black);
            }
            Console.WriteLine("TextRenderer {0}", TimeCounter.Finish());

            TimeCounter.Start();
            for (int i = 0; i < num; i++)
            {
                gr.MeasureString(text, Control.DefaultFont);
                gr.DrawString(text, Control.DefaultFont, Brushes.Black, rect);
            }
            Console.WriteLine("Graphics {0}", TimeCounter.Finish());
        }