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.
53 lines
1.3 KiB
53 lines
1.3 KiB
|
4 years ago
|
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 MachinesViewModel : ViewModelBase
|
||
|
|
{
|
||
|
|
private List<Machines> machiness = new List<Machines>();
|
||
|
|
|
||
|
|
public List<Machines> Machines
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
return machiness;
|
||
|
|
}
|
||
|
|
set
|
||
|
|
{
|
||
|
|
machiness = value;
|
||
|
|
RaisePropertyChanged();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public MachinesViewModel()
|
||
|
|
{
|
||
|
|
//machiness = new MachinesProvider().Select();//显示机台
|
||
|
|
|
||
|
|
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 (MachinesView.Button_sql == true)//获取按钮状态
|
||
|
|
{
|
||
|
|
Machines = new MachinesProvider().Select();//显示机台
|
||
|
|
MachinesView.Button_sql = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|