示例#1
0
 public WpfThread(ParameterizedThreadStart parameterizedThreadStart)
 {
     BackgroundThread = new System.Threading.Thread(x => CatchForAction.ExceptionToUiThread("WpfThreadPool Error", () => parameterizedThreadStart.Invoke(x)))
     {
         IsBackground = true
     };
 }
示例#2
0
 public WpfThread(ThreadStart threadStart)
 {
     BackgroundThread = new System.Threading.Thread(() => CatchForAction.ExceptionToUiThread("WpfThread Error", threadStart.Invoke))
     {
         IsBackground = true
     };
 }
示例#3
0
 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);
 }