[PTRun]Remove cold start and fix initialization error (#29770)

This commit is contained in:
Davide Giacometti 2023-11-13 13:31:04 +01:00 коммит произвёл GitHub
Родитель 479c95b32b
Коммит 967b888ba1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 4 добавлений и 45 удалений

Просмотреть файл

@ -9,27 +9,20 @@ 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
@ -155,8 +148,6 @@ namespace PowerLauncher
_settingsReader.ReadSettingsOnChange();
_mainVM.MainWindowVisibility = Visibility.Visible;
_mainVM.ColdStartFix();
_themeManager.ThemeChanged += OnThemeChanged;
textToLog.AppendLine("End PowerToys Run startup ---------------------------------------------------- ");
@ -164,11 +155,6 @@ namespace PowerLauncher
Log.Info(textToLog.ToString(), GetType());
PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
// [Conditional("RELEASE")]
// check update every 5 hours
// check updates on startup
});
}

Просмотреть файл

@ -11,6 +11,7 @@ using System.IO.Abstractions;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using global::PowerToys.GPOWrapper;
using ManagedCommon;
using PowerLauncher.Properties;
@ -180,7 +181,7 @@ namespace PowerLauncher.Plugin
{
var failed = string.Join(",", failedPlugins.Select(x => x.Metadata.Name));
var description = string.Format(CultureInfo.CurrentCulture, Resources.FailedToInitializePluginsDescription, failed);
API.ShowMsg(Resources.FailedToInitializePluginsTitle, description, string.Empty, false);
Application.Current.Dispatcher.InvokeAsync(() => API.ShowMsg(Resources.FailedToInitializePluginsTitle, description, string.Empty, false));
}
}

Просмотреть файл

@ -1028,34 +1028,6 @@ namespace PowerLauncher.ViewModel
}
}
public void ColdStartFix()
{
// Fix Cold start for List view xaml island
List<Result> list = new List<Result>();
Result r = new Result
{
Title = "hello",
};
list.Add(r);
Results.AddResults(list, _updateToken);
Results.Clear();
// Fix Cold start for plugins, "m" is just a random string needed to query results
var pluginQueryPairs = QueryBuilder.Build("m");
// To execute a query corresponding to each plugin
foreach (KeyValuePair<PluginPair, Query> pluginQueryItem in pluginQueryPairs)
{
var plugin = pluginQueryItem.Key;
var query = pluginQueryItem.Value;
if (!plugin.Metadata.Disabled && plugin.Metadata.Name != "Window Walker")
{
_ = PluginManager.QueryForPlugin(plugin, query);
}
}
}
public void HandleContextMenu(Key acceleratorKey, ModifierKeys acceleratorModifiers)
{
var results = SelectedResults;

Просмотреть файл

@ -4,10 +4,10 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
using System.Windows;
using Microsoft.PowerToys.Settings.UI.Library;
using Wox.Plugin.Logger;
using Wox.Plugin.Properties;
@ -74,7 +74,7 @@ namespace Wox.Plugin
if (!IsPluginInitialized)
{
string description = $"{Resources.FailedToLoadPluginDescription} {Metadata.Name}\n\n{Resources.FailedToLoadPluginDescriptionPartTwo}";
api.ShowMsg(Resources.FailedToLoadPluginTitle, description, string.Empty, false);
Application.Current.Dispatcher.InvokeAsync(() => api.ShowMsg(Resources.FailedToLoadPluginTitle, description, string.Empty, false));
}
}
else