在ViewModel的構造函數實現下面代碼
DispatcherTimer timer = new DispatcherTimer();
timer.Tick += (s, e) =>
{
//每隔2000毫秒發生一次
//修改UI線程中的對象
Search();
};
timer.Interval = TimeSpan.FromMilliseconds(2000);
timer.Start();