public void saveArray(GameType gameType, Window actualWindow, Canvas canvas) { if (gameType == GameType.Pvp && !shipCounts.Contains(1)) { if (!secondPlayerPicked) { firstArrayFinal = shipMatrix; Application.Current.Properties[prop_playerArray] = shipMatrix; ClearCanvas(ref shipMatrix, ref shipCounts, _width, _height, canvas); secondPlayerPicked = true; } else { secondArrayFinal = shipMatrix; Application.Current.Properties[prop_2ndPlayerArray] = shipMatrix; Battle battleWindow = new Battle(_width, _height, firstArrayFinal, secondArrayFinal); battleWindow.Show(); actualWindow.Close(); } } else if (gameType == GameType.PvAi && !shipCounts.Contains(1)) { firstArrayFinal = shipMatrix; Application.Current.Properties[prop_playerArray] = shipMatrix; AIPlayer aIPlayer = new AIPlayer(); int[,] aimatrix = aIPlayer.AIPlaceShips(); Application.Current.Properties[prop_2ndPlayerArray] = aimatrix; Battle battleWindow = new Battle(_width, _height, firstArrayFinal, firstArrayFinal); battleWindow.Show(); actualWindow.Close(); } else { _toShowMessage.Content = "There are more ship to place"; } }