-
-
Notifications
You must be signed in to change notification settings - Fork 448
Fix possible null reference when query is cancelled & Add new image icon for images whose formats are not support & Other improvements #3099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
129169e
a8d69c7
756e718
0720779
b95bbb3
c474b30
d8c07a5
c3c6126
c665482
4830988
3f413d1
00e76f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading; | ||
|
@@ -23,6 +23,8 @@ | |
using System.Globalization; | ||
using System.Windows.Input; | ||
using System.ComponentModel; | ||
using Flow.Launcher.Infrastructure.Image; | ||
using System.Windows.Media; | ||
|
||
namespace Flow.Launcher.ViewModel | ||
{ | ||
|
@@ -722,6 +724,8 @@ public double ResultSubItemFontSize | |
set => Settings.ResultSubItemFontSize = value; | ||
} | ||
|
||
public ImageSource PluginIconSource { get; private set; } = null; | ||
|
||
public string PluginIconPath { get; set; } = null; | ||
|
||
public string OpenResultCommandModifiers => Settings.OpenResultModifiers; | ||
|
@@ -1066,6 +1070,7 @@ private async void QueryResults(bool isReQuery = false, bool reSelect = true) | |
Results.Clear(); | ||
Results.Visibility = Visibility.Collapsed; | ||
PluginIconPath = null; | ||
PluginIconSource = null; | ||
SearchIconVisibility = Visibility.Visible; | ||
return; | ||
} | ||
|
@@ -1099,11 +1104,13 @@ private async void QueryResults(bool isReQuery = false, bool reSelect = true) | |
if (plugins.Count == 1) | ||
{ | ||
PluginIconPath = plugins.Single().Metadata.IcoPath; | ||
PluginIconSource = await ImageLoader.LoadAsync(PluginIconPath); | ||
Jack251970 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
SearchIconVisibility = Visibility.Hidden; | ||
} | ||
else | ||
{ | ||
PluginIconPath = null; | ||
PluginIconSource = null; | ||
SearchIconVisibility = Visibility.Visible; | ||
} | ||
|
||
|
@@ -1440,26 +1447,35 @@ public void UpdateResultView(ICollection<ResultsForUpdate> resultsForUpdates) | |
} | ||
#endif | ||
|
||
foreach (var metaResults in resultsForUpdates) | ||
try | ||
|
||
{ | ||
foreach (var result in metaResults.Results) | ||
foreach (var metaResults in resultsForUpdates) | ||
{ | ||
if (_topMostRecord.IsTopMost(result)) | ||
foreach (var result in metaResults.Results) | ||
{ | ||
result.Score = int.MaxValue; | ||
} | ||
else | ||
{ | ||
var priorityScore = metaResults.Metadata.Priority * 150; | ||
result.Score += _userSelectedRecord.GetSelectedCount(result) + priorityScore; | ||
if (_topMostRecord.IsTopMost(result)) | ||
{ | ||
result.Score = int.MaxValue; | ||
} | ||
else | ||
{ | ||
var priorityScore = metaResults.Metadata.Priority * 150; | ||
result.Score += _userSelectedRecord.GetSelectedCount(result) + priorityScore; | ||
} | ||
} | ||
} | ||
} | ||
|
||
// it should be the same for all results | ||
bool reSelect = resultsForUpdates.First().ReSelectFirstResult; | ||
// it should be the same for all results | ||
bool reSelect = resultsForUpdates.First().ReSelectFirstResult; | ||
|
||
Results.AddResults(resultsForUpdates, token, reSelect); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Log.Debug("MainViewModel", $"Error in UpdateResultView: {ex.Message}"); | ||
} | ||
|
||
Results.AddResults(resultsForUpdates, token, reSelect); | ||
|
||
} | ||
|
||
#endregion | ||
|
Uh oh!
There was an error while loading. Please reload this page.