private void RenameSelectedJob() { PendingPrintJob job = (PendingPrintJob)pendingJobsListbox.SelectedItem; if (job != null) { string currentSnapshotName = job.Name; string newSnapshotName = ReadSnapshotName(currentSnapshotName); if (newSnapshotName == null) { // User cancelled return; } if (!newSnapshotName.Equals(currentSnapshotName)) { try { job.Rename(newSnapshotName); pendingJobsListbox.Items[pendingJobsListbox.SelectedIndex] = job; } catch (Exception ex) { MessageBox.Show(ex.ToString(), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
/// <summary> /// Show the user a dialog requesting a snapshot name. /// If the name is iinvalid, ask him again until he sets a right name. /// If the user cancels, returns null. /// </summary> /// <returns></returns> private static string ReadSnapshotName(string currentSnapshotName) { string snapshotName = currentSnapshotName; do { snapshotName = StringInput.GetString(Trans.T("L_POSTPONED_JOB_NAME"), Trans.T("L_NAME_POSTPONED_JOB"), snapshotName, true); if (snapshotName == null) { // User cancelled. return(null); } } while (PendingPrintJob.IsInvalidSnapshotName(snapshotName)); return(snapshotName); }
private void KillSelectedJob() { PendingPrintJob job = (PendingPrintJob)pendingJobsListbox.SelectedItem; if (job != null) { if (MessageBox.Show(Trans.T1("L_CONFIRM_DELETE_JOB", job.Name), Trans.T("L_SECURITY_QUESTION"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { job.Delete(); pendingJobsListbox.Items.Remove(job); } catch (Exception ex) { MessageBox.Show(ex.ToString(), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void RestoreSelectedJob() { this.selectedJob = (PendingPrintJob)pendingJobsListbox.SelectedItem; this.Close(); }