using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data; using Mesnac.Action.Base; using Mesnac.Codd.Session; using System.Reflection; using Mesnac.Controls.Base; namespace Mesnac.Action.ChemicalWeighing.Warehouse { /// /// 当班计划窗体初始化业务 /// public class InitFormAction : ChemicalWeighingAction,IAction { #region 字段定义 public static bool IsFirstRun = true; //是否首次运行 private RuntimeParameter _runtime; private DbMCControl _clientGridControl = null; #endregion public void Run(RuntimeParameter runtime) { base.RunIni(runtime); #region 首次执行,进行事件订阅 if (IsFirstRun) { IsFirstRun = false; ICSharpCode.Core.LoggingService.Debug("反应釜管理-窗体初始化业务..."); } #endregion #region 初始化 #region 获取界面控件 string source = string.Empty; DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Hw_Warehouse").FirstOrDefault(); //获取本机台计划网格控件 if (clientGridControl == null) { ICSharpCode.Core.LoggingService.Error("{反应釜管理-窗体加载} 缺少列表网格控件..."); return; } this._runtime = runtime; this._clientGridControl = clientGridControl; #endregion #region 初始化操作 DataGridView clientGrid = (clientGridControl.BaseControl as DataGridView); this.InitGridViewEvent(clientGrid); #endregion #endregion } #region 方法定义 #region 网格事件处理方法 /// /// 初始化网格样式 /// /// DataGridView网格控件对象 private void InitGridViewEvent(DataGridView dgv) { if (dgv != null) { WarehouseHelper.SetDataGridViewStyle(dgv); //设置网格样式 //双击时取消选择行(取消高亮显示) dgv.CellDoubleClick += delegate(object sender, DataGridViewCellEventArgs e) { if (dgv.Rows != null && dgv.Rows.Count > 0) { foreach (DataGridViewRow row in dgv.Rows) { row.Selected = false; } } }; } } #endregion #endregion } }