// Copy a job... public Submission(string db, string backupdb, Int32Collection jobs, bool move = false) { InitializeComponent(); Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; Title = move ? "Moving..." : "Copying..."; ColumnDefinition c1 = new ColumnDefinition(); ColumnDefinition c2 = new ColumnDefinition(); c1.Width = new GridLength(170); c2.Width = new GridLength(75); outerGrid.ColumnDefinitions.Add(c1); outerGrid.ColumnDefinitions.Add(c2); workers.Clear(); Int32Collection.Enumerator e = jobs.GetEnumerator(); while (e.MoveNext()) { int jobID = e.Current; WindowInteropHelper helper = new WindowInteropHelper(this); SubmissionWorker w = new SubmissionWorker(helper.Handle, workers.Count()); w.DoWork += new DoWorkEventHandler(worker_DoWork); w.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); w.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); w.WorkerReportsProgress = true; w.WorkerSupportsCancellation = false; RowDefinition r = new RowDefinition(); outerGrid.RowDefinitions.Add(r); r.Height = new GridLength(26); Label l = new Label(); l.Content = (move ? "Moving" : "Copying") + " Job #" + jobID.ToString() + "..."; l.Height = 26; Grid.SetRow(l, outerGrid.RowDefinitions.Count() - 1); Grid.SetColumn(l, 0); outerGrid.Children.Add(l); ProgressBar p = new ProgressBar(); p.Height = 26; p.Width = 75; Grid.SetRow(p, outerGrid.RowDefinitions.Count() - 1); Grid.SetColumn(p, 1); outerGrid.Children.Add(p); pbars.Add(w.id, p); String[] args = { "Copy", db, backupdb, jobID.ToString(), move.ToString() }; workers.Add(workers.Count(), w); w.RunWorkerAsync(args); } Mouse.OverrideCursor = null; }