mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add afterload event for LoadDefaultConfig
This commit is contained in:
parent
13e629e17d
commit
49362ce5ab
2 changed files with 10 additions and 7 deletions
|
|
@ -44,7 +44,10 @@ namespace Wox.Infrastructure.Storage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void LoadDefaultConfig() { }
|
protected virtual T LoadDefaultConfig()
|
||||||
|
{
|
||||||
|
return storage;
|
||||||
|
}
|
||||||
|
|
||||||
private void Load()
|
private void Load()
|
||||||
{
|
{
|
||||||
|
|
@ -61,19 +64,17 @@ namespace Wox.Infrastructure.Storage
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
storage = JsonConvert.DeserializeObject<T>(json);
|
storage = JsonConvert.DeserializeObject<T>(json);
|
||||||
OnAfterLoadConfig(storage);
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
//no-op
|
storage = LoadDefaultConfig();
|
||||||
LoadDefaultConfig();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LoadDefaultConfig();
|
storage = LoadDefaultConfig();
|
||||||
}
|
}
|
||||||
|
OnAfterLoadConfig(storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
||||||
get { return "config"; }
|
get { return "config"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadDefaultConfig()
|
protected override UserSettingStorage LoadDefaultConfig()
|
||||||
{
|
{
|
||||||
Theme = "Dark";
|
Theme = "Dark";
|
||||||
ReplaceWinR = true;
|
ReplaceWinR = true;
|
||||||
|
|
@ -157,6 +157,8 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
||||||
OpacityMode = OpacityMode.Normal;
|
OpacityMode = OpacityMode.Normal;
|
||||||
LeaveCmdOpen = false;
|
LeaveCmdOpen = false;
|
||||||
HideWhenDeactive = false;
|
HideWhenDeactive = false;
|
||||||
|
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnAfterLoadConfig(UserSettingStorage storage)
|
protected override void OnAfterLoadConfig(UserSettingStorage storage)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue