Commit 69cbddcc LN

1

1 个父辈 4eaa20d8
......@@ -61,26 +61,29 @@ namespace TheMachine
// lblLed
//
this.lblLed.AutoSize = true;
this.lblLed.Location = new System.Drawing.Point(38, 621);
this.lblLed.Location = new System.Drawing.Point(256, 487);
this.lblLed.Name = "lblLed";
this.lblLed.Size = new System.Drawing.Size(0, 12);
this.lblLed.Size = new System.Drawing.Size(41, 12);
this.lblLed.TabIndex = 16;
this.lblLed.Text = "氛围灯";
//
// lblOkValue
//
this.lblOkValue.AutoSize = true;
this.lblOkValue.Location = new System.Drawing.Point(38, 578);
this.lblOkValue.Location = new System.Drawing.Point(256, 454);
this.lblOkValue.Name = "lblOkValue";
this.lblOkValue.Size = new System.Drawing.Size(0, 12);
this.lblOkValue.Size = new System.Drawing.Size(65, 12);
this.lblOkValue.TabIndex = 15;
this.lblOkValue.Text = "压力传感器";
//
// lblSensor
//
this.lblSensor.AutoSize = true;
this.lblSensor.Location = new System.Drawing.Point(38, 539);
this.lblSensor.Location = new System.Drawing.Point(256, 421);
this.lblSensor.Name = "lblSensor";
this.lblSensor.Size = new System.Drawing.Size(0, 12);
this.lblSensor.Size = new System.Drawing.Size(65, 12);
this.lblSensor.TabIndex = 14;
this.lblSensor.Text = "声波传感器";
//
// button3
//
......
......@@ -24,6 +24,9 @@ namespace TheMachine
if (DesignMode)
return;
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
lblLed.Text = "";
lblOkValue.Text = "";
lblSensor.Text = "";
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
......@@ -121,47 +124,59 @@ namespace TheMachine
{
roateloop = false;
}
private bool isPro = false;
private void timer1_Tick(object sender, EventArgs e)
{
if (!this.Visible)
{
return;
}
try
{
if (Setting_Init.Device_LedLight_PortName != "")
{
lblLed.Text ="LED"+ Setting_Init.Device_LedLight_PortName+":"+ RobotManage.mainMachine.lastColor.ToString();
}
else
if (isPro)
{
return;
}
isPro = true;
Task.Run(() =>
{
try
{
lblLed.Text = "";
}
if (Setting_Init.Device_LedLight_PortName != "")
{
lblLed.Text = "LED" + Setting_Init.Device_LedLight_PortName + ":" + RobotManage.mainMachine.lastColor.ToString();
}
else
{
lblLed.Text = "";
}
if (Setting_Init.Device_DauxiKS107_PortName != "")
{
RobotManage.dauxiKS107Controller.Quary(out int currValue, out string msg);
lblSensor.Text = $"红外传感器{Setting_Init.Device_DauxiKS107_PortName}:" + currValue + ", /" + Setting_Init.Device_DauxiKS107_BaseValue + "/" + Setting_Init.Device_DauxiKS107_ErrorValue;
}
else
{
lblSensor.Text = "";
}
if (Setting_Init.Device_WeightSensor_PortName != "")
{
lblOkValue.Text = $"压力传感器{Setting_Init.Device_WeightSensor_PortName}: {Setting_Init.Device_WeightSensor_MaxValue}";
}
else
{
lblOkValue.Text = "";
}
if (Setting_Init.Device_DauxiKS107_PortName != "")
{
RobotManage.dauxiKS107Controller.Quary(out int currValue, out string msg);
lblSensor.Text = $"红外传感器{Setting_Init.Device_DauxiKS107_PortName}:" + currValue + ", /" + Setting_Init.Device_DauxiKS107_BaseValue + "/" + Setting_Init.Device_DauxiKS107_ErrorValue;
}
else
{
lblSensor.Text = "";
}
if (Setting_Init.Device_WeightSensor_PortName != "")
catch (Exception ex)
{
lblOkValue.Text = $"压力传感器{Setting_Init.Device_WeightSensor_PortName}: {Setting_Init.Device_WeightSensor_MaxValue}";
LogUtil.error("出错:" + ex.ToString());
}
else
finally
{
lblOkValue.Text = "";
isPro = false;
}
}
catch(Exception ex)
{
LogUtil.error("出错:" + ex.ToString());
}
});
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!