From 2b940b75ef630ec3037804169eb52476fc03e6f4 Mon Sep 17 00:00:00 2001 From: Dinesh Solanki <15937452+DineshSolanki@users.noreply.github.com> Date: Sat, 7 Aug 2021 00:57:16 +0530 Subject: [PATCH] Added feature to open image on single click of mouse in posterPicker and professional mode. Aware of count issue in Professional mode. --- FoliCon/ViewModels/PosterPickerViewModel.cs | 10 ++++++++++ FoliCon/ViewModels/ProSearchResultViewModel.cs | 10 ++++++++++ FoliCon/Views/PosterPicker.xaml | 4 ++++ FoliCon/Views/ProSearchResult.xaml | 4 ++++ 4 files changed, 28 insertions(+) diff --git a/FoliCon/ViewModels/PosterPickerViewModel.cs b/FoliCon/ViewModels/PosterPickerViewModel.cs index 6a806ce3..032ff4c5 100644 --- a/FoliCon/ViewModels/PosterPickerViewModel.cs +++ b/FoliCon/ViewModels/PosterPickerViewModel.cs @@ -50,12 +50,22 @@ public class PosterPickerViewModel : BindableBase, IDialogAware public ObservableCollection ImageUrl { get; set; } public DelegateCommand StopSearchCommand { get; set; } public DelegateCommand PickCommand { get; set; } + public DelegateCommand OpenImageCommand { get; set; } #endregion public PosterPickerViewModel() { ImageUrl = new ObservableCollection(); StopSearchCommand = new DelegateCommand(delegate { StopSearch = true; }); PickCommand = new DelegateCommand(PickMethod); + OpenImageCommand = new DelegateCommand(OpenImageMethod); + } + + private void OpenImageMethod(object parameter) + { + var link = (string)parameter; + new ImageBrowser(Result.MediaType == MediaTypes.Game + ? $"https://{ImageHelper.GetImageUrl(link, ImageSize.HD720)[2..]}" + : link).Show(); } protected virtual void CloseDialog(string parameter) diff --git a/FoliCon/ViewModels/ProSearchResultViewModel.cs b/FoliCon/ViewModels/ProSearchResultViewModel.cs index cb884238..890a800c 100644 --- a/FoliCon/ViewModels/ProSearchResultViewModel.cs +++ b/FoliCon/ViewModels/ProSearchResultViewModel.cs @@ -65,6 +65,7 @@ public bool IsSearchFocused public DelegateCommand SkipCommand { get; set; } public DelegateCommand PickCommand { get; set; } + public DelegateCommand OpenImageCommand { get; set; } public DelegateCommand SearchAgainCommand { get; set; } public DelegateCommand StopSearchCommand { get; set; } @@ -73,10 +74,19 @@ public ProSearchResultViewModel() ImageUrl = new ObservableCollection(); StopSearchCommand = new DelegateCommand(delegate { StopSearch = true; }); PickCommand = new DelegateCommand(PickMethod); + OpenImageCommand = new DelegateCommand(OpenImageMethod); SkipCommand = new DelegateCommand(SkipMethod); SearchAgainCommand = new DelegateCommand(PrepareForSearch); } + private void OpenImageMethod(object parameter) + { + var link = (string)parameter; + var browser = new ImageBrowser(link); + browser.IsFullScreen = true; + browser.Show(); + } + private async void PrepareForSearch() { StopSearch = false; diff --git a/FoliCon/Views/PosterPicker.xaml b/FoliCon/Views/PosterPicker.xaml index f282f4e5..1186873f 100644 --- a/FoliCon/Views/PosterPicker.xaml +++ b/FoliCon/Views/PosterPicker.xaml @@ -51,6 +51,10 @@ Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.(viewModels:PosterPickerViewModel.PickCommand)}" CommandParameter="{Binding Path=Tag, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Image}}}" /> + diff --git a/FoliCon/Views/ProSearchResult.xaml b/FoliCon/Views/ProSearchResult.xaml index 360de3ae..ff0d3a40 100644 --- a/FoliCon/Views/ProSearchResult.xaml +++ b/FoliCon/Views/ProSearchResult.xaml @@ -74,6 +74,10 @@ Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.(viewModels:ProSearchResultViewModel.PickCommand)}" CommandParameter="{Binding Path=Tag, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Image}}}" /> +