using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using Unity; namespace FLY.HeatingHelper.UI.UiModule { public class ViewModel_HeatThickDetector : INotifyPropertyChanged { public IThickHeatData dat; public IThickHeatData Dat { get { return dat; } set { dat = value; } } public ViewModel_HeatThickDetector(FLY.Thick.Blowing.IService.IBlowingService blowing, IThickHeatData dat) { this.dat = dat; Misc.BindingOperations.SetBinding(dat, "NewResetBolt", this, "NewResetBolt"); Misc.BindingOperations.SetBinding(blowing, "OrgBoltNo", () => { CurrentResetBolt = blowing.OrgBoltNo; if (this.dat.OldResetBolt == 0) { //刚开机 NewResetBolt = CurrentResetBolt; } else if (CurrentResetBolt != this.dat.OldResetBolt) { NewResetBolt = CurrentResetBolt; } }); IsDifferent = (CurrentResetBolt != NewResetBolt); this.PropertyChanged += (s, e) => { if ((e.PropertyName == "CurrentResetBolt") || (e.PropertyName == "NewResetBolt")) { IsDifferent = (CurrentResetBolt != NewResetBolt); } }; //CurrentResetBolt = 55; //NewResetBolt = 30; //IsDifferent = true; } public bool HasData { get { if (dat == null) return false; if (dat.TotalDataFrom != DateTime.MinValue) return true; return false; } } public int NewResetBolt { get; set; } public int CurrentResetBolt { get; set; } public bool IsDifferent { get; private set; } public event PropertyChangedEventHandler PropertyChanged; } }