private void AddRow( AccItem data ) { //// do i need this??? //if ( gridDirs.IsDisposed ) // return; if ( ! map.ContainsKey(data.path) ) { // not in map, need to make new row int id = gridDirs.Rows.Add(); DataGridViewRow row = gridDirs.Rows[id]; row.Cells["Path"] .Value = data.path; row.Cells["Files"].Value = data.countFiles.ToString( "###,###,##0" ); row.Cells["Dirs"] .Value = data.countDirs .ToString( "###,###,##0" ); row.Cells["Links"].Value = data.countLinks.ToString( "###,###,##0" ); row.Cells["Size"] .Value = data.size .ToString( "###,###,###,##0" ); // add to map map.Add( data.path, row ); } else { // already in map, need to update existing row DataGridViewRow row = map[data.path]; row.Cells["Path"]. Value = data.path + " (updated)"; row.Cells["Files"].Value = data.countFiles.ToString( "###,###,##0" ); row.Cells["Dirs"] .Value = data.countDirs .ToString( "###,###,##0" ); row.Cells["Links"].Value = data.countLinks.ToString( "###,###,##0" ); row.Cells["Size"] .Value = data.size .ToString( "###,###,###,##0" ); } }
public void Accumulate( AccItem item ) { this.size += item.size; this.countFiles += item.countFiles; this.countDirs += item.countDirs; this.countLinks += item.countLinks; }
private void HandleMessageImportant( AccItem data ) { if ( gridDirs.InvokeRequired ) { MethodCaller2 d = new MethodCaller2( AddRow ); gridDirs.Invoke( d, new object[] { data } ); } else AddRow( data ); }