Пример #1
0
        private void DeleteWorker_Click(object sender, EventArgs e)
        {
            if (worker != null)
            {
                current.Workers.Remove(worker);
                worker = null;

                this.RefreshWorkerList();
            }
        }
Пример #2
0
        private void DoWorkerUpdate()
        {
            worker = WorkerList.SelectedItem as Worker;
            if (worker != null)
            {
                worker.Queue = WorkerQueue.Text;

                this.RefreshWorkerList();
            }
        }
Пример #3
0
        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();
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        private void PrepareWorkerForAdd()
        {
            this.WorkerButton.Text = "Add";
            this.WorkerQueue.Text = string.Empty;

            this.NumberOfWorkerThreads.Text = "?";
            worker = null;

            this.DeleteWorker.Enabled = false;
        }
Пример #6
0
        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;
        }