src/modules/launcher/Wox/ViewModel/ResultsViewModel.cs
/// <summary>
/// To avoid deadlock, this method should not called from main thread
/// </summary>
To avoid deadlock, this method should not called from main thread
To avoid deadlock this method should not called from main thread
public void AddResults(List<Result> newRawResults, string resultId)
        {
            lock (_addResultsLock)
            {
                var newResults = NewResults(newRawResults, resultId);
                Results.Update(newResults);
                if (Results.Count > 0)
                {
                    Margin = new Thickness { Top = 8 };
                    SelectedIndex = 0;
                }
                else
                {
                    Margin = new Thickness { Top = 0 };
                    Visibility = Visibility.Collapsed;
                }
            }
        }
public void AddResults ( List < Result > newRawResults , string resultId ) { lock ( _addResultsLock ) { var newResults = NewResults ( newRawResults , resultId ) ; Results . Update ( newResults ) ; if ( Results . Count > 0 ) { Margin = new Thickness { Top = 8 } ; SelectedIndex = 0 ; } else { Margin = new Thickness { Top = 0 } ; Visibility = Visibility . Collapsed ; } } }
To avoid deadlock, this method should not called from main thread
To avoid deadlock this method should not called from main thread
// update UI in one run, so it can avoid UI flickering
newRawResults
List<Result>
resultId
string