private void populateBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { if (populateBackgroundWorker.CancellationPending) { e.Cancel = true; return; } HashSet<int> added = new HashSet<int>(); int count = 0; clearView(); pqeList = new PrintQueueEntryList(includePrinted); pqeList.BackgroundListLoad(); if (populateBackgroundWorker.CancellationPending) { e.Cancel = true; return; } if (pqeList != null) { pqeList.Sort(delegate(HraObject a, HraObject b) { return ((PrintQueueEntry)a).unitnum.CompareTo(((PrintQueueEntry)b).unitnum); }); foreach (PrintQueueEntry pqe in pqeList) { if (populateBackgroundWorker.CancellationPending) { e.Cancel = true; return; } if (added.Contains(pqe.ID) == false) { double percent = 100 * count / (double)(pqeList.Count); added.Add(pqe.ID); populateBackgroundWorker.ReportProgress((int)percent, pqe); } } } }
private void getSelectedPrintQueueEntries() { selectedList = new PrintQueueEntryList(); if (fastDataListView1.SelectedObjects != null) { foreach (PrintQueueEntry p in fastDataListView1.SelectedObjects) { selectedList.Add(p); } } }