using Module.Plc.ModbusTcp.Tool;
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 MorClient.UserControls
{
public partial class Monitor : UserControl
{
Common Common=new Common();
public Monitor()
{
InitializeComponent();
}
int state=1;
public void AddPanel(Monitor userMonitoring)
{
userMonitoring.uiButton1.FillColor = Color.FromArgb(199, 213, 237);
userMonitoring.uiButton2.FillColor = Color.FromArgb(124, 156, 214);
userMonitoring.panel1.Controls.Clear();
supcontrol_DI.Dock = DockStyle.Fill;
userMonitoring.panel1.Controls.Add(supcontrol_DI);
userMonitoring.panel1.Show();
}
private Monitor userMonitoring;
public void GetMonitorObject(Monitor monitorObject)
{
this.userMonitoring = monitorObject;
}
Supcontrol_DI supcontrol_DI = PubStaticClass.supcontrol_DI;//new Supcontrol_DI();
Supcontrol_DO supcontrol_DO = PubStaticClass.supcontrol_DO;//new Supcontrol_DO();
//当前所处位置 1:DI信号 2:DO信号
///
/// DI信号
///
///
///
private void uiButton1_Click_1(object sender, EventArgs e)
{
if (state != 1)
{
userMonitoring.uiButton1.FillColor = Color.FromArgb(199, 213, 237);
userMonitoring.uiButton2.FillColor = Color.FromArgb(124, 156, 214);
userMonitoring.panel1.Controls.Clear();
supcontrol_DI.Dock = DockStyle.Fill;
userMonitoring.panel1.Controls.Add(supcontrol_DI);
userMonitoring.panel1.Show();
state = 1;
}
}
///
/// DO信号
///
///
///
private void uiButton2_Click_1(object sender, EventArgs e)
{
if (state != 2)
{
userMonitoring.uiButton1.FillColor = Color.FromArgb(124, 156, 214);
userMonitoring.uiButton2.FillColor = Color.FromArgb(199, 213, 237);
userMonitoring.panel1.Controls.Clear();
supcontrol_DO.Dock = DockStyle.Fill;
userMonitoring.panel1.Controls.Add(supcontrol_DO);
userMonitoring.panel1.Show();
state = 2;
}
}
}
}