private void GameAvatarImage_Initialized(object sender, EventArgs e) { Image image = sender as Image; Game game = image.DataContext as Game; Border border = image.Parent as Border; image.Stretch = Stretch.UniformToFill; try { image.Source = new BitmapImage(new Uri(ImageUploaded.GetDestinationPath(game.Picture.ImageSource, "../GameConstructor.Core/Images")));; if (game.Picture.IsBorderRequired) { border.BorderThickness = new Thickness(defaultBorderThickness); } else { border.BorderThickness = new Thickness(0); } } catch { image.Source = new BitmapImage(new Uri(ImageUploaded.GetDestinationPath( "gamepad.png", "../GameConstructor.Core/Images"))); border.BorderThickness = new Thickness(defaultBorderThickness); } }
private void GameAvatarImage_Initialized(object sender, EventArgs e) { var picture = _game.Picture; Border imageBorder = GameAvatarImage.Parent as Border; GameAvatarImage.Stretch = Stretch.UniformToFill; try { GameAvatarImage.Source = new BitmapImage(new Uri(ImageUploaded.GetDestinationPath(picture.ImageSource, "../GameConstructor.Core/Images")));; if (picture.IsBorderRequired) { imageBorder.BorderThickness = new Thickness(defaultBorderThickness); } else { imageBorder.BorderThickness = new Thickness(0); } } catch { GameAvatarImage.Source = new BitmapImage(new Uri(ImageUploaded.GetDestinationPath(defaultImageSource, "../GameConstructor.Core/Images")));; imageBorder.BorderThickness = new Thickness(defaultBorderThickness); } }
private void UploadImageButton_Click(object sender, RoutedEventArgs e) { try { ImageUploaded imageUploadingProcess = new ImageUploaded(); imageUploadingProcess.UploadImageAndSave(); _picture = imageUploadingProcess.Picture; EditAvatarImage.Source = new BitmapImage(new Uri(ImageUploaded.GetDestinationPath(_picture.ImageSource, "../GameConstructor.Core/Images"))); if (_picture.IsBorderRequired) { (EditAvatarImage.Parent as Border).BorderThickness = new Thickness(defaultBorderThickness); } else { (EditAvatarImage.Parent as Border).BorderThickness = new Thickness(0); } } catch { } }