private void DeleteWorker_Click(object sender, EventArgs e) { if (worker != null) { current.Workers.Remove(worker); worker = null; this.RefreshWorkerList(); } }
private void DoWorkerUpdate() { worker = WorkerList.SelectedItem as Worker; if (worker != null) { worker.Queue = WorkerQueue.Text; this.RefreshWorkerList(); } }
private void DoWorkerAdd() { if (current == null) return; Worker w = new Worker(); w.Queue = WorkerQueue.Text; current.Workers.Add(w); this.RefreshWorkerList(); this.WorkerList.SelectedItem = w; this.PrepareForUpdate(); }
private void PrepareWorkerForUpdate() { worker = WorkerList.SelectedItem as Worker; if (worker != null) { this.WorkerButton.Text = "Update"; this.WorkerQueue.Text = worker.Queue; this.NumberOfWorkerThreads.Text = worker.NumberOfWorkerThreads.ToString(); this.DeleteWorker.Enabled = true; } }
private void PrepareWorkerForAdd() { this.WorkerButton.Text = "Add"; this.WorkerQueue.Text = string.Empty; this.NumberOfWorkerThreads.Text = "?"; worker = null; this.DeleteWorker.Enabled = false; }
private void RefreshWorkerList() { if (current != null) { this.WorkerList.SuspendLayout(); object selected = this.WorkerList.SelectedItem; this.WorkerList.DataSource = null; this.WorkerList.DataSource = current.Workers; this.WorkerList.SelectedItem = selected; this.WorkerList.ResumeLayout(true); worker = this.WorkerList.SelectedItem as Worker; } else WorkerList.DataSource = null; }