This commit is contained in:
sc committed 2022-03-06 15:10:18 +08:00
commit 57aa8b1c6c
3 files changed
+25 -13

No files matched your search

+12 -2
View File
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Web.Services.Description;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Threading;
namespace Audit.ViewModel
{
@@ -18,7 +19,7 @@ namespace Audit.ViewModel
public class StuffViewModel : ViewModelBase
{
private List<Product> products = new List<Product>();
/// <summary>
/// 所有原料
/// </summary>
@@ -36,11 +37,20 @@ namespace Audit.ViewModel
}
/// <summary>
/// 查询数据
/// StuffViewModeldl
/// </summary>
public StuffViewModel()
{
products = new ProductProvider().Select();
DispatcherTimer timer = new DispatcherTimer();//每5秒调用一次Tick_Event
timer.Interval = TimeSpan.FromSeconds(5);
timer.Tick += Tick_Event;
timer.Start();
}
void Tick_Event(object sender, EventArgs e)
{
Product = new ProductProvider().Select();//扫描数据库
}
}
}