diff --git a/Gavilya/App.xaml.cs b/Gavilya/App.xaml.cs
index c49417e..d53a1f8 100644
--- a/Gavilya/App.xaml.cs
+++ b/Gavilya/App.xaml.cs
@@ -53,6 +53,8 @@ protected override void OnStartup(StartupEventArgs e)
Language.zh_CN => "zh-CN",
});
+ currentProfile.Settings.EnableSearchShortcut ??= true;
+
if (currentProfile.Settings.MakeAutoSave && IsSaveDay(currentProfile.Settings.AutoSaveDay) && !File.Exists($@"{currentProfile.Settings.SavePath}\GavilyaProfiles_{DateTime.Now:yyyy_MM_dd}.g4v"))
{
profiles.Backup(currentProfile.Settings.SavePath);
diff --git a/Gavilya/Components/ExecutableSelectorComponent.xaml b/Gavilya/Components/ExecutableSelectorComponent.xaml
new file mode 100644
index 0000000..8a7ac92
--- /dev/null
+++ b/Gavilya/Components/ExecutableSelectorComponent.xaml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
diff --git a/Gavilya/Components/ExecutableSelectorComponent.xaml.cs b/Gavilya/Components/ExecutableSelectorComponent.xaml.cs
new file mode 100644
index 0000000..86a8a41
--- /dev/null
+++ b/Gavilya/Components/ExecutableSelectorComponent.xaml.cs
@@ -0,0 +1,39 @@
+/*
+MIT License
+
+Copyright (c) Léo Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+using System.Windows.Controls;
+
+namespace Gavilya.Components
+{
+ ///
+ /// Interaction logic for ExecutableSelectorComponent.xaml
+ ///
+ public partial class ExecutableSelectorComponent : UserControl
+ {
+ public ExecutableSelectorComponent()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Gavilya/Gavilya.csproj b/Gavilya/Gavilya.csproj
index 79ce1d2..e8de4d6 100644
--- a/Gavilya/Gavilya.csproj
+++ b/Gavilya/Gavilya.csproj
@@ -8,7 +8,7 @@
True
app.manifest
Gavilya
- 4.1.0.2310
+ 4.2.0.2311
Léo Corporation
Gavilya is a simple game launcher for Windows.
© 2023
@@ -51,7 +51,7 @@
-
+
diff --git a/Gavilya/Helpers/Context.cs b/Gavilya/Helpers/Context.cs
index b282ea6..48394cd 100644
--- a/Gavilya/Helpers/Context.cs
+++ b/Gavilya/Helpers/Context.cs
@@ -25,6 +25,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
namespace Gavilya.Helpers;
public static class Context
{
- public static string Version => "4.1.0.2310";
+ public static string Version => "4.2.0.2311";
public static string LastVersionLink => "https://raw.githubusercontent.com/Leo-Corporation/LeoCorp-Docs/master/Liens/Update%20System/Gavilya/Version.txt";
}
diff --git a/Gavilya/MainWindow.xaml b/Gavilya/MainWindow.xaml
index 68bde9b..c9e496a 100644
--- a/Gavilya/MainWindow.xaml
+++ b/Gavilya/MainWindow.xaml
@@ -62,6 +62,7 @@
+
-
+
+
+
+
+
public bool ShowHiddenGames { get; set; }
+ public bool? EnableSearchShortcut { get; set; }
+
public Settings()
{
IsFirstRun = true;
@@ -117,6 +119,7 @@ public Settings()
DefaultView = View.Card;
CurrentTheme = "";
ShowHiddenGames = false;
+ EnableSearchShortcut = true;
}
}
diff --git a/Gavilya/Properties/Resources.Designer.cs b/Gavilya/Properties/Resources.Designer.cs
index 645d71f..f0fbabe 100644
--- a/Gavilya/Properties/Resources.Designer.cs
+++ b/Gavilya/Properties/Resources.Designer.cs
@@ -124,7 +124,7 @@ public static string AddGame {
}
///
- /// Looks up a localized string similar to Add a game by clicking on the "Add" button or drag and drop an executable file here..
+ /// Looks up a localized string similar to Add a game by clicking on the "Add" button..
///
public static string AddGameWelcome {
get {
@@ -672,6 +672,15 @@ public static string EditProfile {
}
}
+ ///
+ /// Looks up a localized string similar to Enable search keyboard shortcut.
+ ///
+ public static string EnableSearchShortcut {
+ get {
+ return ResourceManager.GetString("EnableSearchShortcut", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Epic Games Store.
///
@@ -1203,6 +1212,15 @@ public static string InvalidGameNumber {
}
}
+ ///
+ /// Looks up a localized string similar to Keyboard shortcut.
+ ///
+ public static string KeybordShortcut {
+ get {
+ return ResourceManager.GetString("KeybordShortcut", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Language.
///
@@ -1797,6 +1815,15 @@ public static string PagesNames {
}
}
+ ///
+ /// Looks up a localized string similar to Pin/Unpin window.
+ ///
+ public static string PinUnpinWindow {
+ get {
+ return ResourceManager.GetString("PinUnpinWindow", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Platforms.
///
@@ -2094,6 +2121,15 @@ public static string SaveSettings {
}
}
+ ///
+ /// Looks up a localized string similar to Scan a directory.
+ ///
+ public static string ScanDirectory {
+ get {
+ return ResourceManager.GetString("ScanDirectory", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Screenshots.
///
@@ -2130,6 +2166,15 @@ public static string SearchF {
}
}
+ ///
+ /// Looks up a localized string similar to Keyboard shortcut related settings..
+ ///
+ public static string SearchKeyboardShortcutDesc {
+ get {
+ return ResourceManager.GetString("SearchKeyboardShortcutDesc", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Second.
///
diff --git a/Gavilya/Properties/Resources.en-US.resx b/Gavilya/Properties/Resources.en-US.resx
index dccad61..8d0f33a 100644
--- a/Gavilya/Properties/Resources.en-US.resx
+++ b/Gavilya/Properties/Resources.en-US.resx
@@ -1008,4 +1008,19 @@
Migrate from v3
+
+ Keyboard shortcut
+
+
+ Enable search keyboard shortcut
+
+
+ Keyboard shortcut related settings.
+
+
+ Pin/Unpin window
+
+
+ Scan a directory
+
\ No newline at end of file
diff --git a/Gavilya/Properties/Resources.fr-FR.resx b/Gavilya/Properties/Resources.fr-FR.resx
index 8c86fe3..718055e 100644
--- a/Gavilya/Properties/Resources.fr-FR.resx
+++ b/Gavilya/Properties/Resources.fr-FR.resx
@@ -1008,4 +1008,19 @@
Migrer depuis la v3
+
+ Raccourci clavier
+
+
+ Activer le raccourci clavier de recherche
+
+
+ Paramètres liés aux raccourcis clavier.
+
+
+ Epingler/Désépingler la fenêtre
+
+
+ Scanner un dossier
+
\ No newline at end of file
diff --git a/Gavilya/Properties/Resources.resx b/Gavilya/Properties/Resources.resx
index bc0825f..2531ffe 100644
--- a/Gavilya/Properties/Resources.resx
+++ b/Gavilya/Properties/Resources.resx
@@ -1009,4 +1009,19 @@
Migrate from v3
+
+ Keyboard shortcut
+
+
+ Enable search keyboard shortcut
+
+
+ Keyboard shortcut related settings.
+
+
+ Pin/Unpin window
+
+
+ Scan a directory
+
\ No newline at end of file
diff --git a/Gavilya/Properties/Resources.zh-CN.resx b/Gavilya/Properties/Resources.zh-CN.resx
index 7b610fc..6e02995 100644
--- a/Gavilya/Properties/Resources.zh-CN.resx
+++ b/Gavilya/Properties/Resources.zh-CN.resx
@@ -1008,4 +1008,19 @@
从 v3 迁移
+
+ 键盘快捷键
+
+
+ 启用搜索快捷键
+
+
+ 键盘快捷键相关设置
+
+
+ 插针/解针窗口
+
+
+ 扫描目录
+
\ No newline at end of file
diff --git a/Gavilya/Services/GameScannerService.cs b/Gavilya/Services/GameScannerService.cs
new file mode 100644
index 0000000..e9ec770
--- /dev/null
+++ b/Gavilya/Services/GameScannerService.cs
@@ -0,0 +1,61 @@
+/*
+MIT License
+
+Copyright (c) Léo Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+using Gavilya.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Gavilya.Services;
+
+public class GameScannerService
+{
+ public List ScanForExecutables(string directory, GameEditionViewModel gameEditionViewModel)
+ {
+ List executableFiles = new();
+
+ try
+ {
+ // Recursively search for files with .exe extension in the directory and its subdirectories
+ foreach (string filePath in Directory.GetFiles(directory, "*.*", SearchOption.AllDirectories)
+ .Where(file => file.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
+ )
+ {
+ string fileName = Path.GetFileName(filePath);
+ FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(filePath); // Get the version
+ executableFiles.Add(new(string.IsNullOrEmpty(fileVersionInfo.ProductName) ? fileName : fileVersionInfo.ProductName, filePath, gameEditionViewModel));
+ }
+
+ return executableFiles;
+ }
+ catch
+ {
+ return executableFiles;
+ }
+ }
+}
diff --git a/Gavilya/ViewModels/ExecutableViewModel.cs b/Gavilya/ViewModels/ExecutableViewModel.cs
new file mode 100644
index 0000000..d5ba736
--- /dev/null
+++ b/Gavilya/ViewModels/ExecutableViewModel.cs
@@ -0,0 +1,54 @@
+/*
+MIT License
+
+Copyright (c) Léo Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+using Gavilya.Commands;
+using System.Windows.Input;
+
+namespace Gavilya.ViewModels;
+
+public class ExecutableViewModel : ViewModelBase
+{
+ private readonly GameEditionViewModel _gameEditionViewModel;
+
+ public string Name { get; }
+ public string FilePath { get; }
+
+ public ICommand ClickCommand { get; }
+
+ public ExecutableViewModel(string name, string filePath, GameEditionViewModel gameEditionViewModel)
+ {
+ Name = name;
+ FilePath = filePath;
+ _gameEditionViewModel = gameEditionViewModel;
+
+ ClickCommand = new RelayCommand(Click);
+ }
+
+ private void Click(object? obj)
+ {
+ _gameEditionViewModel.Name = Name;
+ _gameEditionViewModel.Command = FilePath;
+ _gameEditionViewModel.IsExeSelectorOpen = false;
+ }
+}
diff --git a/Gavilya/ViewModels/GameEditionViewModel.cs b/Gavilya/ViewModels/GameEditionViewModel.cs
index 2b1a26d..8b5ea28 100644
--- a/Gavilya/ViewModels/GameEditionViewModel.cs
+++ b/Gavilya/ViewModels/GameEditionViewModel.cs
@@ -27,6 +27,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using Gavilya.Helpers;
using Gavilya.Models;
using Gavilya.Models.Rawg;
+using Gavilya.Services;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
@@ -163,6 +164,9 @@ public bool CanExecute
private bool _isUwpOpen = false;
public bool IsUwpOpen { get => _isUwpOpen; set { _isUwpOpen = value; OnPropertyChanged(nameof(IsUwpOpen)); } }
+ private bool _isExeSelectorOpen = false;
+ public bool IsExeSelectorOpen { get => _isExeSelectorOpen; set { _isExeSelectorOpen = value; OnPropertyChanged(nameof(IsExeSelectorOpen)); } }
+
private bool _isRawgOpen = false;
public bool IsRawgOpen { get => _isRawgOpen; set { _isRawgOpen = value; OnPropertyChanged(nameof(IsRawgOpen)); } }
@@ -194,6 +198,9 @@ public bool CanExecute
private List _uwpApps;
public List UwpApps { get => _uwpApps; set { _uwpApps = value; OnPropertyChanged(nameof(UwpApps)); } }
+ private List _exeApps;
+ public List ExeApps { get => _exeApps; set { _exeApps = value; OnPropertyChanged(nameof(ExeApps)); } }
+
private Visibility _dragAreaVis = Visibility.Collapsed;
public Visibility DragAreaVis { get => _dragAreaVis; set { _dragAreaVis = value; OnPropertyChanged(nameof(DragAreaVis)); } }
@@ -219,6 +226,10 @@ public bool CanExecute
private Visibility _steamSectionVis = Visibility.Collapsed;
public Visibility SteamSectionVis { get => _steamSectionVis; set { _steamSectionVis = value; OnPropertyChanged(nameof(SteamSectionVis)); } }
+ private Visibility _noExeVis = Visibility.Collapsed;
+ public Visibility NoExeVis { get => _noExeVis; set { _noExeVis = value; OnPropertyChanged(nameof(NoExeVis)); } }
+
+
public ICommand AddCommand { get; }
public ICommand BrowseFileCommand { get; }
public ICommand BrowseImageCommand { get; }
@@ -229,6 +240,8 @@ public bool CanExecute
public ICommand ShowConvertSectionCommand { get; }
public ICommand ProcessHelpCommand { get; }
public ICommand DropCommand { get; }
+ public ICommand ScanCommand { get; }
+ public ICommand CloseExeSelectorCommand { get; }
///
/// This constructor is used when editing an exisiting game.
@@ -255,6 +268,8 @@ public GameEditionViewModel(Game game, GameList games, List tags, MainViewM
ShowConvertSectionCommand = new RelayCommand(ShowConvert);
ProcessHelpCommand = new RelayCommand(ShowProcessHelp);
DropCommand = new RelayCommand(ExecuteDrop);
+ ScanCommand = new RelayCommand(Scan);
+ CloseExeSelectorCommand = new RelayCommand((o) => IsExeSelectorOpen = false);
// Load properties
Name = game.Name;
@@ -322,6 +337,8 @@ public GameEditionViewModel(GameType gameType, GameList games, List tags, M
RawgSearchCommand = new RelayCommand(SearchRawg);
ProcessHelpCommand = new RelayCommand(ShowProcessHelp);
DropCommand = new RelayCommand(ExecuteDrop);
+ ScanCommand = new RelayCommand(Scan);
+ CloseExeSelectorCommand = new RelayCommand((o) => IsExeSelectorOpen = false);
SelectedTags = new();
@@ -483,4 +500,20 @@ private void ShowProcessHelp(object? obj)
{
MessageBox.Show(Properties.Resources.ProcessNameHelp, Properties.Resources.Help, MessageBoxButton.OK, MessageBoxImage.Information);
}
+
+ private void Scan(object? obj)
+ {
+ using System.Windows.Forms.FolderBrowserDialog dialog = new();
+ System.Windows.Forms.DialogResult result = dialog.ShowDialog();
+
+ if (result == System.Windows.Forms.DialogResult.OK)
+ {
+ string selectedPath = dialog.SelectedPath;
+ GameScannerService gameScannerService = new();
+ ExeApps = gameScannerService.ScanForExecutables(selectedPath, this);
+ if (ExeApps is not null && ExeApps.Count > 0) NoExeVis = Visibility.Collapsed;
+ else NoExeVis = Visibility.Visible;
+ IsExeSelectorOpen = true;
+ }
+ }
}
diff --git a/Gavilya/ViewModels/HomePageViewModel.cs b/Gavilya/ViewModels/HomePageViewModel.cs
index 11d8858..9e74b41 100644
--- a/Gavilya/ViewModels/HomePageViewModel.cs
+++ b/Gavilya/ViewModels/HomePageViewModel.cs
@@ -35,6 +35,7 @@ namespace Gavilya.ViewModels;
public class HomePageViewModel : ViewModelBase
{
private readonly GameList _games;
+ private readonly List _tags;
private readonly MainViewModel _mainViewModel;
public string GreetingMessage => $"{Properties.Resources.Hello} {Environment.UserName}{Properties.Resources.ExclamationMark}";
public List Favorites => _games.Where(g => g.IsFavorite && (_mainViewModel.CurrentSettings.ShowHiddenGames ? true : !g.IsHidden)).Select(g => new MinimalGameViewModel(g, _games, _mainViewModel)).ToList();
@@ -49,9 +50,13 @@ public class HomePageViewModel : ViewModelBase
private Visibility _placeholderVis = Visibility.Collapsed;
public Visibility PlaceholderVis { get => _placeholderVis; set { _placeholderVis = value; OnPropertyChanged(nameof(PlaceholderVis)); } }
- public HomePageViewModel(GameList games, MainViewModel mainViewModel)
+
+ public ICommand RandomGameCommand { get; }
+
+ public HomePageViewModel(GameList games, List tags, MainViewModel mainViewModel)
{
_games = games;
+ _tags = tags;
_mainViewModel = mainViewModel;
if (_games.Count == 0)
@@ -60,5 +65,13 @@ public HomePageViewModel(GameList games, MainViewModel mainViewModel)
ContentVis = Visibility.Collapsed;
}
StatsView = new(_games, _mainViewModel.CurrentSettings.ShowHiddenGames);
+
+ RandomGameCommand = new RelayCommand(GetRandomGame);
+ }
+
+ private void GetRandomGame(object? obj)
+ {
+ var game = _games.GetRandomGame();
+ _mainViewModel.CurrentViewModel = new GamePageViewModel(game, _games, _tags, _mainViewModel);
}
}
diff --git a/Gavilya/ViewModels/MainViewModel.cs b/Gavilya/ViewModels/MainViewModel.cs
index 73ce17e..bde48d8 100644
--- a/Gavilya/ViewModels/MainViewModel.cs
+++ b/Gavilya/ViewModels/MainViewModel.cs
@@ -31,6 +31,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
+using System.Net.NetworkInformation;
using System.Windows;
using System.Windows.Input;
@@ -108,11 +109,15 @@ public double MaxiIconFontSize
private Visibility _noResults;
public Visibility NoResults { get => _noResults; set { _noResults = value; OnPropertyChanged(nameof(NoResults)); } }
+ private string _pinIcon;
+ public string PinIcon { get => _pinIcon; set { _pinIcon = value; OnPropertyChanged(nameof(PinIcon)); } }
+
public ICommand MinimizeCommand { get; }
public ICommand MaximizeRestoreCommand { get; }
public ICommand CloseCommand { get; }
public ICommand SearchClickCommand { get; }
public ICommand DeleteCommand { get; }
+ public ICommand PinCommand { get; set; }
public MainViewModel(Window window, Profile profile, ProfileData profiles, Page? startupPage = null)
{
@@ -124,7 +129,7 @@ public MainViewModel(Window window, Profile profile, ProfileData profiles, Page?
Page.Library => new LibPageViewModel(Games, profile.Tags, this),
Page.Recent => new RecentPageViewModel(Games, profile.Tags, this),
Page.Profile => new ProfileViewModel(profile, profiles, Games, this),
- _ => new HomePageViewModel(Games, this)
+ _ => new HomePageViewModel(Games, profile.Tags, this)
};
Query = "";
@@ -146,6 +151,7 @@ public MainViewModel(Window window, Profile profile, ProfileData profiles, Page?
SearchOpen = !SearchOpen;
SearchHeight = CurrentSettings.NumberOfSearchResultsToDisplay * 45;
});
+ PinCommand = new RelayCommand(Pin);
// Window System
_window.WindowState = CurrentSettings.IsMaximized switch { true => WindowState.Maximized, _ => WindowState.Normal };
@@ -153,6 +159,7 @@ public MainViewModel(Window window, Profile profile, ProfileData profiles, Page?
MaxiIcon = _window.WindowState == WindowState.Maximized ? "\uF670" : "\uFA40";
MaxiIconFontSize = _window.WindowState == WindowState.Maximized ? 16 : 12;
BorderMargin = _window.WindowState == WindowState.Maximized ? new(0) : new(10); // Set
+ PinIcon = "\uF602";
// Events
_window.StateChanged += (o, e) =>
@@ -196,7 +203,12 @@ private void RegisterKeyBoardShortcuts()
};
var openSearch = Combination.FromString("Control+K");
- Action openSearchAction = () => { SearchOpen = !SearchOpen; SearchHeight = CurrentSettings.NumberOfSearchResultsToDisplay * 45; };
+ Action openSearchAction = () =>
+ {
+ if (!(_currentSettings.EnableSearchShortcut ?? true)) return;
+ SearchOpen = !SearchOpen;
+ SearchHeight = CurrentSettings.NumberOfSearchResultsToDisplay * 45;
+ };
var assignment = new Dictionary
{
@@ -250,6 +262,12 @@ private void Close(object parameter)
_window.Close();
}
+ private void Pin(object? obj)
+ {
+ _window.Topmost = !_window.Topmost;
+ PinIcon = _window.Topmost ? "\uF604" : "\uF602";
+ }
+
private void DeleteGames(object obj)
{
if (ItemsToRemove.Count > 0 && MessageBox.Show(Properties.Resources.DeleteConfirmMessage, Properties.Resources.MainWindowTitle, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
@@ -261,7 +279,7 @@ private void DeleteGames(object obj)
CurrentViewModel = CurrentViewModel switch
{
- HomePageViewModel => new HomePageViewModel(Games, this),
+ HomePageViewModel => new HomePageViewModel(Games, _tags, this),
RecentPageViewModel => new RecentPageViewModel(Games, _tags, this),
LibPageViewModel => new LibPageViewModel(Games, _tags, this),
_ => CurrentViewModel
diff --git a/Gavilya/ViewModels/NavBarViewModel.cs b/Gavilya/ViewModels/NavBarViewModel.cs
index c718781..d774ff5 100644
--- a/Gavilya/ViewModels/NavBarViewModel.cs
+++ b/Gavilya/ViewModels/NavBarViewModel.cs
@@ -108,7 +108,7 @@ public NavBarViewModel(MainViewModel mainViewModel, Profile profile, ProfileData
private void HomePage(object? obj)
{
- _mainViewModel.CurrentViewModel = new HomePageViewModel(Games, _mainViewModel);
+ _mainViewModel.CurrentViewModel = new HomePageViewModel(Games, _tags, _mainViewModel);
}
private void LibraryPage(object? obj)
diff --git a/Gavilya/ViewModels/Settings/SearchViewModel.cs b/Gavilya/ViewModels/Settings/SearchViewModel.cs
index d716699..0ba61c8 100644
--- a/Gavilya/ViewModels/Settings/SearchViewModel.cs
+++ b/Gavilya/ViewModels/Settings/SearchViewModel.cs
@@ -36,7 +36,11 @@ public class SearchViewModel : ViewModelBase
private string _maxResults;
public string MaxResults { get => _maxResults; set { _maxResults = value; OnPropertyChanged(nameof(MaxResults)); } }
+ private bool _enableShortcut;
+ public bool EnableShortcut { get => _enableShortcut; set { _enableShortcut = value; OnPropertyChanged(nameof(EnableShortcut)); } }
+
public ICommand SaveCommand { get; }
+ public ICommand EnableShortcutCommand { get; }
public SearchViewModel(Profile profile, ProfileData profileData, MainViewModel mainViewModel)
{
_profile = profile;
@@ -44,8 +48,10 @@ public SearchViewModel(Profile profile, ProfileData profileData, MainViewModel m
_mainViewModel = mainViewModel;
MaxResults = profile.Settings.NumberOfSearchResultsToDisplay.ToString();
+ EnableShortcut = profile.Settings.EnableSearchShortcut ?? true;
SaveCommand = new RelayCommand(Save);
+ EnableShortcutCommand = new RelayCommand(SetEnableShortcut);
}
private void Save(object? obj)
@@ -57,4 +63,11 @@ private void Save(object? obj)
_mainViewModel.CurrentSettings = _profileData.Profiles[_profileData.Profiles.IndexOf(_profile)].Settings;
}
}
+
+ private void SetEnableShortcut(object? obj)
+ {
+ _profileData.Profiles[_profileData.Profiles.IndexOf(_profile)].Settings.EnableSearchShortcut = EnableShortcut;
+ _profileData.Save();
+ _mainViewModel.CurrentSettings = _profileData.Profiles[_profileData.Profiles.IndexOf(_profile)].Settings;
+ }
}
diff --git a/Gavilya/Views/GameEditionView.xaml b/Gavilya/Views/GameEditionView.xaml
index fdb05e4..9e518ab 100644
--- a/Gavilya/Views/GameEditionView.xaml
+++ b/Gavilya/Views/GameEditionView.xaml
@@ -86,13 +86,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Gavilya/Views/SettingsViews/SearchView.xaml b/Gavilya/Views/SettingsViews/SearchView.xaml
index 98b588b..033808a 100644
--- a/Gavilya/Views/SettingsViews/SearchView.xaml
+++ b/Gavilya/Views/SettingsViews/SearchView.xaml
@@ -100,6 +100,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+