using System; using System.Windows.Forms; using Mesnac.Action.Base; namespace Mesnac.Action.ChemicalWeighing.LjMaterial { public class InsertAction:ChemicalWeighingAction,IAction { /// /// 新增物料事件定义 /// public static event EventHandler OnInsertMaterial; private RuntimeParameter _runtime; public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须调用 this._runtime = runtime; DoWork(); } private void DoWork() { this._runtime.BaseControl.MCEnabled = false; FrmMaterial frmInsertMaterial = new FrmMaterial(0); frmInsertMaterial.ShowDialog(this._runtime.BaseControl.MCRoot as Control); if (frmInsertMaterial.DialogResult == DialogResult.OK) { if (OnInsertMaterial != null) { OnInsertMaterial(this._runtime.BaseControl.MCRoot, System.EventArgs.Empty); } frmInsertMaterial.Dispose(); } this._runtime.BaseControl.MCEnabled = true; } } }