[CmdPal]Fix resetting the hotkey in Settings (#38149)

Fix resetting the hotkey in Settings
This commit is contained in:
Jaime Bernardo
2025-03-25 18:58:46 +00:00
committed by GitHub
parent be1968aaa5
commit aeec3a967f
2 changed files with 9 additions and 3 deletions

View File

@@ -3,22 +3,26 @@
// See the LICENSE file in the project root for more information.
using System.Collections.ObjectModel;
using System.ComponentModel;
using Microsoft.CmdPal.UI.ViewModels.Settings;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.CmdPal.UI.ViewModels;
public partial class SettingsViewModel
public partial class SettingsViewModel : INotifyPropertyChanged
{
private readonly SettingsModel _settings;
private readonly IServiceProvider _serviceProvider;
public event PropertyChangedEventHandler? PropertyChanged;
public HotkeySettings? Hotkey
{
get => _settings.Hotkey;
set
{
_settings.Hotkey = value;
_settings.Hotkey = value ?? SettingsModel.DefaultActivationShortcut;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Hotkey)));
Save();
}
}