添加项目文件。
This commit is contained in:
112
CleanMachineHMI/frmChild/frmSwitchRunDirection.cs
Normal file
112
CleanMachineHMI/frmChild/frmSwitchRunDirection.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using CleanMachineHMI.Utils;
|
||||
using ComponentFactory.Krypton.Toolkit;
|
||||
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.Web.UI.WebControls;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CleanMachineHMI.frmChild
|
||||
{
|
||||
public partial class frmSwitchRunDirection : KryptonForm
|
||||
{
|
||||
public frmSwitchRunDirection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_InfoLanguageTextList = this.GetInfoLanguageText(GlobalHelper.LanguageCode);
|
||||
}
|
||||
private DataTable _InfoLanguageTextList;
|
||||
|
||||
private void frmSwitchRunDirection_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.SetFormControlText(GlobalHelper.LanguageCode);
|
||||
int directNum = Convert.ToInt32(PlcOperationHelper.Instance.ReadPlcItem("DischargeDirectionSelection", PlcItemTypeDesc.D));
|
||||
if (GlobalHelper.LanguageCode == "English")
|
||||
{
|
||||
if (directNum == 0)
|
||||
{
|
||||
ktb_CurrRunDirection.Text = "Positive direction";
|
||||
}
|
||||
else
|
||||
{
|
||||
ktb_CurrRunDirection.Text = "Negative direction";
|
||||
}
|
||||
kcmb_SwitchRunDirection.Items.Clear();
|
||||
kcmb_SwitchRunDirection.Items.Add(new ListItem
|
||||
{
|
||||
Value = "",
|
||||
Text = "Please Select",
|
||||
});
|
||||
kcmb_SwitchRunDirection.Items.Add(new ListItem
|
||||
{
|
||||
Value = "1",
|
||||
Text = "Positive direction",
|
||||
});
|
||||
kcmb_SwitchRunDirection.Items.Add(new ListItem
|
||||
{
|
||||
Value = "2",
|
||||
Text = "Negative direction",
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (directNum == 0)
|
||||
{
|
||||
ktb_CurrRunDirection.Text = "正方向";
|
||||
}
|
||||
else
|
||||
{
|
||||
ktb_CurrRunDirection.Text = "反方向";
|
||||
}
|
||||
}
|
||||
kcmb_SwitchRunDirection.SelectedIndex = 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("加载出料运行方向切换界面发生异常", "LoadSwitchRunDirectionExp") + $":【{ex.Message}】!");
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (kcmb_SwitchRunDirection.SelectedIndex == 0)
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("请选择切换方向!", "SelectSwitchDirectionInfo"));
|
||||
return;
|
||||
}
|
||||
if (!PlcOperationHelper.Instance.isConn)
|
||||
{
|
||||
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
|
||||
return;
|
||||
}
|
||||
if (PlcOperationHelper.Instance.WritePlcItem("DischargeDirectionSelection", (kcmb_SwitchRunDirection.SelectedIndex - 1).ToString(), PlcItemTypeDesc.D))
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("切换出料运行方向成功!", "SwitchDirectionSuccessInfo"));
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("切换出料运行方向失败!", "SwitchDirectionFailInfo"));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("切换出料运行方向的函数发生异常", "SwitchRunDirectionExp") + $":【{ex.Message}】!");
|
||||
}
|
||||
}
|
||||
|
||||
private void btnEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user