using NEIntelligentControl2.Models.Windturbine; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace NEIntelligentControl2.Views.Matrix { /// /// 故障风机矩阵 /// public partial class MalfunctionMatrix : UserControl { private Dictionary _ShowDataPairts; // 被展示的风机信息 public MalfunctionMatrix() { InitializeComponent(); _ShowDataPairts = new Dictionary(); } /// /// 更新数据 /// internal void UpdateData(Dictionary vs) { Dispatcher.Invoke(() => { foreach (var v in vs) { if (_ShowDataPairts.ContainsKey(v.Key) && v.Value.Status != 5) { _UGMain.Children.Remove(_ShowDataPairts[v.Key]); _ShowDataPairts.Remove(v.Key); } if (v.Value.Status != 5) continue; if (!_ShowDataPairts.ContainsKey(v.Key)) { WindBlockSmall bs = new WindBlockSmall(v.Value) { Title = v.Value.Name }; _UGMain.Children.Insert(0, bs); _ShowDataPairts.Add(v.Key, bs); } _ShowDataPairts[v.Key].Update(v.Value); } }); } } }