public void GetTweetsAsync(Action <IEnumerable <Tweet> > success, Action <Exception> error) { _success = success; _error = error; MvxAsyncDispatcher.BeginAsync(DoAsyncSearch); }
private void OnRequestFinished(MvxFileDownloadRequest request) { lock (this) { _currentRequests.Remove(request); if (_queuedRequests.Any()) { MvxAsyncDispatcher.BeginAsync(StartNextQueuedItem); } } }
public void RequestAsyncSave(List <string> toSave) { lock (this) { var wasNull = _toSave == null; _toSave = toSave; if (wasNull) { MvxAsyncDispatcher.BeginAsync(DoSave); } } }
private void DoRefreshTail() { if (IsRefreshingTail) { return; } IsRefreshingTail = true; MvxAsyncDispatcher.BeginAsync(() => { MvxAsyncDispatcher.Sleep(3000); this.InvokeOnMainThread(() => { AddEmailsTail(1 + Random.Next(5)); IsRefreshingTail = false; }); }); }
private void DoRefreshHead() { if (IsRefreshingHead) { return; } IsRefreshingHead = true; MvxAsyncDispatcher.BeginAsync(() => { Sleeper.Sleep(TimeSpan.FromSeconds(2.0)); this.InvokeOnMainThread(() => { AddEmailsHead(1 + Random.Next(5)); IsRefreshingHead = false; }); }); }
public void RequestDownload(string url, string downloadPath, Action success, Action <Exception> error) { var request = new MvxFileDownloadRequest(url, downloadPath); request.DownloadComplete += (sender, args) => { OnRequestFinished(request); success(); }; request.DownloadFailed += (sender, args) => { OnRequestFinished(request); error(args.Exception); }; lock (this) { _queuedRequests.Enqueue(request); if (_currentRequests.Count < _maxConcurrentDownloads) { MvxAsyncDispatcher.BeginAsync(StartNextQueuedItem); } } }
public static void StartAsyncSearch(string searchText, Action <IEnumerable <Tweet> > success, Action <Exception> error) { MvxAsyncDispatcher.BeginAsync(() => DoAsyncSearch(searchText, success, error)); }
public void BeginAsyncLoad() { IsLoading = true; MvxAsyncDispatcher.BeginAsync(Load); }
public void RequestImage(string url, Action <T> success, Action <Exception> error) { MvxAsyncDispatcher.BeginAsync(() => DoRequestImage(url, success, error)); }