public void Flag() { //filter known_good _flaggable = _flaggable.Where(kvp => !_known_good.Contains(kvp.Key)); if (_flaggable.Count() != 0) { // get TreeNode corresponding to most unusual score _flagged_cell = _flaggable.First().Key; } else { _flagged_cell = null; } if (_flagged_cell == null) { System.Windows.Forms.MessageBox.Show("No bugs remain."); ResetTool(); } else { // get cell COM object var com = _flagged_cell.GetCOMObject(_app); // save old color var cc = new CellColor(com.Interior.ColorIndex, com.Interior.Color); if (_colors.ContainsKey(_flagged_cell)) { _colors[_flagged_cell] = cc; } else { _colors.Add(_flagged_cell, cc); } // highlight cell com.Interior.Color = System.Drawing.Color.Red; _tool_highlights.Add(_flagged_cell); // go to highlighted cell ActivateAndCenterOn(_flagged_cell, _app); // enable auditing buttons SetTool(active: true); } }