1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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
- {
- /// <summary>
- /// AGC标签
- /// </summary>
- public partial class AGCTag : UserControl
- {
- // --------依赖属性---------
- public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(AGCTag));
- private TagInfo info;
- /// <summary>
- /// 信息
- /// </summary>
- public TagInfo Info { get => info; set { info = value; info.ValueChanged = ValueChanged; } }
- /// <summary>
- /// 值
- /// </summary>
- public string Value { get => (string)GetValue(ValueProperty); set => SetValue(ValueProperty, value); }
- /// <summary>
- /// 是否是DI点
- /// </summary>
- 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);
- }
- }
- }
|