//Normally the list-building logic would be in its own method on a separate thread. But this is a bit of a special case. public override void Run() { if (string.IsNullOrEmpty(Source) || string.IsNullOrEmpty(Destination)) throw new InvalidOperationException("Source and Destination must both be defined."); CopyOperation operation = BuildOperation(); OperationWorker worker = new OperationWorker(1, "Single file backup: " + Source); worker.ProgressMade += Worker_ProgressMade; worker.EnqueueOperation(operation); worker.Start(); }
private void RegisterWorker(RootSet roots) { OperationWorker worker = new OperationWorker(threadsPerWorker, roots.ToString()); worker.ProgressMade += Worker_ProgressMade; workers.Add(roots, worker); if (State == OperationState.Running) { worker.Start(); } }