using System; using System.Linq; using System.Windows.Forms; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.LjPlanning; namespace Mesnac.Action.ChemicalWeighing.LjRecipeData { public class AddAction:ChemicalWeighingAction, IAction { public static event EventHandler OnAdd; private DbMCControl _materialGridControl = null; //物料列表控件 private RuntimeParameter _runtime; public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须调用 this._runtime = runtime; DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Lj_Formula").FirstOrDefault(); //获取物料数据控件 this._materialGridControl = materialGridControl; FileControl(); } private void FileControl() { FrmWeiRecipeDataAdd frm = new FrmWeiRecipeDataAdd(); DialogResult result = frm.ShowDialog(); this._runtime.BaseControl.MCEnabled = false; if (result == DialogResult.OK) { if (OnAdd != null) { OnAdd(this._runtime.BaseControl.MCRoot, System.EventArgs.Empty); } frm.Dispose(); } this._runtime.BaseControl.MCEnabled = true; } } }