diff --git a/src/modules/launcher/PowerLauncher/App.xaml.cs b/src/modules/launcher/PowerLauncher/App.xaml.cs index b6d6845c30..9d98eaaeb4 100644 --- a/src/modules/launcher/PowerLauncher/App.xaml.cs +++ b/src/modules/launcher/PowerLauncher/App.xaml.cs @@ -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 }); } diff --git a/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs b/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs index 1b14ae0a95..353a1981c9 100644 --- a/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs +++ b/src/modules/launcher/PowerLauncher/Plugin/PluginManager.cs @@ -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)); } } diff --git a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs index 098e16a9ba..c8c004d38d 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs @@ -1028,34 +1028,6 @@ namespace PowerLauncher.ViewModel } } - public void ColdStartFix() - { - // Fix Cold start for List view xaml island - List list = new List(); - 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 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; diff --git a/src/modules/launcher/Wox.Plugin/PluginPair.cs b/src/modules/launcher/Wox.Plugin/PluginPair.cs index 3d46dfde74..1e7c452ad6 100644 --- a/src/modules/launcher/Wox.Plugin/PluginPair.cs +++ b/src/modules/launcher/Wox.Plugin/PluginPair.cs @@ -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