You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.4 KiB
56 lines
1.4 KiB
using GalaSoft.MvvmLight;
|
|
using Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Services.Description;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Threading;
|
|
|
|
namespace Audit.ViewModel
|
|
{
|
|
///<Summary>
|
|
/// StuffViewModel
|
|
///</Summary>
|
|
public class StuffViewModel : ViewModelBase
|
|
{
|
|
private List<Product> products = new List<Product>();
|
|
|
|
/// <summary>
|
|
/// 所有原料
|
|
/// </summary>
|
|
public List<Product> Product
|
|
{
|
|
get
|
|
{
|
|
return products;
|
|
}
|
|
set
|
|
{
|
|
products = value;
|
|
RaisePropertyChanged();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// StuffViewModeldl
|
|
/// </summary>
|
|
public StuffViewModel()
|
|
{
|
|
products = new ProductProvider().Select();
|
|
DispatcherTimer timer = new DispatcherTimer();//每5秒调用一次Tick_Event
|
|
timer.Interval = TimeSpan.FromSeconds(1);
|
|
timer.Tick += Tick_Event;
|
|
timer.Start();
|
|
}
|
|
|
|
void Tick_Event(object sender, EventArgs e)
|
|
{
|
|
Product = new ProductProvider().Select();//扫描数据库
|
|
}
|
|
}
|
|
}
|
|
|