SUN2000InfoTag.xaml.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using NEIntelligentControl2.Models.PV;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace NEIntelligentControl2.Views.Infos
  17. {
  18. /// <summary>
  19. /// SUN2000机型数据标签
  20. /// </summary>
  21. public partial class SUN2000InfoTag : UserControl
  22. {
  23. // --------------依赖属性--------------
  24. public static readonly DependencyProperty IProperty = DependencyProperty.Register("I", typeof(double), typeof(SUN2000InfoTag));
  25. public static readonly DependencyProperty PProperty = DependencyProperty.Register("P", typeof(double), typeof(SUN2000InfoTag));
  26. /// <summary>
  27. /// 数据点值
  28. /// </summary>
  29. public double I { get { return (double)GetValue(IProperty); } set { SetValue(IProperty, Math.Round(value, 2)); } }
  30. public double P { get { return (double)GetValue(PProperty); } set { SetValue(PProperty, Math.Round(value, 2)); } }
  31. private SUN2000Info info;
  32. public SUN2000Info Info { get => info; set { info = value; info.ValueChanged = ValueChanged; } }
  33. public SUN2000InfoTag()
  34. {
  35. InitializeComponent();
  36. }
  37. private void ValueChanged(double arg1, double arg2)
  38. {
  39. P = arg1;
  40. I = arg2;
  41. }
  42. }
  43. }