/// <summary> /// Shows the priority dialog box. /// </summary> /// <param name="entries">The entries.</param> /// <param name="form">The form.</param> private void ShowPriorityDialogBox(IEnumerable<PlanEntry> entries, PlanPrioritiesEditorWindow form) { bool showDialog = Settings.UI.PlanWindow.PrioritiesMsgBox.ShowDialogBox; // User wishes the dialog to be displayed if (showDialog) { string text = String.Concat("This would result in a priority conflict.", " (Either pre-requisites with a lower priority or dependant skills with a higher priority).\r\n\r\n", "Click Yes if you wish to do this and adjust the other skills\r\nor No if you do not wish to change the priority."); const string CaptionText = "Priority Conflict"; const string CbOptionText = "Do not show this dialog again"; // Shows the custom dialog box DialogResult dialogResult = MessageBoxCustom.Show(this, text, CaptionText, CbOptionText, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); Settings.UI.PlanWindow.PrioritiesMsgBox.ShowDialogBox = !MessageBoxCustom.CheckBoxChecked; // When the checkbox is checked we store the dialog result if (MessageBoxCustom.CheckBoxChecked) Settings.UI.PlanWindow.PrioritiesMsgBox.DialogResult = dialogResult; if (dialogResult == DialogResult.Yes) m_plan.SetPriority(DisplayPlan, entries, form.Priority); } // User wishes the dialog not to be displayed and has set the dialog result to "Yes" else if (Settings.UI.PlanWindow.PrioritiesMsgBox.DialogResult == DialogResult.Yes) m_plan.SetPriority(DisplayPlan, entries, form.Priority); }
/// <summary> /// Context menu > Change priority. /// Opens a dialog box to edit the priorities. Check for concflicts and asks the user when needed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void miChangePriority_Click(object sender, EventArgs e) { IList<PlanEntry> entries = SelectedEntries.ToList(); using (PlanPrioritiesEditorWindow form = new PlanPrioritiesEditorWindow()) { // Gets the entry's priority (or default if more than one item selected) form.Priority = PlanEntry.DefaultPriority; if (lvSkills.SelectedItems.Count == 1) { PlanEntry pe = GetPlanEntry(lvSkills.SelectedItems[0]); if (pe != null) form.Priority = pe.Priority; } // User canceled ? DialogResult dr = form.ShowDialog(); if (dr == DialogResult.Cancel) return; // Update priorities, while performing backup for subsequent check if (m_plan.TrySetPriority(DisplayPlan, entries, form.Priority)) return; ShowPriorityDialogBox(entries, form); } }