コード例 #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);
     }));
 }
コード例 #4
0
 public static void QueueUserWorkItem(WaitCallback callback)
 {
     ThreadPool.QueueUserWorkItem(x => CatchForAction.ExceptionToUiThread("WpfThreadPool Error", () => callback(x)));
 }
コード例 #5
0
 public static void UnsafeQueueUserWorkItem(WaitCallback callback, object state)
 {
     ThreadPool.UnsafeQueueUserWorkItem(x => CatchForAction.ExceptionToUiThread("WpfThreadPool Error", () => callback(state)), null);
 }