mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 04:37:30 +02:00
[PTRun]Fix null reference issue when clean previous query is on (#19167)
This commit is contained in:
@@ -212,7 +212,7 @@ namespace PowerLauncher
|
|||||||
private void OnThemeChanged(Theme oldTheme, Theme newTheme)
|
private void OnThemeChanged(Theme oldTheme, Theme newTheme)
|
||||||
{
|
{
|
||||||
ImageLoader.UpdateIconPath(newTheme);
|
ImageLoader.UpdateIconPath(newTheme);
|
||||||
_mainVM.Query(new MainViewModel.QueryTuningOptions());
|
_mainVM.Query();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -488,15 +488,8 @@ namespace PowerLauncher
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var options = new MainViewModel.QueryTuningOptions
|
|
||||||
{
|
|
||||||
SearchClickedItemWeight = _viewModel.GetSearchClickedItemWeight(),
|
|
||||||
SearchQueryTuningEnabled = _viewModel.GetSearchQueryTuningEnabled(),
|
|
||||||
SearchWaitForSlowResults = _viewModel.GetSearchWaitForSlowResults(),
|
|
||||||
};
|
|
||||||
|
|
||||||
_viewModel.QueryText = text;
|
_viewModel.QueryText = text;
|
||||||
_viewModel.Query(options);
|
_viewModel.Query();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -362,14 +362,14 @@ namespace PowerLauncher.ViewModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="queryText">Text that is being queried from user</param>
|
/// <param name="queryText">Text that is being queried from user</param>
|
||||||
/// <param name="requery">Optional Parameter that if true, will automatically execute a query against the updated text</param>
|
/// <param name="requery">Optional Parameter that if true, will automatically execute a query against the updated text</param>
|
||||||
public void ChangeQueryText(string queryText, bool requery = false, QueryTuningOptions tuningOptions = null)
|
public void ChangeQueryText(string queryText, bool requery = false)
|
||||||
{
|
{
|
||||||
SystemQueryText = queryText;
|
SystemQueryText = queryText;
|
||||||
|
|
||||||
if (requery)
|
if (requery)
|
||||||
{
|
{
|
||||||
QueryText = queryText;
|
QueryText = queryText;
|
||||||
Query(tuningOptions);
|
Query();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,11 +472,11 @@ namespace PowerLauncher.ViewModel
|
|||||||
public bool SearchWaitForSlowResults { get; set; }
|
public bool SearchWaitForSlowResults { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Query(QueryTuningOptions options)
|
public void Query()
|
||||||
{
|
{
|
||||||
if (SelectedIsFromQueryResults())
|
if (SelectedIsFromQueryResults())
|
||||||
{
|
{
|
||||||
QueryResults(options);
|
QueryResults();
|
||||||
}
|
}
|
||||||
else if (HistorySelected())
|
else if (HistorySelected())
|
||||||
{
|
{
|
||||||
@@ -527,8 +527,9 @@ namespace PowerLauncher.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void QueryResults(QueryTuningOptions queryTuning)
|
private void QueryResults()
|
||||||
{
|
{
|
||||||
|
var queryTuning = GetQueryTuningOptions();
|
||||||
var doFinalSort = queryTuning.SearchQueryTuningEnabled && queryTuning.SearchWaitForSlowResults;
|
var doFinalSort = queryTuning.SearchQueryTuningEnabled && queryTuning.SearchWaitForSlowResults;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(QueryText))
|
if (!string.IsNullOrEmpty(QueryText))
|
||||||
@@ -1157,6 +1158,16 @@ namespace PowerLauncher.ViewModel
|
|||||||
return _settings.SearchInputDelay;
|
return _settings.SearchInputDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public QueryTuningOptions GetQueryTuningOptions()
|
||||||
|
{
|
||||||
|
return new MainViewModel.QueryTuningOptions
|
||||||
|
{
|
||||||
|
SearchClickedItemWeight = GetSearchClickedItemWeight(),
|
||||||
|
SearchQueryTuningEnabled = GetSearchQueryTuningEnabled(),
|
||||||
|
SearchWaitForSlowResults = GetSearchWaitForSlowResults(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public int GetSearchClickedItemWeight()
|
public int GetSearchClickedItemWeight()
|
||||||
{
|
{
|
||||||
return _settings.SearchClickedItemWeight;
|
return _settings.SearchClickedItemWeight;
|
||||||
|
|||||||
Reference in New Issue
Block a user