using GalaSoft.MvvmLight; using Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Threading; namespace Audit.ViewModel { /// /// QueryViewModel /// public class QueryViewModel : ViewModelBase { private List dyelots = new List(); private List dyelotsBulkedRecipe = new List(); /// /// 所有工单 /// public List Dyelots { get { return dyelots; } set { dyelots = value; RaisePropertyChanged(); } } /// /// DyelotsBulkedRecipe /// public List DyelotsBulkedRecipe { get { return dyelotsBulkedRecipe; } set { dyelotsBulkedRecipe = value; RaisePropertyChanged(); } } /// /// /// public QueryViewModel() { dyelots = new DyelotsProvider().Select(); DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event { Interval = TimeSpan.FromSeconds(0.1) }; timer.Tick += Tick_Event; timer.Start(); } int a = 0;//计数器用变量 void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件 { if (a == 20)// { a = 0; } else a++; } } }