private void ChangeToSplashImage(GameGrid grid)
 {
     Application.Current.Dispatcher.InvokeAsync(() =>
     {
         BitmapFrame image = BitmapFrame.Create(new Uri(@"Pack://application:,,,/Assets/Images/splash.png", UriKind.Absolute));
         grid.backgroundImage.ImageSource = image;
         grid.backgroundImage.Stretch     = Stretch.Uniform;
     });
 }
 public void ChangePlayerGridToSingleBoat(GameGrid grid)
 {
     Application.Current.Dispatcher.InvokeAsync(() =>
     {
         BitmapFrame image = BitmapFrame.Create(new Uri(@"pack://Application:,,,/Assets/Images/destroyerImg.png", UriKind.Absolute));
         grid.backgroundImage.ImageSource = image;
         grid.backgroundImage.Stretch     = Stretch.Uniform;
     });
 }
Example #3
0
 private void CreateComputerGrid()
 {
     for (int i = 0; i < gridSize; i++)
     {
         for (int j = 0; j < gridSize; j++)
         {
             GameGrid square = new GameGrid(i, j, "");
             ComputerButtonsInGame.Add(square);
         }
     }
 }
 private void ChangePlayerGridToBattleShip(int longitude, int latitude, GameGrid grid)
 {
     Application.Current.Dispatcher.InvokeAsync(() =>
     {
         foreach (var c in PlayerButtonsInGame)
         {
             if (c.Longitude == longitude + 1 && c.Latitude == latitude)
             {
                 BitmapFrame image             = BitmapFrame.Create(new Uri(@"Pack://*****:*****@"Pack://application:,,,/Assets/Images/boatTwoBowVerticalImg.png", UriKind.Absolute));
                 c.backgroundImage.ImageSource = image1;
                 c.backgroundImage.Stretch     = Stretch.Uniform;
             }
         }
     });
 }