public WpfThread(ParameterizedThreadStart parameterizedThreadStart) { BackgroundThread = new System.Threading.Thread(x => CatchForAction.ExceptionToUiThread("WpfThreadPool Error", () => parameterizedThreadStart.Invoke(x))) { IsBackground = true }; }
public WpfThread(ThreadStart threadStart) { BackgroundThread = new System.Threading.Thread(() => CatchForAction.ExceptionToUiThread("WpfThread Error", threadStart.Invoke)) { IsBackground = true }; }
public static Task FactoryStartNew(Action action) { return(Task.Factory.StartNew(() => { var errgiid = Guid.NewGuid().ToString(); //生成一个ERRID记录在日志,方便在日志中定义线程错误 CatchForAction.ExceptionToUiThread("Factory Task Error" + Environment.NewLine + errgiid, action); })); }
public static void QueueUserWorkItem(WaitCallback callback) { ThreadPool.QueueUserWorkItem(x => CatchForAction.ExceptionToUiThread("WpfThreadPool Error", () => callback(x))); }
public static void UnsafeQueueUserWorkItem(WaitCallback callback, object state) { ThreadPool.UnsafeQueueUserWorkItem(x => CatchForAction.ExceptionToUiThread("WpfThreadPool Error", () => callback(state)), null); }