/// <summary> /// Mark row for editing and show an AddJobForm specified for editing /// </summary> /// <param name="row"></param> private void ShowEditBox(int row) { var templateList = _session.QueryOver<ConfigFile>().Where(x => x.FilePath == "Template").List(); var locked = (string)JobQueueDGV.Rows[row].Tag == "Locked"; JobQueueDGV.Rows[row].Tag = "Editing"; var oldHi = (HistoryItem) JobQueueDGV[0, row].Tag; var addJob = new ConfigWizard(oldHi, templateList, true); if (addJob.ShowDialog() == DialogResult.OK) { var newHi = addJob.GetHistoryItems().FirstOrDefault(); if (newHi == null) return; _programmaticallyPaused = true; _session.Delete(oldHi); JobQueueDGV.Rows.RemoveAt(row); InsertRowFromHistoryItem(newHi, row); _programmaticallyPaused = false; } JobQueueDGV.Rows[row].Tag = locked ? "Locked" : string.Empty; CheckForRunableJob(); }
/// <summary> /// Show AddJobForm with given properties already filled out /// </summary> /// <param name="oldHi"></param> private void ShowCloneBox(HistoryItem oldHi) { var templateList = _session.QueryOver<ConfigFile>().Where(x => x.FilePath == "Template").List(); var addJob = new ConfigWizard(oldHi, templateList, false); if (addJob.ShowDialog() == DialogResult.OK) { var items = addJob.GetHistoryItems(); foreach (var hi in items) InsertRowFromHistoryItem(hi, JobQueueDGV.Rows.Count - 1); _programmaticallyPaused = false; } CheckForRunableJob(); }