private void CreateNewBoard(int rowCount, int colCount) { StopAutoplay(); if (mVisualModel != null) { mVisualModel.Reset(); mVisualModel.CellLeftMouseDown -= VisualModel_CellLeftMouseDown; } mModel = new BoardModel(rowCount, colCount, Stepper); mVisualModel = new VisualBoardModel(grdBoard, mModel); mVisualModel.CellLeftMouseDown += VisualModel_CellLeftMouseDown; }
public VisualBoardModel(Grid layout, BoardModel model) { Layout = layout; RowCount = model.RowCount; ColCount = model.ColCount; Model = model; ElemVisibleFill.Freeze(); ElemHiddenFill.Freeze(); ElemTransform.Freeze(); Elements = new Shape[model.RowCount, model.ColCount]; CreateLayout(); CreateCells(); Model.ModelChanged += Model_ModelChanged; }