private void SetVideo(string pathToImage) { // Check if there is an mp4 or Flv. // If none exists then use the original image path instead. var videoPath = pathToImage.Replace(".png", ".mp4"); if (!File.Exists(videoPath)) { videoPath = videoPath.Replace(".mp4", ".flv"); if (!File.Exists(videoPath)) { if (File.Exists(pathToImage)) { IsImageSource = true; currentImagePath = pathToImage; MediaPaneHeader += " | " + Path.GetFileName(pathToImage); _selectedService.GameImage = SelectedService.SetBitmapFromUri(new Uri(pathToImage)); WheelSource = _selectedService.GameImage; IsVideoSource = false; } } else { SetVideoSource(videoPath); } } else { SetVideoSource(videoPath); } }
private void SetMediaForGameHs(string[] selectedOptions) { WheelSource = null; VideoSource = null; IsVideoSource = false; IsImageSource = false; IsPdf = false; var hsPath = _settingsRepo.HypermintSettings.HsPath; var romName = selectedOptions[0]; _selectedService.CurrentRomname = romName; MediaPaneHeader = "Media View: " + selectedOptions[1]; var mediaTypePath = Images.Wheels; if (!string.IsNullOrEmpty(selectedOptions[1])) { mediaTypePath = GetMediaPath(selectedOptions[1]); } //Set the image path TODO: Adjust for Multi-System var imagePath = Path.Combine(hsPath, Root.Media, _selectedService.CurrentSystem, mediaTypePath, romName + ".png"); if (selectedOptions[1] == "Videos") { SetVideo(imagePath); return; } if (selectedOptions[1].Contains("Sound") || selectedOptions[1] == "MusicBg") { if (selectedOptions[1] == "Wheel Sounds") { return; } else { SetSound(imagePath); return; } } if (!File.Exists(imagePath)) { WheelSource = _selectedService.SystemImage; IsImageSource = true; } else { IsImageSource = true; currentImagePath = imagePath; _selectedService.GameImage = SelectedService.SetBitmapFromUri(new Uri(imagePath)); WheelSource = _selectedService.GameImage; MediaPaneHeader += " | " + Path.GetFileName(imagePath) + " W:" + Math.Round(WheelSource.Width) + " H:" + Math.Round(WheelSource.Height); } }
public SimpleWheelViewModel(ISelectedService selectedService, IEventAggregator ea) { _selectedService = selectedService; _eventAggregator = ea; Patterns = Enum.GetNames(typeof(WheelCreator.Patterns)); _eventAggregator.GetEvent <GenerateWheelEvent>().Subscribe(x => { //GenerateWheelSource = new BitmapImage(new Uri(Path.GetFullPath(x))); GenerateWheelSource = SelectedService.SetBitmapFromUri(new Uri(Path.GetFullPath(x))); }); }
private void SetImageWheelPreview(string imagePath) { WheelSource = null; VideoSource = null; IsVideoSource = false; if (File.Exists(imagePath)) { IsImageSource = true; var fullpath = Path.GetFullPath(imagePath); currentImagePath = fullpath; _selectedService.GameImage = SelectedService.SetBitmapFromUri(new Uri(currentImagePath)); WheelSource = _selectedService.GameImage; MediaPaneHeader = "Media View | " + currentImagePath + " W:" + Math.Round(WheelSource.Width) + " H:" + Math.Round(WheelSource.Height); } }