/// <summary> /// 根据异步等待遮罩层类型创建遮罩层 /// </summary> /// <param name="shadeType">异步等待遮罩层类</param> /// <param name="para">异步等待UI参数</param> /// <returns>异步等待遮罩层类型创建遮罩层</returns> protected IPartAsynWait CreateAsynWaitShadeControl(Type shadeType, PartAsynWaitParaAbs para) { if (shadeType == null) { throw new Exception("没有指定自定义异步等待遮罩层类型"); } IPartAsynWait ishade = (IPartAsynWait)Activator.CreateInstance(shadeType); ishade.Title = para.Title; ishade.Message = para.Message; ishade.ShowCancel = para.ShowCancel; return(ishade); }
/// <summary> /// 异步等待 /// </summary> /// <typeparam name="T">异步执行参数类型</typeparam> /// <typeparam name="TResult">异步执行返回值类型</typeparam> ///<param name="asynWaitPara">异步等待执行参数</param> ///<param name="containerControl">容器控件</param> ///<param name="asynWait">异步等待UI</param> public static void Wait <T, TResult>(PartAsynWaitPara <T, TResult> asynWaitPara, System.Windows.Controls.Panel containerControl, IPartAsynWait asynWait) { ParaValidate(asynWaitPara, containerControl); var asynExcute = _partAsynExcuteFactory.CreateExcute <T, System.Windows.Controls.Panel, TResult>(); PartAsynUIParaProxy.SetAsynWait(asynWaitPara, asynWait); asynExcute.Excute(asynWaitPara, containerControl); }
/// <summary> /// 异步等待 /// </summary> /// <typeparam name="T">异步执行参数类型</typeparam> /// <typeparam name="TResult">异步执行返回值类型</typeparam> ///<param name="asynWaitPara">异步等待执行参数</param> ///<param name="containerControl">容器控件</param> ///<param name="asynWait">异步等待UI</param> ///<param name="hasWinformControl">容器控件中是否含有Winform的子控件[true:有;false:没有]</param> public static void Wait <T, TResult>(PartAsynWaitPara <T, TResult> asynWaitPara, UIElement containerControl, IPartAsynWait asynWait, bool hasWinformControl = false) { ParaValidate(asynWaitPara, containerControl); var asynExcute = (WPFAsynExcuteAbs <T, UIElement, TResult>)_partAsynExcuteFactory.CreateExcute <T, UIElement, TResult>(); asynExcute.HasWinformControl = hasWinformControl; PartAsynUIParaProxy.SetAsynWait(asynWaitPara, asynWait); asynExcute.Excute(asynWaitPara, containerControl); }
/// <summary> /// 设置一个异步等待 /// </summary> /// <param name="partAsynUIPara">异步等待UI参数</param> /// <param name="asynWait">异步等待</param> public static void SetAsynWait(PartAsynWaitParaAbs partAsynUIPara, IPartAsynWait asynWait) { partAsynUIPara.AsynWait = asynWait; }
/// <summary> /// 异步等待 /// </summary> /// <typeparam name="T">异步执行参数类型</typeparam> /// <typeparam name="TContainer">容器控件类型</typeparam> /// <typeparam name="TResult">异步执行返回值类型</typeparam> ///<param name="asynWaitPara">异步等待执行参数</param> ///<param name="containerControl">容器控件</param> ///<param name="asynWait">异步等待UI</param> ///<param name="asynExcute">异步执行</param> public static void Wait <T, TContainer, TResult>(PartAsynWaitPara <T, TResult> asynWaitPara, TContainer containerControl, IPartAsynWait asynWait, IAsynExcute <T, TContainer, TResult> asynExcute) { ParaValidate(asynWaitPara, containerControl); if (asynExcute == null) { throw new ArgumentNullException("asynExcute"); } asynWaitPara.AsynWait = asynWait; asynExcute.Excute(asynWaitPara, containerControl); }
/// <summary> /// 构造函数 /// </summary> /// <param name="para">输入参数</param> /// <param name="token">取消通知对象</param> /// <param name="asynWait">异步等待提示UI</param> public PartAsynFuncPara(T para, CancellationToken token, IPartAsynWait asynWait) { this.Para = para; this.Token = token; this.AsynWait = asynWait; }