WindturbineDetailsCard.xaml.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using NEIntelligentControl2.Models.Datas;
  2. using NEIntelligentControl2.Models.Windturbine;
  3. using NEIntelligentControl2.Models.WinForms;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Navigation;
  17. using System.Windows.Shapes;
  18. namespace NEIntelligentControl2.Views.Infos
  19. {
  20. /// <summary>
  21. /// 风机详情弹窗卡片
  22. /// </summary>
  23. public partial class WindturbineDetailsCard : UserControl
  24. {
  25. public string CardTitle { get; internal set; }
  26. public List<UniformCodeInfo> Items { get; internal set; }
  27. public WindturbineInfo Info { get; internal set; }
  28. private List<PointTag> _PointTags;
  29. public WindturbineDetailsCard()
  30. {
  31. InitializeComponent();
  32. }
  33. internal void RefreshData(Dictionary<string, TsData> vs)
  34. {
  35. if (ug.Children.Count <= 0)
  36. {
  37. Init();
  38. }
  39. foreach (var v in _PointTags)
  40. {
  41. v.UpdateData(vs);
  42. }
  43. }
  44. private void Init()
  45. {
  46. if (Items == null) return;
  47. _PointTags = new List<PointTag>();
  48. foreach (var v in Items)
  49. {
  50. if (string.IsNullOrWhiteSpace(v.Name)) continue;
  51. PointTag pt = new PointTag(v, Info.WindturbineId) { Margin = new Thickness(1) };
  52. ug.Children.Add(pt);
  53. _PointTags.Add(pt);
  54. }
  55. }
  56. }
  57. }