public void SetsImage(Fighter_DTO pDTO) { Image ima = new Image(); //gets image from participant to move. string image = pDTO.ImageGS; //finds the image field based on the coords string fieldName = pDTO.PointGS.ToString(); ima = (Image)FieldGrid.FindName(fieldName); ima.Stretch = Stretch.Fill; ima.Source = new BitmapImage(new Uri(System.IO.Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\Sources\\" + image)); }
//only called initially public void InsertParticipantsToField() { arenaImpl.SetActivePlayers(Shuffle(GetActivePlayers())); foreach (Fighter_DTO pDTO in Arena_DTO.ActiveFighters) { ListOfParticipants.Items.Add(pDTO.NameGS); //gets image from participant to insert visually string image = pDTO.ImageGS; //Gets fieldCoords from AFP_DTO so we can find the appropriate visual field to insert our image string fieldName = pDTO.PointGS.ToString(); //find designated spot on field Image ima = (Image)FieldGrid.FindName(fieldName); ima.Stretch = Stretch.Fill; ima.Source = new BitmapImage(new Uri(System.IO.Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\Sources\\" + image)); } }
public void ClearsImage(Fighter_DTO pDTO) { Image ima = new Image(); ima = (Image)FieldGrid.FindName(pDTO.PointGS.ToString()); //finds image with x:Name that matches coords ima.ClearValue(Image.SourceProperty); //clears the image //do a if check to see what team they are on and then color the field specifically after that. string teamColor = pDTO.TeamColorGS; if (teamColor == "purple") { string image = "purpleField.png"; ima.Source = new BitmapImage(new Uri(System.IO.Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\Sources\\" + image)); } else if (teamColor == "blue") { string image = "blueField.png"; ima.Source = new BitmapImage(new Uri(System.IO.Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\Sources\\" + image)); } }