public override bool OnOk() { bool result = true; List <(OutputStyle Style, Regex Pattern)>?list = null; foreach (ListViewItem item in this.lstPatterns.Items) { if (Enum.TryParse(item.SubItems[0].Text, out OutputStyle style) && ExecutableStep.TryParseRegex(item.SubItems[1].Text, out Regex? regex)) { list ??= new(); list.Add((style, regex)); } else { item.Selected = true; item.EnsureVisible(); WindowsUtility.ShowError(this, "The selected custom style is invalid."); this.lstPatterns.Focus(); item.Focused = true; result = false; break; } } if (result && this.step != null) { this.step.AutoColorErrorsAndWarnings = this.chkAutoColorErrorsAndWarnings.Checked; this.step.CustomOutputStyles = list; } return(result); }
private ExecutableStep[] GetCheckedSteps(StepCategory category) { List <ExecutableStep> steps = new(); foreach (ListViewItem item in this.List.CheckedItems) { ExecutableStep step = (ExecutableStep)item.Tag; if (step.Category == category) { steps.Add(step); } } ExecutableStep[] result = steps.ToArray(); return(result); }