using System; using System.ComponentModel; using System.Windows.Threading; namespace FLY.Simulation.Calender.GuRuiShiYe.UI { public class FlyADClientUI : INotifyPropertyChanged { public string Name { get; set; } public string Addr { get; set; } public int Position { get; set; } public int Speed { get; set; } public int Position2 { get; set; } public int Speed2 { get; set; } public int AD { get; set; } public UInt16 IStatus { get; set; } public UInt16 OStatus { get; set; } = 0xf; public double TimeSpan1ms { get; set; } public int Surplus { get; set; } = 8000; private DispatcherTimer timer = new DispatcherTimer(); private FLY.Simulation.Flyad7.FLYAD7 flyad; public FlyADClientUI(FLY.Simulation.Flyad7.FLYAD7 flyad) { Init(flyad); } void Init(FLY.Simulation.Flyad7.FLYAD7 flyad) { this.flyad = flyad; Addr = flyad.Addr; timer.Interval = TimeSpan.FromSeconds(0.1); timer.Tick += new EventHandler(timer_Tick); timer.Start(); } void timer_Tick(object sender, EventArgs e) { Position = flyad.Position; Position2 = flyad.Position2; AD = flyad.AD; Speed = flyad.Speed; Speed2 = flyad.Speed2; TimeSpan1ms = flyad.TimeSpan1ms; IStatus = flyad.IStatus; OStatus = flyad.OStatus; Surplus = flyad.Surplus; } public event PropertyChangedEventHandler PropertyChanged; } }