private void TreeViewForm_Load(object sender, EventArgs e) { if (_data == null) { Text = $@"颜色含义:{KnownColor.PowderBlue}为甲有乙无/大小不一致,{KnownColor.PaleVioletRed}为甲无乙有"; return; } Text = _data.TorrentName; var treenode = new TreeNode(_data.TorrentName); long length = 0; var task = new Task(() => { _node = new Node(_data.GetRawFileListWithAttribute()); length = _node.InsertTo(treenode.Nodes); }); task.ContinueWith(t => { Invoke(new Func <TreeNode, int>(treeView1.Nodes.Add), treenode); Invoke(new Action(treenode.Expand), null); if (length == 0) { return; } Invoke(new Action(() => { Text += $@" [{FileSize.FileSizeToString(length)}]"; treenode.Text += $@" [{FileSize.FileSizeToString(length)}]"; }), null); }); task.Start(); }
public DataGridViewRow ToRow() { var row = new DataGridViewRow { Tag = this }; row.Cells.Add(new DataGridViewTextBoxCell { Value = RelativePath }); row.Cells.Add(new DataGridViewTextBoxCell { Value = FileName }); row.Cells.Add(new DataGridViewTextBoxCell { Value = FileSize.FileSizeToString(Length) }); row.DefaultCellStyle.BackColor = StateColor[State]; return(row); }