public async Task GetUpdate() { if (_isUpdating) return; try { _isUpdating = true; UpdatesRequest request = new UpdatesRequest(); request.last_activity_date = LastActivity; UpdatesResponse response = await request.GetUpdate(); if (response.Matches != null && response.Matches.Length > 0) { _matches.Update(response.Matches); } LastActivity = DateTime.Parse(response.LastActivityDate); } catch (HttpRequestException e) { if (e.Message.Contains("Unauthorized")) { (Application.Current as IApp).Logout(); } } catch (Exception ex) { Console.WriteLine("Exception during update: " + ex.Message); } finally { _isUpdating = false; } }
public async Task<UpdatesResponse> GetUpdate() { if (_isUpdating) return null; try { _isUpdating = true; UpdatesRequest request = new UpdatesRequest(); request.last_activity_date = LastActivity; UpdatesResponse response = await request.GetUpdate(); if (response.Matches != null && response.Matches.Length > 0) { _matches.Update(response.Matches); } LastActivity = DateTime.Parse(response.LastActivityDate); return response; } finally { _isUpdating = false; } }