mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
set object before using it (#6497)
This commit is contained in:
@@ -22,14 +22,16 @@ namespace Microsoft.PowerToys.Settings.UI.Lib.ViewModels
|
||||
|
||||
public PowerLauncherViewModel(Func<string, int> ipcMSGCallBackFunc, int defaultKeyCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
// set the callback functions value to hangle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
|
||||
callback = (PowerLauncherSettings settings) =>
|
||||
{
|
||||
// Propagate changes to Power Launcher through IPC
|
||||
SendConfigMSG(
|
||||
string.Format("{{ \"powertoys\": {{ \"{0}\": {1} }} }}", PowerLauncherSettings.ModuleName, JsonSerializer.Serialize(settings)));
|
||||
};
|
||||
|
||||
if (SettingsUtils.SettingsExists(PowerLauncherSettings.ModuleName))
|
||||
{
|
||||
settings = SettingsUtils.GetSettings<PowerLauncherSettings>(PowerLauncherSettings.ModuleName);
|
||||
@@ -51,13 +53,6 @@ namespace Microsoft.PowerToys.Settings.UI.Lib.ViewModels
|
||||
{
|
||||
generalSettings = new GeneralSettings();
|
||||
}
|
||||
|
||||
// set the callback functions value to hangle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public PowerLauncherViewModel(PowerLauncherSettings settings, SendCallback callback)
|
||||
|
||||
Reference in New Issue
Block a user