mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
Use variable instead of global static method
1. introduce variable 2. part of #389 3. refactoring program suffix in program plugin 4. 全局变量一时爽,代码重构火葬场
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Wox.Plugin;
|
||||
using Wox.ViewModel;
|
||||
@@ -9,10 +11,12 @@ namespace Wox
|
||||
[Synchronization]
|
||||
public partial class ResultListBox
|
||||
{
|
||||
public void AddResults(List<Result> newResults, string resultId)
|
||||
public void AddResults(List<Result> newRawResults)
|
||||
{
|
||||
var vm = DataContext as ResultsViewModel;
|
||||
vm.AddResults(newResults, resultId);
|
||||
var newResults = newRawResults.Select(r => new ResultViewModel(r)).ToList();
|
||||
vm.Results.Update(newResults);
|
||||
vm.SelectedResult = vm.Results[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user