using NEIntelligentControl2.Models.AGC;
using NEIntelligentControl2.Windows;
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.AGC
{
///
/// AGC标签
///
public partial class AGCTag : UserControl
{
// --------依赖属性---------
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(AGCTag));
private TagInfo info;
///
/// 信息
///
public TagInfo Info { get => info; set { info = value; info.ValueChanged = ValueChanged; } }
///
/// 值
///
public string Value { get => (string)GetValue(ValueProperty); set => SetValue(ValueProperty, value); }
///
/// 是否是DI点
///
public bool IsDiPoint { get; set; }
public AGCTag()
{
InitializeComponent();
}
private void ValueChanged(double d)
{
this.Value = d.ToString("0.00");
}
private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount < 2 || IsDiPoint) return;
HistoryDataWindow.ShowWindow(Info.Name, Info.Tag, Info.Multiplier);
}
}
}