private void BeginRefresh(View viewToUpdate, IRefreshListener refreshAction) { ViewGroup.LayoutParams layoutParams = viewToUpdate.LayoutParameters; layoutParams.Height = (int)PullElementStandbyHeight; viewToUpdate.LayoutParameters = layoutParams; //UITrace.Trace("PullDown:refreshing"); State = new RefreshingState(); ThreadPool.QueueUserWorkItem((ignored) => { try { //var start = DateTime.UtcNow; refreshAction.DoRefresh(); //var finish = DateTime.UtcNow; //long difference = finish - start; //try //{ // Thread.Sleep(Math.Max(difference, 1500)); //} //catch (InterruptedException e) //{ //} } catch (RuntimeException e) { //UITrace.Trace("Error: {0}", e.ToLongString()); throw e; } finally { RunOnUiThread(() => RefreshFinished(refreshAction)); } }); }
public void DoRefresh() { Parent._uiThreadHandler.Post(() => { Parent.SetRefreshing(Parent._lowerButton); Parent.Invalidate(); }); _listener.DoRefresh(); }
private void BeginRefresh(View viewToUpdate, IRefreshListener refreshAction) { ViewGroup.LayoutParams layoutParams = viewToUpdate.LayoutParameters; layoutParams.Height = (int) PullElementStandbyHeight; viewToUpdate.LayoutParameters = layoutParams; //UITrace.Trace("PullDown:refreshing"); State = new RefreshingState(); ThreadPool.QueueUserWorkItem((ignored) => { try { //var start = DateTime.UtcNow; refreshAction.DoRefresh(); //var finish = DateTime.UtcNow; //long difference = finish - start; //try //{ // Thread.Sleep(Math.Max(difference, 1500)); //} //catch (InterruptedException e) //{ //} } catch (RuntimeException e) { //UITrace.Trace("Error: {0}", e.ToLongString()); throw e; } finally { RunOnUiThread(() => RefreshFinished(refreshAction)); } }); }