public void Init(CallBackArgRturn <T> dispatchCall, T dispatchArgumentParameter, bool safeMode)
 {
     this.safeMode = safeMode;
     this.dispatchCallArgReturn = dispatchCall;
     this.dispatchArgParam      = dispatchArgumentParameter;
     this.ValidateExecutionOnInit(true);
 }
        public static object DispatchToMainThreadReturn <T>(CallBackArgRturn <T> dispatchCall, T dispatchArgument, bool safeMode = true)
        {
            bool   flag = MainThreadWatchdog.CheckIfMainThread();
            object result;

            if (flag)
            {
                bool flag2 = dispatchCall != null;
                if (flag2)
                {
                    result = dispatchCall(dispatchArgument);
                }
                else
                {
                    result = null;
                }
            }
            else
            {
                ThreadDispatchAction <T> threadDispatchAction = new ThreadDispatchAction <T>();
                MainThreadDispatcher.dispatchActions.Enqueue(threadDispatchAction);
                threadDispatchAction.Init(dispatchCall, dispatchArgument, safeMode);
                result = threadDispatchAction.dispatchExecutionResult;
            }
            return(result);
        }
Пример #3
0
 public static object DispatchToMainThreadReturn <T>(CallBackArgRturn <T> dispatchCall, T dispatchArgument, bool safeMode = true)
 {
     if (MainThreadWatchdog.CheckIfMainThread())
     {
         if (dispatchCall != null)
         {
             return(dispatchCall(dispatchArgument));
         }
     }
     else
     {
         ThreadDispatchAction <T> t = new ThreadDispatchAction <T>();
         dispatchActions.Enqueue(t);
         t.Init(dispatchCall, dispatchArgument, safeMode);
         return(t.dispatchExecutionResult);
     }
     return(null);
 }
Пример #4
0
 public static object DispatchToMainThreadReturn <T>(CallBackArgRturn <T> dispatchCall, T dispatchArgument, bool safeMode = true)
 {
     return(MainThreadDispatcher.DispatchToMainThreadReturn <T>(dispatchCall, dispatchArgument, safeMode));
 }