mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[PTRun]Add Pinyin Support (#21465)
* Add Pinyin Support for Powertoys Run using hyjiacan.pinyin4net Revert microsoft/PowerToys#7455 closed microsoft/PowerToys#3587 closed microsoft/PowerToys#20370 Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com> * Remove JetBrains annotations Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
This commit is contained in:
@@ -9,20 +9,27 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
using Common.UI;
|
||||
|
||||
using interop;
|
||||
|
||||
using ManagedCommon;
|
||||
|
||||
using Microsoft.PowerLauncher.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
using PowerLauncher.Helper;
|
||||
using PowerLauncher.Plugin;
|
||||
using PowerLauncher.ViewModel;
|
||||
|
||||
using Wox;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Image;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
using Stopwatch = Wox.Infrastructure.Stopwatch;
|
||||
|
||||
namespace PowerLauncher
|
||||
@@ -31,6 +38,8 @@ namespace PowerLauncher
|
||||
{
|
||||
public static PublicAPIInstance API { get; private set; }
|
||||
|
||||
private readonly Alphabet _alphabet = new Alphabet();
|
||||
|
||||
public static CancellationTokenSource NativeThreadCTS { get; private set; }
|
||||
|
||||
private static bool _disposed;
|
||||
@@ -126,13 +135,14 @@ namespace PowerLauncher
|
||||
_settings = _settingsVM.Settings;
|
||||
_settings.StartedFromPowerToysRunner = e.Args.Contains("--started-from-runner");
|
||||
|
||||
_stringMatcher = new StringMatcher();
|
||||
_alphabet.Initialize(_settings);
|
||||
_stringMatcher = new StringMatcher(_alphabet);
|
||||
StringMatcher.Instance = _stringMatcher;
|
||||
_stringMatcher.UserSettingSearchPrecision = _settings.QuerySearchPrecision;
|
||||
|
||||
_mainVM = new MainViewModel(_settings, NativeThreadCTS.Token);
|
||||
_mainWindow = new MainWindow(_settings, _mainVM, NativeThreadCTS.Token);
|
||||
API = new PublicAPIInstance(_settingsVM, _mainVM, _themeManager);
|
||||
API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet, _themeManager);
|
||||
_settingsReader = new SettingsReader(_settings, _themeManager);
|
||||
_settingsReader.ReadSettings();
|
||||
|
||||
|
||||
@@ -6,12 +6,19 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
using Common.UI;
|
||||
|
||||
using ManagedCommon;
|
||||
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
|
||||
using PowerLauncher.Plugin;
|
||||
using PowerLauncher.ViewModel;
|
||||
|
||||
using Windows.UI.Notifications;
|
||||
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Image;
|
||||
using Wox.Plugin;
|
||||
|
||||
@@ -21,15 +28,17 @@ namespace Wox
|
||||
{
|
||||
private readonly SettingWindowViewModel _settingsVM;
|
||||
private readonly MainViewModel _mainVM;
|
||||
private readonly Alphabet _alphabet;
|
||||
private readonly ThemeManager _themeManager;
|
||||
private bool _disposed;
|
||||
|
||||
public event ThemeChangedHandler ThemeChanged;
|
||||
|
||||
public PublicAPIInstance(SettingWindowViewModel settingsVM, MainViewModel mainVM, ThemeManager themeManager)
|
||||
public PublicAPIInstance(SettingWindowViewModel settingsVM, MainViewModel mainVM, Alphabet alphabet, ThemeManager themeManager)
|
||||
{
|
||||
_settingsVM = settingsVM ?? throw new ArgumentNullException(nameof(settingsVM));
|
||||
_mainVM = mainVM ?? throw new ArgumentNullException(nameof(mainVM));
|
||||
_alphabet = alphabet ?? throw new ArgumentNullException(nameof(alphabet));
|
||||
_themeManager = themeManager ?? throw new ArgumentNullException(nameof(themeManager));
|
||||
_themeManager.ThemeChanged += OnThemeChanged;
|
||||
|
||||
@@ -60,6 +69,7 @@ namespace Wox
|
||||
_settingsVM.Save();
|
||||
PluginManager.Save();
|
||||
ImageLoader.Save();
|
||||
_alphabet.Save();
|
||||
}
|
||||
|
||||
public void ReloadAllPluginData()
|
||||
|
||||
Reference in New Issue
Block a user