This commit is contained in:
sc committed 2022-03-07 21:15:20 +08:00
commit 7118885ffe
3 files changed
+31 -8

No files matched your search

+9 -4
View File
@@ -1,4 +1,5 @@
using GalaSoft.MvvmLight;
using Audit.View;
using GalaSoft.MvvmLight;
using Models;
using System;
using System.Collections.Generic;
@@ -42,15 +43,19 @@ namespace Audit.ViewModel
public StuffViewModel()
{
products = new ProductProvider().Select();
DispatcherTimer timer = new DispatcherTimer();//每5秒调用一次Tick_Event
timer.Interval = TimeSpan.FromSeconds(5);
DispatcherTimer timer = new DispatcherTimer();//每0.5秒调用一次Tick_Event
timer.Interval = TimeSpan.FromSeconds(0.5);
timer.Tick += Tick_Event;
timer.Start();
}
void Tick_Event(object sender, EventArgs e)
{
Product = new ProductProvider().Select();//扫描数据库
if (StuffView.Button_sql == true)
{
Product = new ProductProvider().Select();
StuffView.Button_sql = false;
}//扫描数据库
}
}
}