private static void CellModel_PairFound(object sender, FoundMatchEventArgs e) { if (!doingXWing) { CellModel cellModel = (CellModel)sender; HandlePairs(cells.Where(f => f.Row == cellModel.Row)); HandlePairs(cells.Where(f => f.Column == cellModel.Column)); HandlePairs(cells.Where(f => f.Section == cellModel.Section)); } }
private void RaisePairLeft(bool isInit, string reason) { EventHandler <FoundMatchEventArgs> handler = PairOfNumbersLeft; if (handler != null) { FoundMatchEventArgs foundMatchEventArgs = new FoundMatchEventArgs { IsInit = isInit, Reason = reason }; handler(this, foundMatchEventArgs); } }
private void RaiseFindMatch(bool isInit, string reason) { EventHandler <FoundMatchEventArgs> handler = MatchedNumber; if (handler != null) { FoundMatchEventArgs foundMatchEventArgs = new FoundMatchEventArgs { IsInit = isInit, Reason = reason }; handler(this, foundMatchEventArgs); } }
private static void CellModel_MatchedNumber(object sender, FoundMatchEventArgs e) { ProcessingCount += 1; Console.WriteLine(e.Reason); WriteGrid(); CellModel cellModel = (CellModel)sender; int value = cellModel.Number.Value; ProcessSectionAfterRemoval(cells.Where(c => c.Section == cellModel.Section), cellModel); ProcessSectionAfterRemoval(cells.Where(c => c.Row == cellModel.Row), cellModel); ProcessSectionAfterRemoval(cells.Where(c => c.Column == cellModel.Column), cellModel); ProcessingCount -= 1; if (ProcessingCount == 0 && !e.IsInit) { FindSinglePossibleAnswers(); } }