public static T DispatchToMainThreadReturn <T>(CallBackReturn <T> dispatchCall, bool safeMode = true)
        {
            bool flag = MainThreadWatchdog.CheckIfMainThread();
            T    result;

            if (flag)
            {
                bool flag2 = dispatchCall != null;
                if (flag2)
                {
                    result = dispatchCall();
                }
                else
                {
                    result = default(T);
                }
            }
            else
            {
                ThreadDispatchAction <T> threadDispatchAction = new ThreadDispatchAction <T>();
                MainThreadDispatcher.dispatchActions.Enqueue(threadDispatchAction);
                threadDispatchAction.Init(dispatchCall, safeMode);
                result = threadDispatchAction.dispatchExecutionResult2;
            }
            return(result);
        }
Ejemplo n.º 2
0
 public static T DispatchToMainThreadReturn <T>(CallBackReturn <T> dispatchCall, bool safeMode = true)
 {
     if (MainThreadWatchdog.CheckIfMainThread())
     {
         if (dispatchCall != null)
         {
             return(dispatchCall());
         }
     }
     else
     {
         ThreadDispatchAction <T> t = new ThreadDispatchAction <T>();
         dispatchActions.Enqueue(t);
         t.Init(dispatchCall, safeMode);
         return(t.dispatchExecutionResult2);
     }
     return(default(T));
 }
 public void Init(CallBackReturn <T> dispatchCall, bool safeMode)
 {
     this.safeMode            = safeMode;
     this.dispatchCallReturn2 = dispatchCall;
     this.ValidateExecutionOnInit(true);
 }
Ejemplo n.º 4
0
 public static T DispatchToMainThreadReturn <T>(CallBackReturn <T> dispatchCall, bool safeMode = true)
 {
     return(MainThreadDispatcher.DispatchToMainThreadReturn <T>(dispatchCall, safeMode));
 }
Ejemplo n.º 5
0
 public static object DispatchToMainThreadReturn(CallBackReturn dispatchCall, bool safeMode = true)
 {
     return(MainThreadDispatcher.DispatchToMainThreadReturn(dispatchCall, safeMode));
 }