using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace UserControlLib
|
|
{
|
|
public partial class labTexBtn : UserControl
|
|
{
|
|
public event Action<string,string, string> ControlWriteValueEvent;
|
|
|
|
public labTexBtn()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public string TagName
|
|
{
|
|
|
|
get
|
|
{
|
|
return groupBox_TagName.Text;
|
|
}
|
|
set
|
|
{
|
|
groupBox_TagName.Text = value;
|
|
}
|
|
}
|
|
|
|
public string Value
|
|
{
|
|
|
|
get
|
|
{
|
|
return label_ValueNow.Text;
|
|
}
|
|
|
|
set
|
|
{
|
|
label_ValueNow.Text = value;
|
|
}
|
|
}
|
|
|
|
public new bool Enabled {
|
|
set
|
|
{
|
|
button_Write.Enabled = value;
|
|
|
|
textBox_WriteValue.Enabled = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public string TagAddr { get; set; }
|
|
|
|
public string TagType { get; set; }
|
|
|
|
public string WriteValue
|
|
{
|
|
|
|
get
|
|
{
|
|
return textBox_WriteValue.Text;
|
|
}
|
|
|
|
set
|
|
{
|
|
textBox_WriteValue.Text = value;
|
|
}
|
|
}
|
|
|
|
public string TagId { get; set; }
|
|
|
|
private void button_Write_Click(object sender, EventArgs e)
|
|
{
|
|
ControlWriteValueEvent?.Invoke(TagAddr, TagType, WriteValue);
|
|
}
|
|
|
|
|
|
public void UpdateValueNow(string tagAddr,string tagValue)
|
|
{
|
|
if (tagAddr== TagAddr)
|
|
{
|
|
// Value = tagValue;
|
|
Action action = () => { label_ValueNow.Text = tagValue; };
|
|
this.Invoke(action);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public void ThisEnabled(bool enabled)
|
|
{
|
|
Enabled= enabled;
|
|
|
|
}
|
|
|
|
}
|
|
}
|