Exemplo n.º 1
0
        private void getDirectorySizes(object state)
        {
            string strdir = state.ToString();
            long   dsize  = getSize(strdir);

            if (dsize > 0)
            {
                this.Invoke((MethodInvoker) delegate
                {
                    var nodes = treeView1.Nodes.Find(strdir, true);
                    if (nodes != null && nodes.Count() > 0)
                    {
                        var node     = nodes[0];
                        SizeClass sc = new SizeClass()
                        {
                            size = dsize, path = strdir
                        };
                        node.Tag            = sc;
                        sc.PropertyChanged += (a, b) => {
                            SizeClass _sc = (SizeClass)a;
                            if (_sc != null)
                            {
                                updateListView(_sc);
                            }
                        };
                    }
                    updateListView(strdir, dsize);
                    listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                });
            }
        }
Exemplo n.º 2
0
 private void updateListView(SizeClass sc)
 {
     this.Invoke((MethodInvoker) delegate {
         updateListView(sc.path, sc.size);
         var nodes = treeView1.Nodes.Find(sc.path, true);
         if (nodes != null && nodes.Count() > 0)
         {
             var node = nodes[0];
             node.Tag = sc;
         }
     });
 }
Exemplo n.º 3
0
 private void updateListView(SizeClass sc)
 {
     this.Invoke((MethodInvoker)delegate {
         updateListView(sc.path, sc.size);
         var nodes = treeView1.Nodes.Find(sc.path, true);
         if (nodes != null && nodes.Count() > 0)
         {
             var node = nodes[0];
             node.Tag = sc;
         }
     });
 }
Exemplo n.º 4
0
        private void getDirectorySizes(object state)
        {
            string strdir = state.ToString();
            long dsize = getSize(strdir);
            if (dsize > 0)
            {
                this.Invoke((MethodInvoker)delegate
                {
                    var nodes = treeView1.Nodes.Find(strdir, true);
                    if (nodes != null && nodes.Count() > 0)
                    {
                        var node = nodes[0];
                        SizeClass sc = new SizeClass() { size = dsize, path = strdir };
                        node.Tag = sc;
                        sc.PropertyChanged += (a, b) => {
                            SizeClass _sc = (SizeClass)a;
                            if(_sc!=null)
                                updateListView(_sc);
                        };

                    }
                    updateListView(strdir, dsize);
                    listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                });
            }
        }