private void bCreatePool_Click(object sender, EventArgs e) { if (MessageBox.Show("Wipe out and recreate the pool?", "Create Pool", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { ThreadPool.QueueUserWorkItem(x => BatchServiceClient.ReCreatePool()); } }
private void bDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Delete all your workitems?", "Delete", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { ThreadPool.QueueUserWorkItem(x => BatchServiceClient.Delete()); } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { while (true) { try { string log = BatchServiceClient.FetchLog(); if (string.IsNullOrEmpty(log)) { Thread.Sleep(1000); TaskbarManager.Instance.SetProgressValue(BatchServiceClient.progress, 100); pbJobProgress.Invoke((MethodInvoker) delegate() { pbJobProgress.Value = BatchServiceClient.progress; }); if (!BatchServiceClient.IsRunning()) { TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress); } } else { tbLogs.Invoke((MethodInvoker) delegate() { tbLogs.AppendText(log + "\n"); }); } } catch { break; } } }
private void bSubmit_Click(object sender, EventArgs e) { Settings.inputContainer = cbInput.Text; Settings.resourceContainer = cbResource.Text; Settings.outputContainer = cbOutput.Text; ThreadPool.QueueUserWorkItem(x => { BatchServiceClient.Submit(); }); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (BatchServiceClient.IsRunning()) { DialogResult res = MessageBox.Show("Do you want to terminate job before quit?", "Info", MessageBoxButtons.YesNoCancel); if (res == System.Windows.Forms.DialogResult.Cancel) { e.Cancel = true; } else if (res == System.Windows.Forms.DialogResult.Yes) { BatchServiceClient.Terminate(); } } }
private void bTerminate_Click(object sender, EventArgs e) { ThreadPool.QueueUserWorkItem(x => BatchServiceClient.Terminate()); }