using NEIntelligentControl2.Models.PV;
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.Infos
{
    /// <summary>
    /// SUN2000机型数据标签
    /// </summary>
    public partial class SUN2000InfoTag : UserControl
    {
        //  --------------依赖属性--------------
        public static readonly DependencyProperty IProperty = DependencyProperty.Register("I", typeof(double), typeof(SUN2000InfoTag));
        public static readonly DependencyProperty PProperty = DependencyProperty.Register("P", typeof(double), typeof(SUN2000InfoTag));
        /// <summary>
        /// 数据点值
        /// </summary>
        public double I { get { return (double)GetValue(IProperty); } set { SetValue(IProperty, Math.Round(value, 2)); } }
        public double P { get { return (double)GetValue(PProperty); } set { SetValue(PProperty, Math.Round(value, 2)); } }
        private SUN2000Info info;
        public SUN2000Info Info { get => info; set { info = value; info.ValueChanged = ValueChanged; } }


        public SUN2000InfoTag()
        {
            InitializeComponent();
        }

        private void ValueChanged(double arg1, double arg2)
        {
            P = arg1;
            I = arg2;
        }
    }
}
