using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data; using ICSharpCode.Core; using Mesnac.Controls.Base; using Mesnac.Action.Base; using Mesnac.Codd.Session; using Mesnac.Action.ChemicalWeighing.Entity; using Mesnac.Action.ChemicalWeighing.Technical; namespace Mesnac.Action.ChemicalWeighing.PumpManage { public class RefreshAction : ChemicalWeighingAction,IAction { #region 事件定义 public static event EventHandler OnRefresh; #endregion #region 字段定义 private static bool IsFirstRun = true; //是否首次执行 private RuntimeParameter _runtime; private DbMCControl _clientGridControl = null; //网格计划控件 #endregion #region IAction接口实现 public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须要调用的 this._runtime = runtime; ICSharpCode.Core.LoggingService.Debug("投料泵—刷新业务..."); #region 事件订阅 DeleteAction.OnDeletePump -= Process_Event; DeleteAction.OnDeletePump += Process_Event; #endregion DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Hw_Pump").FirstOrDefault(); //获取本机台计划控件 if (clientGridControl == null || !(clientGridControl.BaseControl is DataGridView)) { ICSharpCode.Core.LoggingService.Error("{投料泵—刷新}缺少本机台网格控件..."); return; } this._clientGridControl = clientGridControl; if (true) { if (OnRefresh != null) { OnRefresh(runtime, System.EventArgs.Empty); } IsFirstRun = false; } this.DoWork(); } #endregion #region 方法定义 /// /// 刷新计划 /// protected void DoWork() { } #endregion #region 事件处理方法 private void Process_Event(object sender, EventArgs e) { if (sender is RuntimeParameter) { this.Run(sender as RuntimeParameter); } else { this.Run(this._runtime); } } #endregion } }