mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-13 11:09:28 +08:00
Pass Settings instance to Alphabet again
This commit is contained in:
parent
f4a2f67db3
commit
78f243651e
@ -15,15 +15,12 @@ namespace Wox.Infrastructure
|
||||
private static readonly HanyuPinyinOutputFormat Format = new HanyuPinyinOutputFormat();
|
||||
private static ConcurrentDictionary<string, string[][]> PinyinCache;
|
||||
private static BinaryStorage<ConcurrentDictionary<string, string[][]>> _pinyinStorage;
|
||||
private static bool _shouldUsePinyin = true;
|
||||
private static Settings _settings;
|
||||
|
||||
public static void Initialize(bool shouldUsePinyin = true)
|
||||
public static void Initialize(Settings settings)
|
||||
{
|
||||
_shouldUsePinyin = shouldUsePinyin;
|
||||
if (_shouldUsePinyin)
|
||||
{
|
||||
InitializePinyinHelpers();
|
||||
}
|
||||
_settings = settings;
|
||||
InitializePinyinHelpers();
|
||||
}
|
||||
|
||||
private static void InitializePinyinHelpers()
|
||||
@ -43,7 +40,7 @@ namespace Wox.Infrastructure
|
||||
|
||||
public static void Save()
|
||||
{
|
||||
if (!_shouldUsePinyin)
|
||||
if (!_settings.ShouldUsePinyin)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -59,7 +56,7 @@ namespace Wox.Infrastructure
|
||||
/// </summary>
|
||||
public static string[] Pinyin(string word)
|
||||
{
|
||||
if (!_shouldUsePinyin)
|
||||
if (!_settings.ShouldUsePinyin)
|
||||
{
|
||||
return EmptyStringArray;
|
||||
}
|
||||
@ -81,7 +78,7 @@ namespace Wox.Infrastructure
|
||||
/// </summmary>
|
||||
public static string[][] PinyinComination(string characters)
|
||||
{
|
||||
if (!_shouldUsePinyin || string.IsNullOrEmpty(characters))
|
||||
if (!_settings.ShouldUsePinyin || string.IsNullOrEmpty(characters))
|
||||
{
|
||||
return Empty2DStringArray;
|
||||
}
|
||||
@ -122,7 +119,7 @@ namespace Wox.Infrastructure
|
||||
|
||||
public static bool ContainsChinese(string word)
|
||||
{
|
||||
if (!_shouldUsePinyin)
|
||||
if (!_settings.ShouldUsePinyin)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -140,7 +137,7 @@ namespace Wox.Infrastructure
|
||||
|
||||
private static string[] Combination(string[] array1, string[] array2)
|
||||
{
|
||||
if (!_shouldUsePinyin)
|
||||
if (!_settings.ShouldUsePinyin)
|
||||
{
|
||||
return EmptyStringArray;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace Wox
|
||||
_settingsVM = new SettingWindowViewModel();
|
||||
_settings = _settingsVM.Settings;
|
||||
|
||||
Alphabet.Initialize(_settings.ShouldUsePinyin);
|
||||
Alphabet.Initialize(_settings);
|
||||
|
||||
StringMatcher.UserSettingSearchPrecision = _settings.QuerySearchPrecision;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user