/// <summary> /// 执行异步委托 /// </summary> /// <param name="asynWaitPara">异步等待执行参数</param> /// <param name="containerControl">容器控件</param> public override void Excute(PartAsynWaitPara <T, TResult> asynWaitPara, TContainer containerControl) { if (asynWaitPara.AsynWait == null) { PartAsynUIParaProxy.SetAsynWait(asynWaitPara, this.CreateAsynWaitShadeControl(_shadeType, asynWaitPara)); } if (asynWaitPara.Islock) { return; } lock (asynWaitPara.SyncRoot) { if (asynWaitPara.Islock) { return; } PartAsynUIParaProxy.Lock(asynWaitPara); } var container = containerControl as Control; this._asynWaitPara = asynWaitPara; this._containerControl = container; //设置遮罩层控件 asynWaitPara.AsynWait.ShadeBackground = PartAsynExcuteFactoryWinform.ConvertShadeBackground(asynWaitPara.AsynWaitBackground); //添加遮罩层控件 this._shadeControl = new UtilZ.Dotnet.WindowsDesktopEx.Winform.Controls.OpacityPanel(); this._shadeControl.Dock = DockStyle.Fill; container.Controls.Add(this._shadeControl); container.Controls.SetChildIndex(this._shadeControl, 0); var asynWaitControl = (Control)asynWaitPara.AsynWait; asynWaitControl.Anchor = AnchorStyles.None; asynWaitControl.Location = new System.Drawing.Point((container.Width - asynWaitControl.Width) / 2, (container.Height - asynWaitControl.Height) / 2); container.Controls.Add(asynWaitControl); container.Controls.SetChildIndex(asynWaitControl, 0); //禁用容器控件内的子控件的Tab焦点选中功能 WinformPartAsynExcuteHelper.DisableTab(container, this._asynModifyControls); //启动执行线程 base.StartAsynExcuteThread(); }
/// <summary> /// 执行异步委托 /// </summary> /// <param name="asynWaitPara">异步等待执行参数</param> /// <param name="containerControl">容器控件</param> public override void Excute(PartAsynWaitPara <T, TResult> asynWaitPara, TContainer containerControl) { if (asynWaitPara.AsynWait == null) { PartAsynUIParaProxy.SetAsynWait(asynWaitPara, this.CreateAsynWaitShadeControl(_shadeType, asynWaitPara)); } if (asynWaitPara.Islock) { return; } lock (asynWaitPara.SyncRoot) { if (asynWaitPara.Islock) { return; } PartAsynUIParaProxy.Lock(asynWaitPara); } var container = containerControl as Control; this._asynWaitPara = asynWaitPara; this._containerControl = container; //禁用容器控件内的子控件的Tab焦点选中功能 WinformPartAsynExcuteHelper.DisableTab(container, this._asynModifyControls); //设置遮罩层控件 asynWaitPara.AsynWait.ShadeBackground = PartAsynExcuteFactoryWinform.ConvertShadeBackground(asynWaitPara.AsynWaitBackground); //添加遮罩层控件 var shadeControl = (Control)asynWaitPara.AsynWait; shadeControl.Dock = DockStyle.Fill; this.SetShadeBackgroundImg(container, shadeControl); container.Controls.Add(shadeControl); //设置遮罩层控件在最上层 container.Controls.SetChildIndex(shadeControl, 0); container.SizeChanged += containerControl_SizeChanged; //启动执行线程 base.StartAsynExcuteThread(); }