public void GetNewsDetailAsync(int storyId, Action<NewsDetailDTO> onSuccess, Action<Exception> onError) { var client = new Client(RPC_URI); client.BeginLogIn(USERNAME, PASSWORD, ar => { try { client.EndLogIn(ar); client.BeginGetNewsDetail(storyId.ToString(), ar2 => { try { var resp = client.EndGetNewsDetail(ar2); _client.BeginLogOut(ar3 => _client.EndLogOut(ar3), null); onSuccess(resp.NewsDetail); } catch (Exception exc) { onError(exc); } }, null); } catch (Exception exc) { onError(exc); } }, null); }