[Shortcut Guide] Move into separate process (#11359)

This commit is contained in:
Mykhailo Pylyp
2021-05-20 15:07:34 +03:00
committed by GitHub
parent c948c1fca8
commit 601da71f15
114 changed files with 2346 additions and 1771 deletions

View File

@@ -11,6 +11,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
{
public class ShortcutGuideViewModel : Observable
{
private ISettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
private ShortcutGuideSettings Settings { get; set; }
@@ -22,8 +24,10 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private string _settingsConfigFileFolder = string.Empty;
private string _disabledApps;
public ShortcutGuideViewModel(ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<ShortcutGuideSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
public ShortcutGuideViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<ShortcutGuideSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
{
SettingsUtils = settingsUtils;
// Update Settings file folder:
_settingsConfigFileFolder = configFileSubfolder;
@@ -98,6 +102,23 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public HotkeySettings OpenShortcutGuide
{
get
{
return Settings.Properties.OpenShortcutGuide;
}
set
{
if (Settings.Properties.OpenShortcutGuide != value)
{
Settings.Properties.OpenShortcutGuide = value;
NotifyPropertyChanged();
}
}
}
public int ThemeIndex
{
get
@@ -136,24 +157,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public int PressTime
{
get
{
return _pressTime;
}
set
{
if (_pressTime != value)
{
_pressTime = value;
Settings.Properties.PressTime.Value = value;
NotifyPropertyChanged();
}
}
}
public int OverlayOpacity
{
get
@@ -198,9 +201,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
{
OnPropertyChanged(propertyName);
SndShortcutGuideSettings outsettings = new SndShortcutGuideSettings(Settings);
SndModuleSettings<SndShortcutGuideSettings> ipcMessage = new SndModuleSettings<SndShortcutGuideSettings>(outsettings);
SendConfigMSG(ipcMessage.ToJsonString());
SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName);
}
}
}