public void HandleFirstDotClicked(object o) { var values = (int[])o; int Row = values[0]; int Col = values[1]; //Clicked Same if (startClickDot != null && startClickDot.Row == Row && startClickDot.Col == Col) { //Deselect startClickDot.IsSelected = false; startClickDot = null; return; } //Clicked Another if (startClickDot != null) { startClickDot.IsSelected = false; startClickDot = null; } startClickDot = Shapes.Dots[FieldSize * Row + Col]; startClickDot.IsSelected = true; }
public void HandleSecondDotClicked(object o) { //Start must precede if (startClickDot == null) { return; } var values = (int[])o; int Row = values[0]; int Col = values[1]; //Toggle on if (IsValidEndPoint(Row, Col)) { endClickDot = Shapes.Dots[FieldSize * Row + Col]; model.AddNewLine(new Tuple <Point, Point>(new Point(startClickDot.Row, startClickDot.Col) , new Point(endClickDot.Row, endClickDot.Col))); startClickDot.IsSelected = false; startClickDot = null; endClickDot = null; } }