private void SetDefaultHarnessOrder() { if (string.IsNullOrEmpty(HarnessOrder.Trim())) { HarnessOrder = string.Join(", ", Harnesses.Select(h => h.Letter.ToLower())); } }
private Dictionary <int, string[]> GetHarnessGroups() { var groups = HarnessOrder.Trim().Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()); var indexedGroups = groups.Select((group, index) => new { Index = index, GroupChars = group.ToCharArray().Select(c => c.ToString().ToLower()) }); return(indexedGroups.ToDictionary(row => row.Index, row => row.GroupChars.ToArray())); }
public void AlertUnusedHarnesses(DataGridView dataGridView) { SetDefaultHarnessOrder(); var harnessesDefined = Harnesses.Select(h => h.Letter.ToLower()); var harnessesInUse = HarnessOrder.ToCharArray().Select(c => c.ToString().ToLower()); var unused = harnessesDefined.Except(harnessesInUse); foreach (DataGridViewRow row in dataGridView.Rows) { if (row.IsNewRow) { continue; } row.ErrorText = null; if (unused.Contains(row.Cells["colLetter"].Value.ToString().ToLower())) { row.ErrorText = "Your pattern doesn't use this harness"; } } }