public void RunNewThread <T1, T2, T3, T4>(Action <T1, T2, T3, T4> action, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
        {
            Thread thread = new Thread(() => SafeMethodWapper.Wrapper <T1, T2, T3, T4>(action)(arg1, arg2, arg3, arg4));

            thread.IsBackground = true;
            thread.Start();
        }
        public void RunNewThread <T>(Action <T> action, T arg)
        {
            Thread thread = new Thread(() => SafeMethodWapper.Wrapper <T>(action)(arg));

            thread.IsBackground = true;
            thread.Start();
        }
        public void RunNewThread(Action action)
        {
            Thread thread = new Thread(() => SafeMethodWapper.Wrapper(action)());

            thread.IsBackground = true;
            thread.Start();
        }
        public IStopSignal RunWhileTrueNewThread(Action action, int intervalInMS)
        {
            StopSignal signal = new StopSignal();

            Thread thread = new Thread(() => WhileTureMethodWrapper.Wrapper(SafeMethodWapper.Wrapper(action), intervalInMS, signal)());

            thread.IsBackground = true;
            thread.Start();
            return(signal);
        }
        public void Pipe <T>(T pipeState, IEnumerable <Action <T> > actions)
        {
            Thread thread = new Thread(() =>
            {
                SafeMethodWapper.Wrapper <T>((m) =>
                {
                    foreach (Action <T> action in actions)
                    {
                        action(pipeState);
                    }
                }
                                             );
            }
                                       );

            thread.IsBackground = true;
            thread.Start();
        }
 public void RunUIThread(Control control, MethodInvoker invoker)
 {
     try
     {
         MethodInvoker invokerWrapped = SafeMethodWapper.Wrapper(invoker);
         if (control.InvokeRequired)
         {
             control.Invoke(invokerWrapped);
             return;
         }
         invokerWrapped.Invoke();
     }
     catch (Exception ex)
     {
         IAFExceptionManagerFactory.CreateIAFExceptionManager()
         .ManagerException(0, ExceptionPriority.Medium, ex);
     }
 }
        public TResult RunNewThread <TResult>(Func <TResult> func)
        {
            Func <TResult> funcWrapper = null;

            if (IsTraceBusinessObject)
            {
                funcWrapper = BisunessObjectTraceWapper.Wrapper <TResult>(SafeMethodWapper.Wrapper <TResult>(func));
            }
            else
            {
                funcWrapper = SafeMethodWapper.Wrapper <TResult>(func);
            }

            TResult      result = default(TResult);
            IAsyncResult ir     = funcWrapper.BeginInvoke(null, null);

            ir.AsyncWaitHandle.WaitOne();
            result = funcWrapper.EndInvoke(ir);
            return(result);
        }