You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjElectrical/FrmElectrical.cs

52 lines
1.3 KiB
C#

1 year ago
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.LjElectrical
{
public partial class FrmElectrical : Form
{
public FrmElectrical()
{
InitializeComponent();
}
private int _id;
public FrmElectrical(int id) : this()
{
this._id = id;
ElectricalView view = new ElectricalView();
view = ElectricalPlc.UpFromPlc(id);
if (null != view)
{
this.Speed.Text = view.Speed.ToString();
this.Speed.Enabled = false;
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOK_Click(object sender, EventArgs e)
{
var speed = Speed.Text.Trim();
if (!float.TryParse(speed, out var sp))
{
Speed.Focus();
MessageBox.Show("请输入正确的值");
return;
}
ElectricalView view = new ElectricalView();
view.Id = _id;
view.Speed = Convert.ToSingle(speed);
ElectricalPlc.DownToPlc(new List<ElectricalView>()
{
view
});
}
}
}