HYControl.cs
3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using DeviceLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
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 TheMachine
{
public partial class HYControl : UserControl, Idevicetab
{
public HYControl()
{
InitializeComponent();
if (DesignMode)
return;
this.Tag = "not";
crc.OpenResourceLog = true;
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
if (!string.IsNullOrEmpty(Setting_Init.Device_Default_Language))
crc.CurrLanguage = Setting_Init.Device_Default_Language;
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
{
crc.LanguageProcess(this);
btn_linerun.Text = RobotManage.Config.DOList[DeviceGroupName][IO_Type.Ls_A_LineRun].ElectricalDefinition+" " + btn_linerun.Text;
btn_linestop.Text = RobotManage.Config.DOList[DeviceGroupName][IO_Type.Ls_A_LineRun].ElectricalDefinition+" " + btn_linestop.Text;
if (RobotManage.Config.DOList[DeviceGroupName].ContainsKey(IO_Type.Ls_A_LineRwd))
btn_linerev.Text = RobotManage.Config.DOList[DeviceGroupName][IO_Type.Ls_A_LineRwd].ElectricalDefinition+" " + btn_linerev.Text;
}
public void Init(string _deviceGroup)
{
this.DeviceGroupName = _deviceGroup;
foreach (var c in this.Controls) {
if (!(c is CylinderButton))
continue;
var cc = (c as CylinderButton);
cc.DeviceType = DeviceGroupName;
if (!RobotManage.Config.DOList[DeviceGroupName].ContainsKey(cc.IO_HIGH))
cc.Visible = false;
}
ioControl1.Init(RobotManage.Config, DeviceGroupName);
if (!RobotManage.Config.DOList[DeviceGroupName].ContainsKey(IO_Type.Ls_A_LineRun)) {
btn_linerun.Visible = false;
btn_linerev.Visible = false;
btn_linestop.Visible = false;
}
if (!RobotManage.Config.DOList[DeviceGroupName].ContainsKey(IO_Type.Ls_A_LineRwd))
{
btn_linerev.Visible = false;
}
if (SideMove.DeviceList[DeviceGroupName].RFID_2 != null)
{
rfidControl1.Init(DeviceGroupName+"-1", SideMove.DeviceList[DeviceGroupName].RFID_1);
rfidControl2.Init(DeviceGroupName + "-2", SideMove.DeviceList[DeviceGroupName].RFID_2);
}
else if (SideMove.DeviceList[DeviceGroupName].RFID_1 != null)
rfidControl1.Init(DeviceGroupName, SideMove.DeviceList[DeviceGroupName].RFID_1);
crc.LanguageProcess(this);
}
public string DeviceGroupName { get; set; }
private void btn_linerun_Click(object sender, EventArgs e)
{
SideMove.DeviceList[DeviceGroupName].Line.LineRun("n", false, 999);
}
private void btn_linerev_Click(object sender, EventArgs e)
{
SideMove.DeviceList[DeviceGroupName].Line.LineRun("n", true, 999);
}
private void btn_linestop_Click(object sender, EventArgs e)
{
SideMove.DeviceList[DeviceGroupName].Line.LineStop("n");
}
}
}