InverterPoint.xaml.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using NEIntelligentControl2.Models.PV;
  2. using NEIntelligentControl2.Windows;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace NEIntelligentControl2.Views.Infos
  18. {
  19. /// <summary>
  20. /// 光伏详情数据点控件
  21. /// </summary>
  22. public partial class InverterPoint : UserControl
  23. {
  24. // --------------依赖属性--------------
  25. public static readonly DependencyProperty PointValueProperty = DependencyProperty.Register("PointValue", typeof(double), typeof(InverterPoint));
  26. /// <summary>
  27. /// 数据点值
  28. /// </summary>
  29. public double PointValue { get { return (double)GetValue(PointValueProperty); } set { SetValue(PointValueProperty, Math.Round(value, 2)); } }
  30. private PVTagInfo tagInfo;
  31. /// <summary>
  32. /// 光伏信息
  33. /// </summary>
  34. public PVTagInfo TagInfo { get => tagInfo; set { tagInfo = value; tagInfo.ValueChanged = ValueChanged; } }
  35. /// <summary>
  36. /// 光伏ID
  37. /// </summary>
  38. public string PVId { get; internal set; }
  39. public InverterPoint()
  40. {
  41. InitializeComponent();
  42. }
  43. private void ValueChanged(double obj)
  44. {
  45. this.PointValue = obj;
  46. }
  47. private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  48. {
  49. if (e.ClickCount < 2) return;
  50. HistoryDataWindow.ShowWindow(TagInfo.Name, TagInfo.Code, "windturbine", PVId, 1, 24);
  51. }
  52. }
  53. }