diff --git a/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml b/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml index 26b470ca38..82b6c09e44 100644 --- a/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml +++ b/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml @@ -443,7 +443,7 @@ - + diff --git a/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml.cs b/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml.cs index dc60c96de5..31ca2be00a 100644 --- a/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml.cs +++ b/src/modules/launcher/PowerLauncher.UI/LauncherControl.xaml.cs @@ -24,33 +24,6 @@ namespace PowerLauncher.UI { this.InitializeComponent(); ShellBarShadow.Receivers.Add(ShadowReceiverGrid); - SearchResults = new List - { - new SearchApp() { Title = "Calendar", Icon = "ms-appx:///Assets/Images/Calendar.png" }, - new SearchApp() { Title = "Camera", Icon = "ms-appx:///Assets/Images/Camera.png" }, - new SearchApp() { Title = "Excel", Icon = "ms-appx:///Assets/Images/Excel.png" }, - new SearchApp() { Title = "Feedback", Icon = "ms-appx:///Assets/Images/Feedback.png" }, - new SearchApp() { Title = "File Explorer", Icon = "ms-appx:///Assets/Images/FileExplorer.png" }, - new SearchApp() { Title = "Groove", Icon = "ms-appx:///Assets/Images/Groove.png" }, - new SearchApp() { Title = "Mail", Icon = "ms-appx:///Assets/Images/Mail.png" }, - new SearchApp() { Title = "Mobile", Icon = "ms-appx:///Assets/Images/Mobile.png" }, - new SearchApp() { Title = "Movies", Icon = "ms-appx:///Assets/Images/Movies.png" }, - new SearchApp() { Title = "OneDrive", Icon = "ms-appx:///Assets/Images/OneDrive.png" }, - new SearchApp() { Title = "OneNote", Icon = "ms-appx:///Assets/Images/OneNote.png" }, - new SearchApp() { Title = "Outlook", Icon = "ms-appx:///Assets/Images/Outlook.png" }, - new SearchApp() { Title = "Photos", Icon = "ms-appx:///Assets/Images/Photos.png" }, - new SearchApp() { Title = "PowerPoint", Icon = "ms-appx:///Assets/Images/PowerPoint.png" }, - new SearchApp() { Title = "PowerToys", Icon = "ms-appx:///Assets/Images/PowerToysIcon.png" }, - new SearchApp() { Title = "Screen Sketch", Icon = "ms-appx:///Assets/Images/ScreenSketch.png" }, - new SearchApp() { Title = "SharePoint", Icon = "ms-appx:///Assets/Images/SharePoint.png" }, - new SearchApp() { Title = "Skype", Icon = "ms-appx:///Assets/Images/Skype.png" }, - new SearchApp() { Title = "Solitaire", Icon = "ms-appx:///Assets/Images/Solitaire.png" }, - new SearchApp() { Title = "Teams", Icon = "ms-appx:///Assets/Images/Teams.png" }, - new SearchApp() { Title = "Weather", Icon = "ms-appx:///Assets/Images/Weather.png" }, - new SearchApp() { Title = "Whiteboard", Icon = "ms-appx:///Assets/Images/Whiteboard.png" }, - new SearchApp() { Title = "Word", Icon = "ms-appx:///Assets/Images/Word.png" }, - new SearchApp() { Title = "Yammer", Icon = "ms-appx:///Assets/Images/Yammer.png" } - }; } } diff --git a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs index 7123f4f6ac..7b96a516e4 100644 --- a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs +++ b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs @@ -17,6 +17,7 @@ using DragEventArgs = System.Windows.DragEventArgs; using KeyEventArgs = System.Windows.Input.KeyEventArgs; using MessageBox = System.Windows.MessageBox; using Microsoft.Toolkit.Wpf.UI.XamlHost; +using Windows.UI.Xaml.Controls; namespace PowerLauncher { @@ -110,27 +111,27 @@ namespace PowerLauncher if (e.ChangedButton == MouseButton.Left) DragMove(); } - private void OnPreviewMouseButtonDown(object sender, MouseButtonEventArgs e) - { - if (sender != null && e.OriginalSource != null) - { - var r = (ResultListBox)sender; - var d = (DependencyObject)e.OriginalSource; - var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem; - var result = (ResultViewModel)item?.DataContext; - if (result != null) - { - if (e.ChangedButton == MouseButton.Left) - { - _viewModel.OpenResultCommand.Execute(null); - } - else if (e.ChangedButton == MouseButton.Right) - { - _viewModel.LoadContextMenuCommand.Execute(null); - } - } - } - } + //private void OnPreviewMouseButtonDown(object sender, MouseButtonEventArgs e) + //{ + // if (sender != null && e.OriginalSource != null) + // { + // var r = (ResultListBox)sender; + // var d = (DependencyObject)e.OriginalSource; + // var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem; + // var result = (ResultViewModel)item?.DataContext; + // if (result != null) + // { + // if (e.ChangedButton == MouseButton.Left) + // { + // _viewModel.OpenResultCommand.Execute(null); + // } + // else if (e.ChangedButton == MouseButton.Right) + // { + // _viewModel.LoadContextMenuCommand.Execute(null); + // } + // } + // } + //} private void OnDrop(object sender, DragEventArgs e) @@ -278,9 +279,12 @@ namespace PowerLauncher } private void QueryTextBox_TextChanged(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxTextChangedEventArgs args) { - if (_viewModel.QueryTextCursorMovedToEnd) + if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput) { - _viewModel.QueryTextCursorMovedToEnd = false; + if (_viewModel.QueryTextCursorMovedToEnd) + { + _viewModel.QueryTextCursorMovedToEnd = false; + } } } } diff --git a/src/modules/launcher/Wox/ViewModel/MainViewModel.cs b/src/modules/launcher/Wox/ViewModel/MainViewModel.cs index acdd7c0409..bc067cc446 100644 --- a/src/modules/launcher/Wox/ViewModel/MainViewModel.cs +++ b/src/modules/launcher/Wox/ViewModel/MainViewModel.cs @@ -393,26 +393,30 @@ namespace Wox.ViewModel }, currentCancellationToken); var plugins = PluginManager.ValidPluginsForQuery(query); - Task.Run(() => - { + Application.Current.Dispatcher.Invoke((Action)(() => { // so looping will stop once it was cancelled var parallelOptions = new ParallelOptions { CancellationToken = currentCancellationToken }; try { - Parallel.ForEach(plugins, parallelOptions, plugin => + //Parallel.ForEach(plugins, parallelOptions, plugin => + //{ + // if (!plugin.Metadata.Disabled) + // { + // var results = PluginManager.QueryForPlugin(plugin, query); + // UpdateResultView(results, plugin.Metadata, query); + // } + //}); + foreach(PluginPair plugin in plugins) { - if (!plugin.Metadata.Disabled) - { - var results = PluginManager.QueryForPlugin(plugin, query); - UpdateResultView(results, plugin.Metadata, query); - } - }); + var results = PluginManager.QueryForPlugin(plugin, query); + UpdateResultView(results, plugin.Metadata, query); + } } catch (OperationCanceledException) { // nothing to do here } - + // this should happen once after all queries are done so progress bar should continue // until the end of all querying @@ -421,7 +425,40 @@ namespace Wox.ViewModel { // update to hidden if this is still the current query ProgressBarVisibility = Visibility.Hidden; } - }, currentCancellationToken); + })); + + + + + //Task.Run(() => + //{ + // // so looping will stop once it was cancelled + // var parallelOptions = new ParallelOptions { CancellationToken = currentCancellationToken }; + // try + // { + // Parallel.ForEach(plugins, parallelOptions, plugin => + // { + // if (!plugin.Metadata.Disabled) + // { + // var results = PluginManager.QueryForPlugin(plugin, query); + // UpdateResultView(results, plugin.Metadata, query); + // } + // }); + // } + // catch (OperationCanceledException) + // { + // // nothing to do here + // } + + + // // this should happen once after all queries are done so progress bar should continue + // // until the end of all querying + // _isQueryRunning = false; + // if (currentUpdateSource == _updateSource) + // { // update to hidden if this is still the current query + // ProgressBarVisibility = Visibility.Hidden; + // } + //}, currentCancellationToken); } } else