private C8oPromise <T> Then(C8oOnResponse <T> c8oOnResponse, bool ui) { if (nextPromise != null) { return(nextPromise.Then(c8oOnResponse, ui)); } else { c8oResponse = new KeyValuePair <C8oOnResponse <T>, bool>(c8oOnResponse, ui); nextPromise = new C8oPromise <T>(c8o); if (lastFailure != null) { nextPromise.lastFailure = lastFailure; nextPromise.lastParameters = lastParameters; } if (lastResponse != null) { c8o.RunBG(OnResponse); } return(nextPromise); } }
/// <summary> /// Will be executed in a UI thread when a response is returned by the Server. /// </summary> /// <param name="c8oOnResponse">A C8oOnResponse lambda function</param> /// <returns>the same C8oPromise object to chain for other calls</returns> public C8oPromise <T> ThenUI(C8oOnResponse <T> c8oOnResponse) { return(Then(c8oOnResponse, true)); }
/// <summary> /// Will be executed in a worker thread when a response is returned by the Server. /// </summary> /// <param name="c8oOnResponse">A C8oOnResponse lambda function</param> /// <returns>the same C8oPromise object to chain for other calls</returns> public C8oPromise <T> Then(C8oOnResponse <T> c8oOnResponse) { return(Then(c8oOnResponse, false)); }