void RemoveProgressBar(CopyFileWorkItem workItem) { Grid grid = workItem.Tag as Grid; if (grid != null) { progressPanel.Children.Remove(grid); workItem.Tag = null; } }
private Grid FindProgressBar(CopyFileWorkItem workItem) { return workItem.Tag as Grid; }
void MainProgressUpdate(CopyFileWorkItem workItem) { mainProgress.Value += mainProgress.Maximum * workItem.ProgressWeight; }
void AddProgressBar(CopyFileWorkItem workItem) { FileInfo fi = workItem.Item as FileInfo; if (fi != null) { ProgressBar progressBar = new ProgressBar(); progressBar.Height = 19; Grid grid = new Grid(); workItem.Tag = grid; TextBlock text = new TextBlock(); text.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; text.VerticalAlignment = System.Windows.VerticalAlignment.Center; text.Text = string.Format("{0}({1})", workItem.Item.FullName, fi.Length.FormatSize()); grid.Children.Add(progressBar); grid.Children.Add(text); progressPanel.Children.Add(grid); } }