public static void PollOnUpdateUntilComplete(Func <bool> condition) { object obj = RunOnMainThread.pollingJobs; lock (obj) { RunOnMainThread.pollingJobs.Add(condition); } if (RunOnMainThread.ExecuteNow && RunOnMainThread.OnMainThread) { RunOnMainThread.RunAction(delegate { while (true) { RunOnMainThread.ExecuteAll(); object obj2 = RunOnMainThread.pollingJobs; lock (obj2) { if (RunOnMainThread.pollingJobs.Count == 0) { break; } } Thread.Sleep(100); } }); } }
public static bool TryExecuteAll() { if (RunOnMainThread.OnMainThread) { RunOnMainThread.ExecuteAll(); return(true); } return(false); }
public static void Run(Action job, bool runNow = true) { object obj = RunOnMainThread.jobs; bool flag; lock (obj) { flag = (RunOnMainThread.jobs.Count == 0); RunOnMainThread.jobs.Enqueue(job); } if ((flag || RunOnMainThread.ExecuteNow) && runNow && RunOnMainThread.OnMainThread) { RunOnMainThread.ExecuteAll(); } }