private void addSendToTemporaryWorkerMenuItem() { jobQueue.AddMenuItem("Run in new temporary worker", null, new MultiJobHandler( delegate(List <TaggedJob> jobs) { // find a good name int number = 0; string name; do { number++; name = "Temporary worker " + number; } while (workers.ContainsKey(name)); JobWorker w = NewWorker(name, false); foreach (TaggedJob j in jobs) { ReleaseJob(j); w.AddJob(j); } this.refresh(); w.Mode = JobWorkerMode.CloseOnLocalListCompleted; w.StartEncoding(true); })); }
internal void RequestNewWorker() { string name = InputBox.Show("Please enter a name for this new worker", "Please enter a name", freeWorkerName()); if (string.IsNullOrEmpty(name)) { return; } if (workers.ContainsKey(name)) { MessageBox.Show("A worker by this name already exists. Adding worker failed", "Adding worker failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } JobWorker w = NewWorker(name, true); w.StartEncoding(true); }
/// <summary> /// adds the "run in new temporary worker" menu item /// </summary> private void AddSendToTemporaryWorkerMenuItem() { globalJobQueue.AddMenuItem("Run in new temporary worker", null, new MultiJobHandler( delegate(List <TaggedJob> jobs) { JobWorker w = NewWorker("Temporary worker"); foreach (TaggedJob j in jobs) { if (j.Status != JobStatus.WAITING) { continue; } AssignJob(j, w.Name); } RefreshStatus(); w.Mode = JobWorkerMode.CloseOnLocalListCompleted; w.IsTemporaryWorker = true; w.StartEncoding(true); })); }