using Audit.View; using GalaSoft.MvvmLight; using Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Threading; namespace Audit.ViewModel { public class PipesViewModel : ViewModelBase { private List pipes = new List(); public List Pipes { get { return pipes; } set { pipes = value; RaisePropertyChanged(); } } public PipesViewModel() { DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event { Interval = TimeSpan.FromSeconds(0.1) }; timer.Tick += Tick_Event; timer.Start(); } void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件 { if (PipesView.Button_pipessql == true) { new PipesProvider().Select(); PipesView.Button_pipessql = false; } } } }