You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.7 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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();
//当前所处位置 1DI信号 2DO信号
/// <summary>
/// DI信号
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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;
}
}
/// <summary>
/// DO信号
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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;
}
}
}
}