mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +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)
|
public PowerLauncherViewModel(Func<string, int> ipcMSGCallBackFunc, int defaultKeyCode)
|
||||||
{
|
{
|
||||||
try
|
// set the callback functions value to hangle outgoing IPC message.
|
||||||
{
|
SendConfigMSG = ipcMSGCallBackFunc;
|
||||||
|
|
||||||
callback = (PowerLauncherSettings settings) =>
|
callback = (PowerLauncherSettings settings) =>
|
||||||
{
|
{
|
||||||
// Propagate changes to Power Launcher through IPC
|
// Propagate changes to Power Launcher through IPC
|
||||||
SendConfigMSG(
|
SendConfigMSG(
|
||||||
string.Format("{{ \"powertoys\": {{ \"{0}\": {1} }} }}", PowerLauncherSettings.ModuleName, JsonSerializer.Serialize(settings)));
|
string.Format("{{ \"powertoys\": {{ \"{0}\": {1} }} }}", PowerLauncherSettings.ModuleName, JsonSerializer.Serialize(settings)));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (SettingsUtils.SettingsExists(PowerLauncherSettings.ModuleName))
|
if (SettingsUtils.SettingsExists(PowerLauncherSettings.ModuleName))
|
||||||
{
|
{
|
||||||
settings = SettingsUtils.GetSettings<PowerLauncherSettings>(PowerLauncherSettings.ModuleName);
|
settings = SettingsUtils.GetSettings<PowerLauncherSettings>(PowerLauncherSettings.ModuleName);
|
||||||
@@ -51,13 +53,6 @@ namespace Microsoft.PowerToys.Settings.UI.Lib.ViewModels
|
|||||||
{
|
{
|
||||||
generalSettings = new GeneralSettings();
|
generalSettings = new GeneralSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the callback functions value to hangle outgoing IPC message.
|
|
||||||
SendConfigMSG = ipcMSGCallBackFunc;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PowerLauncherViewModel(PowerLauncherSettings settings, SendCallback callback)
|
public PowerLauncherViewModel(PowerLauncherSettings settings, SendCallback callback)
|
||||||
|
|||||||
Reference in New Issue
Block a user