Beispiel #1
0
 private void SetDefaultHarnessOrder()
 {
     if (string.IsNullOrEmpty(HarnessOrder.Trim()))
     {
         HarnessOrder = string.Join(", ", Harnesses.Select(h => h.Letter.ToLower()));
     }
 }
Beispiel #2
0
        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()));
        }
Beispiel #3
0
        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";
                }
            }
        }